RPM Community Forums

Mailing List Message of <rpm-users>

Re: Clarification of the way triggers do work

From: Tobias Gerschner <tobias.gerschner@gmail.com>
Date: Thu 15 Oct 2009 - 04:10:34 CEST
Message-ID: <ea7e82ce0910141910wc238c47ka05735a7ab967aac@mail.gmail.com>
2009/10/15 Jeff Johnson <n3npq@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
>
> ______________________________________________________________________
> RPM Package Manager                                    http://rpm5.org
> User Communication List                             rpm-users@rpm5.org
>

Hi Jeff,

Thanks for the clarification. So my understanding of the triggers is
correct and yes, case 2 is vice versa case 1.

Regards

-- 
Tobias Gerschner
Yoper Linux - www.yoper.com

Knowing is not enough; we must apply. Willing is not enough; we must do.
Received on Thu Oct 15 04:11:01 2009
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.