diff options
author | Steve Lawrence <slawrence@tresys.com> | 2010-06-21 17:04:38 -0400 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2010-06-22 11:12:43 +0300 |
commit | 2fd0913a6abd91389a3f1498ef9c4b2c6c72bff1 (patch) | |
tree | 0432e5945aeb604e692405b667d90618c212eebe /lib/rpmal.c | |
parent | 015870830503700b1aa7921407752792a8388792 (diff) | |
download | rpm-2fd0913a6abd91389a3f1498ef9c4b2c6c72bff1.tar.gz rpm-2fd0913a6abd91389a3f1498ef9c4b2c6c72bff1.tar.bz2 rpm-2fd0913a6abd91389a3f1498ef9c4b2c6c72bff1.zip |
Add common Collection requirements
This patch adds the install-time feature that if a package requires a package
in a collection, then it also requires all other packages in that collection.
This has the effect that collections will be roughly grouped together during a
transaction.
Although this is not absolutely necessary for the majority of collections, it
is required for the SELinux collection. This is because all SELinux policies
must be installed before the applications they secure to ensure correct labels.
This means we must ensure packages in the selinux collection are ordered
earlier in the transaction than all applications they protect. Adding this
implicit runtime requirements achieves this in a general manner, without major
modifications to dependency ordering.
To accomplish this, this patch splits the addRelation function into two parts:
one that determines which relations to add, and one that actually adds them.
After the usual relation is added between two packages, it then determines if
the required package contains any collections. If so, it finds all other
packages that are in the same collections and creates additional relations.
Diffstat (limited to 'lib/rpmal.c')
-rw-r--r-- | lib/rpmal.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/rpmal.c b/lib/rpmal.c index abe44b34d..7ad1e8c0f 100644 --- a/lib/rpmal.c +++ b/lib/rpmal.c @@ -11,6 +11,7 @@ #include "lib/rpmal.h" #include "lib/misc.h" +#include "lib/rpmte_internal.h" #include "debug.h" @@ -393,3 +394,28 @@ rpmalSatisfiesDepend(const rpmal al, const rpmds ds) } return best; } + +rpmte * +rpmalAllInCollection(const rpmal al, const char *collname) +{ + rpmte *ret = NULL; + int found = 0; + rpmalNum pkgNum; + + if (!al || !al->list || !collname) + return NULL; + + for (pkgNum = 0; pkgNum < al->size; pkgNum++) { + rpmte p = al->list[pkgNum].p; + if (rpmteHasCollection(p, collname)) { + ret = xrealloc(ret, sizeof(*ret) * (found + 1 + 1)); + ret[found] = p; + found++; + } + } + if (ret) { + ret[found] = NULL; + } + + return ret; +} |