Allow deprecations to work accross colors (RhBug:713323)
authorAles Kozumplik <akozumpl@redhat.com>
Fri, 23 Dec 2011 12:51:38 +0000 (13:51 +0100)
committerAles Kozumplik <akozumpl@redhat.com>
Fri, 23 Dec 2011 13:36:42 +0000 (14:36 +0100)
This enables package maintainers to:

- Force removal of a no longer supported multilib library (the patch also
  removes the check against obsoleting packages of the same name).

- Deprecate packages of different header color than the package's. Note:
  even x86_64 packages can have header color 1 in which case we are
  currently left with no means to deprecate them from another x86_64
  package. (RhBug:751574)

lib/depends.c

index 90df472..6ad97aa 100644 (file)
@@ -178,17 +178,18 @@ static void addObsoleteErasures(rpmts ts, tsMembers tsmem, rpm_color_t tscolor,
        if ((Name = rpmdsN(obsoletes)) == NULL)
            continue;   /* XXX can't happen */
 
-       /* XXX avoid self-obsoleting packages. */
-       if (rstreq(rpmteN(p), Name))
-           continue;
-
        mi = rpmtsPrunedIterator(ts, RPMDBI_NAME, Name, 1);
 
        while((oh = rpmdbNextIterator(mi)) != NULL) {
-           /* Ignore colored packages not in our rainbow. */
-           if (skipColor(tscolor, hcolor, 
-                         headerGetNumber(oh, RPMTAG_HEADERCOLOR)))
+           const char *oarch = headerGetString(oh, RPMTAG_ARCH);
+
+           /* avoid self-obsoleting packages */
+           if (rstreq(rpmteN(p), Name) && rstreq(rpmteA(p), oarch)) {
+               char * ohNEVRA = headerGetAsString(oh, RPMTAG_NEVRA);
+               rpmlog(RPMLOG_DEBUG, "  Not obsoleting: %s\n", ohNEVRA);
+               free(ohNEVRA);
                continue;
+           }
 
            /*
             * Rpm prior to 3.0.3 does not have versioned obsoletes.