diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2021-01-12 12:35:48 +0100 |
---|---|---|
committer | Tamara Dahlgren <dahlgren1@llnl.gov> | 2021-02-17 17:07:42 -0800 |
commit | 7162e155314ce93f6a1ed28b0ea5cb06b53d1442 (patch) | |
tree | 422ae24b65c1f92b0d6159de769dd6cb7749dda2 | |
parent | ffa8479004a844b55ea4c1b04029aba28a5aff7d (diff) | |
download | spack-7162e155314ce93f6a1ed28b0ea5cb06b53d1442.tar.gz spack-7162e155314ce93f6a1ed28b0ea5cb06b53d1442.tar.bz2 spack-7162e155314ce93f6a1ed28b0ea5cb06b53d1442.tar.xz spack-7162e155314ce93f6a1ed28b0ea5cb06b53d1442.zip |
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.
4 files changed, 12 insertions, 2 deletions
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 diff --git a/var/spack/repos/builtin.mock/packages/external-buildable-with-variant/package.py b/var/spack/repos/builtin.mock/packages/external-buildable-with-variant/package.py index 58de53054a..06245d6f69 100644 --- a/var/spack/repos/builtin.mock/packages/external-buildable-with-variant/package.py +++ b/var/spack/repos/builtin.mock/packages/external-buildable-with-variant/package.py @@ -11,5 +11,8 @@ class ExternalBuildableWithVariant(Package): url = "http://somewhere.com/module-1.0.tar.gz" version('1.0', '1234567890abcdef1234567890abcdef') + version('0.9', '1234567890abcdef1234567890abcdef') variant('baz', default=False, description='nope') + + depends_on('c@1.0', when='@0.9') |