summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2021-01-12 15:42:11 +0100
committerTamara Dahlgren <dahlgren1@llnl.gov>2021-02-17 17:07:43 -0800
commit488a08b4642db9d7519b35d915c3959e44fbb7b7 (patch)
tree243568e29971e4a48acee98b2ff5755557db97b2
parent7162e155314ce93f6a1ed28b0ea5cb06b53d1442 (diff)
downloadspack-488a08b4642db9d7519b35d915c3959e44fbb7b7.tar.gz
spack-488a08b4642db9d7519b35d915c3959e44fbb7b7.tar.bz2
spack-488a08b4642db9d7519b35d915c3959e44fbb7b7.tar.xz
spack-488a08b4642db9d7519b35d915c3959e44fbb7b7.zip
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.
-rw-r--r--lib/spack/spack/solver/concretize.lp3
-rw-r--r--lib/spack/spack/test/concretize.py8
-rw-r--r--var/spack/repos/builtin.mock/packages/test-dep-with-imposed-conditions/package.py17
3 files changed, 28 insertions, 0 deletions
diff --git a/lib/spack/spack/solver/concretize.lp b/lib/spack/spack/solver/concretize.lp
index 938f4ece89..d0174ca2e0 100644
--- a/lib/spack/spack/solver/concretize.lp
+++ b/lib/spack/spack/solver/concretize.lp
@@ -88,6 +88,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).
diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py
index 3eab265d8c..dae162a12f 100644
--- a/lib/spack/spack/test/concretize.py
+++ b/lib/spack/spack/test/concretize.py
@@ -1089,3 +1089,11 @@ class TestConcretize(object):
).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
diff --git a/var/spack/repos/builtin.mock/packages/test-dep-with-imposed-conditions/package.py b/var/spack/repos/builtin.mock/packages/test-dep-with-imposed-conditions/package.py
new file mode 100644
index 0000000000..a61107495f
--- /dev/null
+++ b/var/spack/repos/builtin.mock/packages/test-dep-with-imposed-conditions/package.py
@@ -0,0 +1,17 @@
+# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
+#
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+
+from spack import *
+
+
+class TestDepWithImposedConditions(Package):
+ """Simple package with no dependencies"""
+
+ homepage = "http://www.example.com"
+ url = "http://www.example.com/e-1.0.tar.gz"
+
+ version('1.0', '0123456789abcdef0123456789abcdef')
+
+ depends_on('c@1.0', type='test')