From 8106e7e89c3c673f8eb7d2ed5027e2ee9750e3b5 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Thu, 5 Apr 2012 11:32:38 +0300 Subject: [PATCH] Handle obsolete matches (more) correctly in rpmal - Similar to commit 9fb81eac0bcd239e46459f72916099f1adfc5cb9 but on the to-be-installed set: obsoletes should only be matched against package names, not any provide or file names. Hasn't really mattered previously due to the way its called, but since commit 05487d9a3f763cfed5f5ca75b4fbadb62f38dfd6 I guess it started to matter. It's more correct this way anyhow, and should fix RhBug:810077. - Since rpmal only knows about provides, we need to handle obsoletes as a special case and filter out matches on provide names different than the matching package name. --- lib/rpmal.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/rpmal.c b/lib/rpmal.c index bbf0abb..8d5446d 100644 --- a/lib/rpmal.c +++ b/lib/rpmal.c @@ -324,6 +324,7 @@ static rpmte * rpmalAllSatisfiesDepend(const rpmal al, const rpmds ds) const char * name; availableIndexEntry result; int resultCnt; + int obsolete; availablePackage alp; int rc; @@ -334,7 +335,8 @@ static rpmte * rpmalAllSatisfiesDepend(const rpmal al, const rpmds ds) if (al->providesHash == NULL && al->fileHash == NULL) rpmalMakeIndex(al); - if (*name == '/') { + obsolete = (rpmdsTagN(ds) == RPMTAG_OBSOLETENAME); + if (!obsolete && *name == '/') { /* First, look for files "contained" in package ... */ ret = rpmalAllFileSatisfiesDepend(al, ds); if (ret != NULL && *ret != NULL) @@ -355,6 +357,11 @@ static rpmte * rpmalAllSatisfiesDepend(const rpmal al, const rpmds ds) if (alp->p == NULL) // deleted continue; (void) rpmdsSetIx(alp->provides, result[i].entryIx); + + /* Obsoletes are on package name, filter out other provide matches */ + if (obsolete && !rstreq(rpmdsN(alp->provides), rpmteN(alp->p))) + continue; + rc = 0; if (rpmdsIx(alp->provides) >= 0) rc = rpmdsCompare(alp->provides, ds); -- 2.7.4