summaryrefslogtreecommitdiff
path: root/lib/rpmte.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2010-12-13 12:03:18 +0200
committerPanu Matilainen <pmatilai@redhat.com>2010-12-13 12:26:06 +0200
commit5c43095e1d78b3befe93c746fd182746c3b96c92 (patch)
treec57347a08501be44320ce49c36a774ff6c647b8b /lib/rpmte.c
parent185de185262b2772fa692efc69633f41afc5832a (diff)
downloadlibrpm-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/rpmte.c')
-rw-r--r--lib/rpmte.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/rpmte.c b/lib/rpmte.c
index 7d2dc080f..c36e8cbb7 100644
--- a/lib/rpmte.c
+++ b/lib/rpmte.c
@@ -45,6 +45,7 @@ struct rpmte_s {
rpmds requires; /*!< Requires: dependencies. */
rpmds conflicts; /*!< Conflicts: dependencies. */
rpmds obsoletes; /*!< Obsoletes: dependencies. */
+ rpmds order; /*!< Order: dependencies. */
rpmfi fi; /*!< File information. */
rpmps probs; /*!< Problems (relocations) */
rpmts ts; /*!< Parent transaction */
@@ -82,6 +83,7 @@ void rpmteCleanDS(rpmte te)
te->requires = rpmdsFree(te->requires);
te->conflicts = rpmdsFree(te->conflicts);
te->obsoletes = rpmdsFree(te->obsoletes);
+ te->order = rpmdsFree(te->order);
}
static rpmfi getFI(rpmte p, Header h)
@@ -232,6 +234,7 @@ static void addTE(rpmte p, Header h, fnpyKey key, rpmRelocation * relocs)
p->requires = rpmdsNew(h, RPMTAG_REQUIRENAME, 0);
p->conflicts = rpmdsNew(h, RPMTAG_CONFLICTNAME, 0);
p->obsoletes = rpmdsNew(h, RPMTAG_OBSOLETENAME, 0);
+ p->order = rpmdsNew(h, RPMTAG_ORDERNAME, 0);
p->fs = rpmfsNew(h, p->type);
p->fi = getFI(p, h);
@@ -532,6 +535,7 @@ rpmds rpmteDS(rpmte te, rpmTagVal tag)
case RPMTAG_REQUIRENAME: return te->requires;
case RPMTAG_CONFLICTNAME: return te->conflicts;
case RPMTAG_OBSOLETENAME: return te->obsoletes;
+ case RPMTAG_ORDERNAME: return te->order;
default: break;
}
return NULL;