RPM Community Forums

Mailing List Message of <rpm-users>

Re: Clarification of the way triggers do work

From: Jeff Johnson <n3npq@mac.com>
Date: Thu 15 Oct 2009 - 00:17:51 CEST
Message-id: <79D4AADA-58B1-461D-9833-913B149A6E80@mac.com>

On Oct 14, 2009, at 5:39 PM, Tobias Gerschner wrote:

> Hi,
>
> I have a couple of packages were the use of triggers does not produce
> the expected result. Probably my understanding of the trigger logic is
> wrong. Sorry I am still using rpm 4.4.5 in production and not rpm5 as
> I want to .
>
> I have a package foo, which contains
>
> %triggerin -- bar
> ln -sf /path/file/from/foo /path/directory/from/bar
>
> My expectations are:

Here's the sequence diagram for when and where triggers fire:
   all-%pretrans
   ...
   any-%triggerprein (%triggerprein from other packages set off by new  
install)
   new-%triggerprein
   new-%pre      for new version of package being installed
   ...           (all new files are installed)
   new-%post     for new version of package being installed

   any-%triggerin (%triggerin from other packages set off by new  
install)
   new-%triggerin
   old-%triggerun
   any-%triggerun (%triggerun from other packages set off by old  
uninstall)

   old-%preun    for old version of package being removed
   ...           (all old files are removed)
   old-%postun   for old version of package being removed

   old-%triggerpostun
   any-%triggerpostun (%triggerpostun from other packages set off by  
old un
                 install)
   ...
   all-%posttrans

>
> 1) Package foo is already installed. When package bar is being
> installed the %triggerin scriptlet will be executed after the %post
> scriptlet from package bar

When bar (the new package) is being installed, the already installed  
foo trigger
should fire at
	any-triggerin
which is just after new-post (i.e. the %post from the new package  
bar ...).

> 2) Package bar is already installed. When package foo is being
> installed the %triggerin scriptlet will be executed after the %post
> scriptlet from package foo.
>

This appears to be just swapping foo <-> bar in what I just described.
If that isn't what you meant, ask again. Its crazy hard to try and
talk precisely about trigger behavior ;-)

> Is this correct or is this wrong ? The triggers only need to be
> executed once to set symlinks on upgrade no action needs to be taken.
>

Triggers will fire whenever the trigger condition is met. That may or  
may not
be only once on upgrade. Just make sure the trigger body is prepared
to create symlinks iff the symlink does not already exist. Running a
trigger isn't particularly expensive, and the trigger condition should
be tuned (by adding version comparison) to limit the trigger condition.

hth

73 de Jeff
Received on Thu Oct 15 00:18:14 2009
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.