Allow installation of self-conflicting packages (ticket #806, RhBug:651951)
authorPanu Matilainen <pmatilai@redhat.com>
Tue, 15 Feb 2011 13:07:02 +0000 (15:07 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Tue, 15 Feb 2011 13:07:02 +0000 (15:07 +0200)
- Besides fixing the stupid situation where we happily create package(s)
  that can under no circumstances be installed, this makes it possible
  to create "singleton" packages which can be useful in some cases, eg
  http://lists.rpm.org/pipermail/rpm-maint/2010-April/002719.html

lib/depends.c

index 4a4daa5..4daa512 100644 (file)
@@ -412,9 +412,24 @@ retry:
        goto exit;
 
     /* Pretrans dependencies can't be satisfied by added packages. */
-    if (!(dsflags & RPMSENSE_PRETRANS) &&
-               rpmalSatisfiesDepend(tsmem->addedPackages, dep) != NULL) {
-       goto exit;
+    if (!(dsflags & RPMSENSE_PRETRANS)) {
+       rpmte match = rpmalSatisfiesDepend(tsmem->addedPackages, dep);
+
+       /*
+        * Handle definitive matches within the added package set.
+        * Self-obsoletes and -conflicts fall through here as we need to 
+        * check for possible other matches in the rpmdb.
+        */
+       if (match) {
+           rpmTagVal dtag = rpmdsTagN(dep);
+           /* Requires match, look no further */
+           if (dtag == RPMTAG_REQUIRENAME)
+               goto exit;
+
+           /* Conflicts/obsoletes match on another package, look no further */
+           if (rpmteDS(match, dtag) != dep)
+               goto exit;
+       }
     }
 
     /* See if the rpmdb provides it */