summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2021-01-12 12:35:48 +0100
committerTodd Gamblin <tgamblin@llnl.gov>2021-01-12 22:23:39 -0800
commited8fe68cf2162a8a871e639035093722bcd2cb84 (patch)
treee5785f726f41f7538cb47ec647e4e0381906b217 /lib
parenta2eb587a95432543e2b19d67200ac166e794be69 (diff)
downloadspack-ed8fe68cf2162a8a871e639035093722bcd2cb84.tar.gz
spack-ed8fe68cf2162a8a871e639035093722bcd2cb84.tar.bz2
spack-ed8fe68cf2162a8a871e639035093722bcd2cb84.tar.xz
spack-ed8fe68cf2162a8a871e639035093722bcd2cb84.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.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/solver/concretize.lp3
-rw-r--r--lib/spack/spack/test/concretize.py6
-rw-r--r--lib/spack/spack/test/data/config/packages.yaml2
3 files changed, 9 insertions, 2 deletions
diff --git a/lib/spack/spack/solver/concretize.lp b/lib/spack/spack/solver/concretize.lp
index c673c65d19..22387cfd11 100644
--- a/lib/spack/spack/solver/concretize.lp
+++ b/lib/spack/spack/solver/concretize.lp
@@ -93,7 +93,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 91fb4e2f53..7dde479d87 100644
--- a/lib/spack/spack/test/concretize.py
+++ b/lib/spack/spack/test/concretize.py
@@ -1044,7 +1044,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'),
@@ -1056,6 +1056,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