RPM Community Forums

Mailing List Message of <rpm-devel>

Re: [CVS] RPM: rpm/ VENDOR rpm/lib/ psm.c rpm/rpmdb/ rpmtag.h

From: Ralf S. Engelschall <rse+rpm-devel@rpm5.org>
Date: Wed 30 Jan 2008 - 22:29:38 CET
Message-ID: <20080130212938.GA39148@engelschall.com>
On Wed, Jan 30, 2008, Ralf S. Engelschall wrote:

> [...]
> The "first install time" then could be implemented e.g. like this:
>
> %_install_tag_filter_INSTALLTIME() \
>     INSTALLTIME %1 \
>     INSTALLTIME1ST %%|INSTALLTIME1ST?{%%{INSTALLTIME1ST}}:{%1}|
>
> To allow one to create new tags from scratch, RPM additionally would
> always expand and process the filter "%{__install_tag_filter_NONE}".
> This allows e.g.:
>
> %_install_tag_filter_NONE() \
>     FOO My\ Lovely\ Custom\ Tag
>
> And because the values are macro-expanded before they are
> treated as query string one even could do crazy things like:
>
> %_install_tag_filter_FOO() \
>     FOO %{lua: print(util.rsubst(rpm.expand("%1"), "[ \t]+", "")) }
>
> Which would during installation would remove all whitespaces from the
> value of tag FOO.

There is one more possibility, but it perhaps is still not acceptable
for all people (I'm personally fine with it): One does no macro tricks
here at all. Instead during installation one simply puts all tags into
a key/value table, calls a RPM Lua function with this table, allow
this function to modify the table in arbitrary ways and then use the
key/value pairs in the resulting table. This way one does not have to
escape anything, one can delete, add and modifiy tags easily, etc. One
just need RPM Lua for this, but OTOH: those who want to do RPM tricks
need RPM Lua anyway. So this would be no major drawback. And because
RPM Lua has the rpm.query() command (although this also opens a new DB
transaction) one can do really cool tricks! I personally favor this
approach...
                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com
Received on Wed Jan 30 22:30:51 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.