[Rpm-maint] [PATCH 15/19] Remember that a package was installed with --nopolicy
Steve Lawrence
slawrence at tresys.com
Tue Feb 2 20:25:18 UTC 2010
Policy modules should be ignored during policy conflict detection if a
package was installed with --nopolicy. This patch remembers if a package
was installed with --nopolicy by added a new tag, RPMTAG_NOPOLICIES,
and setting its value to the time the package was installed. When doing
conflict checks, the existence of the tag in a header tells rpm to ignore
its policies during conflict detection.
---
lib/psm.c | 4 ++++
lib/rpmpol.c | 2 +-
lib/rpmtag.h | 1 +
tests/rpmgeneral.at | 1 +
4 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/lib/psm.c b/lib/psm.c
index f23635b..28e63f1 100644
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -1391,6 +1391,10 @@ rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
headerPutChar(h, RPMTAG_FILESTATES, fileStates, fc);
}
+ if (rpmtsFlags(ts) & RPMTRANS_FLAG_NOPOLICY) {
+ headerPutUint32(h, RPMTAG_NOPOLICIES, &installTime, 1);
+ }
+
headerPutUint32(h, RPMTAG_INSTALLTIME, &installTime, 1);
headerPutUint32(h, RPMTAG_INSTALLCOLOR, &tscolor, 1);
headerFree(h);
diff --git a/lib/rpmpol.c b/lib/rpmpol.c
index e2aaed0..3fb397a 100644
--- a/lib/rpmpol.c
+++ b/lib/rpmpol.c
@@ -930,7 +930,7 @@ rpmRC rpmpolsCheckConflicts(rpmpols ps, rpmdb db)
/* check this rpmpol against all currently installed policies */
rpmdbMatchIterator mi = rpmdbInitIterator(db, RPMDBI_PACKAGES, NULL, 0);
while ((h = rpmdbNextIterator(mi)) != NULL) {
- if (!headerIsEntry(h, RPMTAG_POLICIES)) {
+ if (!headerIsEntry(h, RPMTAG_POLICIES) || headerIsEntry(h, RPMTAG_NOPOLICIES)) {
continue;
}
diff --git a/lib/rpmtag.h b/lib/rpmtag.h
index 95fa8a7..677383a 100644
--- a/lib/rpmtag.h
+++ b/lib/rpmtag.h
@@ -282,6 +282,7 @@ typedef enum rpmTag_e {
RPMTAG_POLICYFLAGS = 2103, /* i[] */
RPMTAG_POLICYOBSOLETES = 2104, /* s[] */
RPMTAG_POLICYOBSOLETESBY = 2105, /* i[] */
+ RPMTAG_NOPOLICIES = 2106, /* i */
RPMTAG_FILENAMES = 5000, /* s[] extension */
RPMTAG_FILEPROVIDE = 5001, /* s[] extension */
RPMTAG_FILEREQUIRE = 5002, /* s[] extension */
diff --git a/tests/rpmgeneral.at b/tests/rpmgeneral.at
index 5a930cf..2076cf8 100644
--- a/tests/rpmgeneral.at
+++ b/tests/rpmgeneral.at
@@ -154,6 +154,7 @@ N
NAME
NEVR
NEVRA
+NOPOLICIES
NVR
NVRA
O
--
1.6.2.5
More information about the Rpm-maint
mailing list