Skip to content

Commit

Permalink
Don't look into source package provides in depsolving
Browse files Browse the repository at this point in the history
Fixes regressions from commit 75ec16e:
the newly added provides of to-be-built packages were being used for
dependency resolution, such as spec satifying its own buildrequires,
and matched against conflicts in installed packages.

Source packages cannot obsolete anything or provide capabilities or files
to transactions, don't add them to rpmal at all. Explicitly skip checks
against source provides, similarly to what we already did with obsoletes.

Fixes: rpm-software-management#1189
  • Loading branch information
pmatilai committed Apr 22, 2020
1 parent 5d8c6e5 commit a779ba2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/depends.c
Original file line number Diff line number Diff line change
Expand Up @@ -1040,17 +1040,17 @@ int rpmtsCheck(rpmts ts)
checkDS(ts, dcache, p, rpmteNEVRA(p), rpmteDS(p, RPMTAG_OBSOLETENAME),
tscolor);

/* Skip obsoletion and provides checks for source packages (ie build) */
if (rpmteIsSource(p))
continue;

/* Check provides against conflicts in installed packages. */
while (rpmdsNext(provides) >= 0) {
checkInstDeps(ts, dcache, p, RPMTAG_CONFLICTNAME, NULL, provides, 0);
if (reqnothash && depexistsHashHasEntry(reqnothash, rpmdsNId(provides)))
checkInstDeps(ts, dcache, p, RPMTAG_REQUIRENAME, NULL, provides, 1);
}

/* Skip obsoletion checks for source packages (ie build) */
if (rpmteIsSource(p))
continue;

/* Check package name (not provides!) against installed obsoletes */
checkInstDeps(ts, dcache, p, RPMTAG_OBSOLETENAME, NULL, rpmteDS(p, RPMTAG_NAME), 0);

Expand Down
4 changes: 4 additions & 0 deletions lib/rpmal.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ void rpmalAdd(rpmal al, rpmte p)
rpmalNum pkgNum;
availablePackage alp;

/* Source packages don't provide anything to depsolving */
if (rpmteIsSource(p))
return;

if (al->size == al->alloced) {
al->alloced += al->delta;
al->list = xrealloc(al->list, sizeof(*al->list) * al->alloced);
Expand Down

0 comments on commit a779ba2

Please sign in to comment.