25f00b6cb5
Copy from Base:System/rpm based on submit request 18841 from user mlschroe OBS-URL: https://build.opensuse.org/request/show/18841 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/rpm?expand=0&rev=84
56 lines
1.8 KiB
Diff
56 lines
1.8 KiB
Diff
Also compare the name and not only the version when checking if
|
|
two packages are the same. rh#104066
|
|
|
|
Index: lib/depends.c
|
|
===================================================================
|
|
--- lib/depends.c.orig
|
|
+++ lib/depends.c
|
|
@@ -102,6 +102,24 @@ static int removePackage(rpmts ts, Heade
|
|
return 0;
|
|
}
|
|
|
|
+static int rpmNameVersionCompare(Header first, Header second)
|
|
+{
|
|
+ const char * one, * two;
|
|
+ int rc;
|
|
+
|
|
+ rc = headerGetEntry(first, RPMTAG_NAME, NULL, (void **) &one, NULL);
|
|
+ rc = headerGetEntry(second, RPMTAG_NAME, NULL, (void **) &two, NULL);
|
|
+ rc = strcmp(one, two);
|
|
+ if (rc)
|
|
+ return rc;
|
|
+ rc = headerGetEntry(first, RPMTAG_ARCH, NULL, (void **) &one, NULL);
|
|
+ rc = headerGetEntry(second, RPMTAG_ARCH, NULL, (void **) &two, NULL);
|
|
+ rc = strcmp(one, two);
|
|
+ if (rc)
|
|
+ return rc;
|
|
+ return rpmVersionCompare(first, second);
|
|
+}
|
|
+
|
|
int rpmtsAddInstallElement(rpmts ts, Header h,
|
|
fnpyKey key, int upgrade, rpmRelocation * relocs)
|
|
{
|
|
@@ -291,7 +309,7 @@ addheader:
|
|
continue;
|
|
|
|
/* Skip packages that contain identical NEVR. */
|
|
- if (rpmVersionCompare(h, oh) == 0)
|
|
+ if (rpmNameVersionCompare(h, oh) == 0)
|
|
continue;
|
|
|
|
xx = removePackage(ts, oh, pkgKey);
|
|
@@ -342,11 +360,9 @@ addheader:
|
|
* 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 = headerGetNEVRA(oh, NULL);
|
|
-#ifdef DYING /* XXX see http://bugzilla.redhat.com #134497 */
|
|
- if (rpmVersionCompare(h, oh))
|
|
-#endif
|
|
+ if (rpmNameVersionCompare(h, oh))
|
|
xx = removePackage(ts, oh, pkgKey);
|
|
rpmlog(RPMLOG_DEBUG, " Obsoletes: %s\t\terases %s\n",
|
|
rpmdsDNEVR(obsoletes)+2, ohNEVRA);
|