RPM Community Forums

Mailing List Message of <rpm-devel>

Re: modular %posttrans-like scripts

From: Alexey Tourbin <at@altlinux.ru>
Date: Thu 04 Sep 2008 - 22:53:08 CEST
Message-ID: <20080904205308.GK6477@altlinux.org>
On Wed, Aug 27, 2008 at 09:13:18AM -0400, Jeff Johnson wrote:
> There's the Mandriva solution, called "file triggers", to the cache  
> update
> problem in lib/filetriggers.c. I dislike several things with the the  
> specific
> Mandriva implementation, but the idea is closest to being generally  
> useful IMHO.

lib/transaction.c:
  1880          if ((rpmtsFlags(ts) & _noTransTriggers) != _noTransTriggers)
  1881              rpmRunFileTriggers(rpmtsRootDir(ts));

Perhaps I need more general *mechanism* which can implement file
triggers as a site/vendor *policy*, and which is not limited itself
to file triggers.

-		    rpmRunFileTriggers(rpmtsRootDir(ts));
+		    rpmRunSitePosttrans(ts);

In rpmRunSitePosttrans, what possibly can be done is provide
the ability for lua script to access installed and removed headers.

That is, rpmRunSitePosttrans can call lua script
/usr/lib/rpm/posttrans.lua with basically two arguments:
the list of removed package instance numbers, and the list
of added instance numbers (in the transaction ts).

Also, it is necessary to provide lua bindings for 1) retrieving
headers by instance, perhepas something like "h = getAddedHeader(num)"
and "h = getRemovedHeader(num)"; and 2) retrieving header entries,
e.g. "h.filenames".

Then the whole notion of "posttrans file triggers" or whatever posttrans
triggers can be implemented that posttrans.lua script.

Now, it is easy to retrive headers of added packages, but it is a tricky
question if I can access headers of removed packages, i.e. the headers
that's been removed from rpmdb while the transaction ts is not finished
yet.  There seems to be RPMDBI_REMOVED temporary database, but I am not
sure how it is supposed to work.


  • application/pgp-signature attachment: stored
Received on Thu Sep 4 22:53:13 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.