concretizer: add a rule to avoid cycles in the graph of dependencies

This commit is contained in:
Massimiliano Culpo 2020-11-05 15:04:54 +01:00 committed by Todd Gamblin
parent 522be6cadf
commit 2231dfc898
2 changed files with 9 additions and 5 deletions

View file

@ -111,6 +111,11 @@ needed(Dependency) :- needed(Package), depends_on(Package, Dependency).
% real dependencies imply new nodes.
node(Dependency) :- node(Package), depends_on(Package, Dependency).
% Avoid cycles in the DAG
path(Parent, Child) :- depends_on(Parent, Child).
path(Parent, Descendant) :- path(Parent, A), depends_on(A, Descendant).
:- path(A, B), path(B, A).
% do not warn if generated program contains none of these.
#defined depends_on/3.
#defined declared_dependency/3.

View file

@ -2372,11 +2372,10 @@ def inject_patches_variant(root):
patches = []
for cond, dependency in pkg_deps[dspec.spec.name].items():
if dspec.parent.satisfies(cond, strict=True):
for pcond, patch_list in dependency.patches.items():
if dspec.spec.satisfies(pcond):
for patch in patch_list:
patches.append(patch)
for pcond, patch_list in dependency.patches.items():
if (dspec.parent.satisfies(cond, strict=True)
and dspec.spec.satisfies(pcond)):
patches.extend(patch_list)
if patches:
all_patches = spec_to_patches.setdefault(id(dspec.spec), [])
all_patches.extend(patches)