summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2020-12-04 16:27:03 +0100
committerGitHub <noreply@github.com>2020-12-04 16:27:03 +0100
commit8b74b50cff03e584844de82225e7ae9e46addbcc (patch)
treedff644d92e3f2629106c5acdaf5fb826c5a9ce24 /lib
parent98517af024d9fb2d51c1ebbd02b1030a3f9a5ea9 (diff)
downloadspack-8b74b50cff03e584844de82225e7ae9e46addbcc.tar.gz
spack-8b74b50cff03e584844de82225e7ae9e46addbcc.tar.bz2
spack-8b74b50cff03e584844de82225e7ae9e46addbcc.tar.xz
spack-8b74b50cff03e584844de82225e7ae9e46addbcc.zip
concretizer: restrict maximizing variant values to MV variants (#20194)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/solver/concretize.lp8
-rw-r--r--lib/spack/spack/test/concretize.py4
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/spack/spack/solver/concretize.lp b/lib/spack/spack/solver/concretize.lp
index 2de7030ddf..acfed6f599 100644
--- a/lib/spack/spack/solver/concretize.lp
+++ b/lib/spack/spack/solver/concretize.lp
@@ -508,7 +508,9 @@ root(Dependency, 1) :- not root(Dependency), node(Dependency).
% need to maximize their number below to ensure they're all set
#maximize {
1@13,Package,Variant,Value
- : variant_not_default(Package, Variant, Value, Weight), root(Package)
+ : variant_not_default(Package, Variant, Value, Weight),
+ not variant_single_value(Package, Variant),
+ root(Package)
}.
#minimize{
Weight@13,Provider
@@ -531,7 +533,9 @@ root(Dependency, 1) :- not root(Dependency), node(Dependency).
% need to maximize their number below to ensure they're all set
#maximize {
1@8,Package,Variant,Value
- : variant_not_default(Package, Variant, Value, Weight), not root(Package)
+ : variant_not_default(Package, Variant, Value, Weight),
+ not variant_single_value(Package, Variant),
+ not root(Package)
}.
% Try to maximize the number of compiler matches in the DAG,
diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py
index fed0432f91..2e96eea4af 100644
--- a/lib/spack/spack/test/concretize.py
+++ b/lib/spack/spack/test/concretize.py
@@ -975,3 +975,7 @@ class TestConcretize(object):
spec.concretize()
assert ((uuidpatch, localpatch) ==
spec['libelf'].variants['patches'].value)
+
+ def test_dont_select_version_that_brings_more_variants_in(self):
+ s = Spec('dep-with-variants-if-develop-root').concretized()
+ assert s['dep-with-variants-if-develop'].satisfies('@1.0')