rpmdsMatchesDep() isn't correct on obsoletes
authorPanu Matilainen <pmatilai@redhat.com>
Fri, 20 Apr 2012 06:31:17 +0000 (09:31 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 20 Apr 2012 06:31:17 +0000 (09:31 +0300)
- Fix oversight in commit 9fb81eac0bcd239e46459f72916099f1adfc5cb9:
  rpmdsMatchesDep() works on provides, but obsoletes are matched on
  package name so we want rpmdsNVRMatchesDep(). rpmdsMatchesDep()
  "worked" as the implicit self-provide is always at the 0 index
  on packages created by modern rpmbuild, but this isn't really
  guaranteed: very old V3 rpms can have something else at the
  first index, and ditto for non-rpmbuild created packages.
- Thanks to Michael Schroeder for pointing this out.

lib/depends.c

index fddc85e..de1a2f1 100644 (file)
@@ -436,7 +436,14 @@ static int rpmdbProvides(rpmts ts, depCache dcache, rpmds dep)
 
        mi = rpmtsPrunedIterator(ts, dbtag, Name, prune);
        while ((h = rpmdbNextIterator(mi)) != NULL) {
-           if (rpmdsMatchesDep(h, rpmdbGetIteratorFileNum(mi), dep, _rpmds_nopromote)) {
+           int match;
+           if (dbtag == RPMDBI_OBSOLETENAME) {
+               match = rpmdsNVRMatchesDep(h, dep, _rpmds_nopromote);
+           } else {
+               match = rpmdsMatchesDep(h, rpmdbGetIteratorFileNum(mi), dep,
+                                       _rpmds_nopromote);
+           }
+           if (match) {
                rpmdsNotify(dep, "(db provides)", rc);
                break;
            }