diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2010-12-13 12:03:18 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2010-12-13 12:26:06 +0200 |
commit | 5c43095e1d78b3befe93c746fd182746c3b96c92 (patch) | |
tree | c57347a08501be44320ce49c36a774ff6c647b8b /lib/order.c | |
parent | 185de185262b2772fa692efc69633f41afc5832a (diff) | |
download | librpm-tizen-5c43095e1d78b3befe93c746fd182746c3b96c92.tar.gz librpm-tizen-5c43095e1d78b3befe93c746fd182746c3b96c92.tar.bz2 librpm-tizen-5c43095e1d78b3befe93c746fd182746c3b96c92.zip |
Implement transaction ordering hinting
- Add support for new "OrderWithRequires: foo" spec syntax
which has "if and only if foo is present in transaction, order
the transaction as if this package required foo" semantics.
While it looks, and in some ways is, a soft dependency, this
is not the same as recommends/suggests etc: those have unknown
depsolver policy dependent semantics attached to them, whereas
ordering hints have a clear definition and is only relevant for rpm
itself, depsolvers should not even look at the data.
- This allows packages to express correct ordering for optional
functionality, such as
%post
if [ -x %{_bindir}/register-component ]; then
%{_bindir}/register-component %{name}
fi
If the package containing %{_bindir}/register-component is included
in the same transaction, it makes sense to have it installed before the
package(s) that use it. But as it is fully optional, Requires would
not be appropriate. Using OrderWithRequires allows this to be expressed
without dragging in extraneous dependencies for optional functionality.
Diffstat (limited to 'lib/order.c')
-rw-r--r-- | lib/order.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/order.c b/lib/order.c index e794725aa..d7a91e7cb 100644 --- a/lib/order.c +++ b/lib/order.c @@ -647,12 +647,18 @@ int rpmtsOrder(rpmts ts) rpmal al = (rpmteType(p) == TR_REMOVED) ? erasedPackages : tsmem->addedPackages; rpmds requires = rpmdsInit(rpmteDS(p, RPMTAG_REQUIRENAME)); + rpmds order = rpmdsInit(rpmteDS(p, RPMTAG_ORDERNAME)); while (rpmdsNext(requires) >= 0) { /* Record next "q <- p" relation (i.e. "p" requires "q"). */ (void) addRelation(ts, al, p, requires); } + while (rpmdsNext(order) >= 0) { + /* Record next "q <- p" ordering request */ + (void) addRelation(ts, al, p, order); + } + addCollRelations(al, p, &seenColls); } |