Handle obsolete matches (more) correctly in rpmal

- Similar to commit 9fb81eac0b 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
  05487d9a3f 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.
This commit is contained in:
Panu Matilainen 2012-04-05 11:32:38 +03:00
parent b9c96a9fa9
commit 8106e7e89c
1 changed files with 8 additions and 1 deletions

View File

@ -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);