concretizer: require at least a dependency type to say the dependency holds

fixes #20784

Similarly to the previous bug, here we were deducing
conditions to be imposed on nodes that were not part
of the DAG.
This commit is contained in:
Massimiliano Culpo
2021-01-12 15:42:11 +01:00
committed by Todd Gamblin
parent ed8fe68cf2
commit 0bd76ac9e6
3 changed files with 28 additions and 0 deletions

View File

@@ -93,6 +93,9 @@ dependency_conditions_hold(ID, Parent, Dependency) :-
attr(Name, Arg1, Arg2) : required_dependency_condition(ID, Name, Arg1, Arg2);
attr(Name, Arg1, Arg2, Arg3) : required_dependency_condition(ID, Name, Arg1, Arg2, Arg3);
dependency_condition(ID, Parent, Dependency);
% There must be at least a dependency type declared,
% otherwise the dependency doesn't hold
dependency_type(ID, _);
node(Parent);
not external(Parent).

View File

@@ -1090,3 +1090,11 @@ def test_reuse_installed_packages(
).concretized()
assert root.dag_hash() == new_root.dag_hash()
@pytest.mark.regression('20784')
def test_concretization_of_test_dependencies(self):
# With clingo we emit dependency_conditions regardless of the type
# of the dependency. We need to ensure that there's at least one
# dependency type declared to infer that the dependency holds.
s = Spec('test-dep-with-imposed-conditions').concretized()
assert 'c' not in s