Bug 56521

Summary: RFE: run-once pre/post scripts.
Product: [Fedora] Fedora Reporter: Aleksey Nogin <aleksey>
Component: rpmAssignee: Paul Nasrat <nobody+pnasrat>
Status: CLOSED UPSTREAM QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: herrold, mitr
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-06-07 19:59:25 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Aleksey Nogin 2001-11-20 15:50:04 UTC
Currently, when I upgrade, for example, 6 mozilla packages (mozilla,
mozilla-mail, mozilla-psm, etc), the ldconfig and rebuild-databases.sh will
be ran *twelwe* times (6 %postun scripts and 6 %post scripts). It would be
nice if rpm would have a feature that would allow packagers to specify that
a certain script has to be ran only once per rpm invocation, even if a
bunch of packages reqest it. Obviously, not only mozilla packages would
benefit from it...

Comment 1 Jeff Johnson 2001-11-20 15:57:19 UTC
Yup, well understood. In fact, running /sbin/ldconfig in %post
and %postun for each and every package that has a shared
library during an upgrade is more than a bit dumb. I'm willing to
wager that running ldconfig is at least 15% of the wall clock time
of an upgrade. Any takers?

However, since this can't be changed in rpm alone, each and
every package in the distro is gonna need to change, I'm going
to mark this as deferred, as I can't solve the problem in rpm alone.

Comment 2 Aleksey Nogin 2002-05-02 15:24:05 UTC
Yeah, ldconfig is probably the biggest one of all. Especially on upgrade where
all kinds of post and postun scripts call it. I would imagine that solving this
has chances to reduce the upgrade time quite dramatically.

Would the following approach make sense:
- rpm would provide a script /sbin/rpm-run-once such that whenever a package calls
/sbin/rpm-run-once prog args
it would remember it and than run
prog args
at some later point. Of cource, that "some later point" is tricky - if a package
runs something right away (w/o using the rpm-run-once) in a pre script, we need
to make sure all the post scripts for its pre-dependencies have been already
executed.

I guess this means that the post scripts should be ran in batches (delayed until
the first pre script that cares about those). In each batch the first invocation
of "/sbin/rpm-run-once prog args" would just run the "prog args" right away and
then the subsequent calls (with the same prog and args) withing the same batch
would just be ignored.

A cute thing is that we can just start with a dummy implementation -
rpm-run-once would just exec prog args right away. Does not give any advantage
except give people the chance to start converting to new /sbin/rpm-run-once. Can
also be used for legacy rpm versions, once the real thing is there in the new
versions.

Comment 3 Paul Nasrat 2005-06-07 19:59:25 UTC
A specific ldconfig optimisation is available in rpm.