From: Panu Matilainen Date: Fri, 20 Apr 2012 06:31:17 +0000 (+0300) Subject: rpmdsMatchesDep() isn't correct on obsoletes X-Git-Tag: tznext/4.11.0.1.tizen20130304~533 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5f1ec21518078e599b2499cf1ff852837ec33df7;p=tools%2Flibrpm-tizen.git rpmdsMatchesDep() isn't correct on obsoletes - 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. --- diff --git a/lib/depends.c b/lib/depends.c index fddc85e..de1a2f1 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -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; }