File nameversioncompare.diff of Package rpm

Also compare the name and not only the version when checking if
two packages are the same. rh#104066

--- ./lib/depends.c.orig	2011-05-12 12:20:01.000000000 +0000
+++ ./lib/depends.c	2011-05-12 12:26:25.000000000 +0000
@@ -95,6 +95,24 @@ static rpmdbMatchIterator rpmtsPrunedIte
     return mi;
 }
 
+static int rpmNameVersionCompare(Header first, Header second)
+{
+    const char * one, * two;
+    int rc;
+
+    one = headerGetString(first, RPMTAG_NAME);
+    two = headerGetString(second, RPMTAG_NAME);
+    rc = strcmp(one, two);
+    if (rc)
+	return rc;
+    one = headerGetString(first, RPMTAG_ARCH);
+    two = headerGetString(second, RPMTAG_ARCH);
+    rc = strcmp(one, two);
+    if (rc)
+	return rc;
+    return rpmVersionCompare(first, second);
+}
+
 #define skipColor(_tscolor, _color, _ocolor) \
 	((_tscolor) && (_color) && (_ocolor) && !((_color) & (_ocolor)))
 
@@ -111,7 +129,7 @@ static void addUpgradeErasures(rpmts ts,
 	    continue;
 
 	/* Skip packages that contain identical NEVR. */
-	if (rpmVersionCompare(h, oh) == 0)
+	if (rpmNameVersionCompare(h, oh) == 0)
 	    continue;
 
 	removePackage(ts, oh, p);
@@ -150,7 +168,7 @@ static void addObsoleteErasures(rpmts ts
 	     * If no obsoletes version info is available, match all names.
 	     */
 	    if (rpmdsEVR(obsoletes) == NULL
-		     || rpmdsAnyMatchesDep(oh, obsoletes, _rpmds_nopromote)) {
+		     || rpmdsNVRMatchesDep(oh, obsoletes, _rpmds_nopromote)) {
 		char * ohNEVRA = headerGetAsString(oh, RPMTAG_NEVRA);
 		rpmlog(RPMLOG_DEBUG, "  Obsoletes: %s\t\terases %s\n",
 			rpmdsDNEVR(obsoletes)+2, ohNEVRA);