summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew W Elble <aweits@rit.edu>2020-12-02 03:53:53 -0500
committerGitHub <noreply@github.com>2020-12-02 09:53:53 +0100
commit0c326e87a93263e996fb93f9e86d841b1a4bdcba (patch)
tree4d7e40e880773b95d61746b3a4495b5fb192ab2a
parent721fdddde4bda8c12bdd0cc2b24d65985a022181 (diff)
downloadspack-0c326e87a93263e996fb93f9e86d841b1a4bdcba.tar.gz
spack-0c326e87a93263e996fb93f9e86d841b1a4bdcba.tar.bz2
spack-0c326e87a93263e996fb93f9e86d841b1a4bdcba.tar.xz
spack-0c326e87a93263e996fb93f9e86d841b1a4bdcba.zip
concretizer: don't optimize emitting version_satisfies() (#20128)
When all versions were allowed a version_satisfies rule was not emitted, and this caused conditional directives to fail.
-rw-r--r--lib/spack/spack/solver/asp.py4
-rw-r--r--lib/spack/spack/test/concretize.py5
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py
index 18c261a317..fa70eed47c 100644
--- a/lib/spack/spack/solver/asp.py
+++ b/lib/spack/spack/solver/asp.py
@@ -1394,10 +1394,6 @@ class SpackSolverSetup(object):
if exact_match:
allowed_versions = exact_match
- # don't bother restricting anything if all versions are allowed
- if len(allowed_versions) == len(self.possible_versions[pkg_name]):
- continue
-
predicates = [fn.version(pkg_name, v) for v in allowed_versions]
# version_satisfies(pkg, constraint) is true if and only if a
diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py
index fa08eb8097..e5cd8b162a 100644
--- a/lib/spack/spack/test/concretize.py
+++ b/lib/spack/spack/test/concretize.py
@@ -501,6 +501,11 @@ class TestConcretize(object):
with pytest.raises(spack.error.SpackError):
s.concretize()
+ def test_conflict_in_all_directives_true(self):
+ s = Spec('when-directives-true')
+ with pytest.raises(spack.error.SpackError):
+ s.concretize()
+
@pytest.mark.parametrize('spec_str', [
'conflict@10.0%clang+foo'
])