From 7162e155314ce93f6a1ed28b0ea5cb06b53d1442 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Tue, 12 Jan 2021 12:35:48 +0100 Subject: concretizer: dependency conditions cannot hold if package is external fixes #20736 Before this one line fix we were erroneously deducing that dependency conditions hold even if a package was external. This may result in answer sets that contain imposed conditions on a node without the node being present in the DAG, hence #20736. --- lib/spack/spack/solver/concretize.lp | 3 ++- lib/spack/spack/test/concretize.py | 6 +++++- lib/spack/spack/test/data/config/packages.yaml | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/spack/spack/solver/concretize.lp b/lib/spack/spack/solver/concretize.lp index 2b3d87136d..938f4ece89 100644 --- a/lib/spack/spack/solver/concretize.lp +++ b/lib/spack/spack/solver/concretize.lp @@ -88,7 +88,8 @@ 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); - node(Parent). + node(Parent); + not external(Parent). #defined dependency_condition/3. #defined required_dependency_condition/3. diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py index 9ee205feff..3eab265d8c 100644 --- a/lib/spack/spack/test/concretize.py +++ b/lib/spack/spack/test/concretize.py @@ -1043,7 +1043,7 @@ class TestConcretize(object): s = Spec('dep-with-variants-if-develop-root').concretized() assert s['dep-with-variants-if-develop'].satisfies('@1.0') - @pytest.mark.regression('20244') + @pytest.mark.regression('20244,20736') @pytest.mark.parametrize('spec_str,is_external,expected', [ # These are all externals, and 0_8 is a version not in package.py ('externaltool@1.0', True, '@1.0'), @@ -1055,6 +1055,10 @@ class TestConcretize(object): ('external-buildable-with-variant +baz', True, '@1.1.special +baz'), ('external-buildable-with-variant ~baz', False, '@1.0 ~baz'), ('external-buildable-with-variant@1.0: ~baz', False, '@1.0 ~baz'), + # This uses an external version that meets the condition for + # having an additional dependency, but the dependency shouldn't + # appear in the answer set + ('external-buildable-with-variant@0.9 +baz', True, '@0.9'), ]) def test_external_package_versions(self, spec_str, is_external, expected): s = Spec(spec_str).concretized() diff --git a/lib/spack/spack/test/data/config/packages.yaml b/lib/spack/spack/test/data/config/packages.yaml index 6e8752f635..83f8cf1bb3 100644 --- a/lib/spack/spack/test/data/config/packages.yaml +++ b/lib/spack/spack/test/data/config/packages.yaml @@ -34,3 +34,5 @@ packages: externals: - spec: external-buildable-with-variant@1.1.special +baz prefix: /usr + - spec: external-buildable-with-variant@0.9 +baz + prefix: /usr \ No newline at end of file -- cgit v1.2.3-60-g2f50