Hi,

the attached patch fixes 'rpm -V' reporting self-conflicts and
self-obsoletes as errors. The code ignored them already when
checking against the added list, but not when checking against
installed packages, which is done for 'rpm -V'.

(Panu, please add a testcase ;) )

Cheers,
  Michael.

-- 
Michael Schroeder                                   m...@suse.de
SUSE LINUX Products GmbH,  GF Jeff Hawn, HRB 16746 AG Nuernberg
main(_){while(_=~getchar())putchar(~_-1/(~(_|32)/13*2-11)*13);}
>From fae0eef24582dd9e071be8e884ff0851d4b57437 Mon Sep 17 00:00:00 2001
From: Michael Schroeder <m...@suse.de>
Date: Fri, 27 Sep 2013 15:09:20 +0200
Subject: [PATCH] Ignore self-obsoletes and self-conflicts in dependency check
 code

We already ignored them when checking against the added package list,
but not when checking against installed packages. Thus, rpm -V reported
them as errors.
---
 lib/depends.c | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/lib/depends.c b/lib/depends.c
index 3d70e68..3ef27bc 100644
--- a/lib/depends.c
+++ b/lib/depends.c
@@ -504,6 +504,12 @@ static int rpmdbProvides(rpmts ts, depCache dcache, rpmds dep)
     if (deptag != RPMTAG_OBSOLETENAME && Name[0] == '/') {
 	mi = rpmtsPrunedIterator(ts, RPMDBI_INSTFILENAMES, Name, prune);
 	while ((h = rpmdbNextIterator(mi)) != NULL) {
+	    /* Ignore self-conflicts */
+	    if (deptag == RPMTAG_CONFLICTNAME) {
+		unsigned int instance = headerGetInstance(h);
+		if (instance && instance == rpmdsInstance(dep))
+		    continue;
+	    }
 	    rpmdsNotify(dep, "(db files)", rc);
 	    break;
 	}
@@ -527,6 +533,12 @@ static int rpmdbProvides(rpmts ts, depCache dcache, rpmds dep)
 	    int prix = (selfevr) ? -1 : rpmdbGetIteratorFileNum(mi);
 	    int match = rpmdsMatches(tspool, h, prix, dep, selfevr,
 					_rpmds_nopromote);
+	    /* Ignore self-obsoletes and self-conflicts */
+	    if (match && (deptag == RPMTAG_OBSOLETENAME || deptag == RPMTAG_CONFLICTNAME)) {
+		unsigned int instance = headerGetInstance(h);
+		if (instance && instance == rpmdsInstance(dep))
+		    match = 0;
+	    }
 	    if (match) {
 		rpmdsNotify(dep, "(db provides)", rc);
 		break;
@@ -672,8 +684,18 @@ static void checkInstDeps(rpmts ts, depCache dcache, rpmte te,
     rpmstrPool pool = rpmtsPool(ts);
 
     while ((h = rpmdbNextIterator(mi)) != NULL) {
-	char * pkgNEVRA = headerGetAsString(h, RPMTAG_NEVRA);
-	rpmds ds = rpmdsNewPool(pool, h, depTag, 0);
+	char * pkgNEVRA;
+	rpmds ds;
+
+	/* Ignore self-obsoletes and self-conflicts */
+	if (depTag == RPMTAG_OBSOLETENAME || depTag == RPMTAG_CONFLICTNAME) {
+	    unsigned int instance = headerGetInstance(h);
+	    if (instance && instance == rpmteDBInstance(te))
+		continue;
+	}
+
+	pkgNEVRA = headerGetAsString(h, RPMTAG_NEVRA);
+	ds = rpmdsNewPool(pool, h, depTag, 0);
 
 	checkDS(ts, dcache, te, pkgNEVRA, ds, dep, 0);
 
-- 
1.8.1.4

_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint

Reply via email to