summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2020-10-19 15:16:36 +0200
committerTodd Gamblin <tgamblin@llnl.gov>2020-11-17 10:04:13 -0800
commit3e4fd64169be7bbdc2a78bd5e27441f0200f90e2 (patch)
tree546a170e12978300f41fb1303472d847fa76ef2e /lib
parent8b055ac8d8a1d88ed6db7610f6a425db9ed46653 (diff)
downloadspack-3e4fd64169be7bbdc2a78bd5e27441f0200f90e2.tar.gz
spack-3e4fd64169be7bbdc2a78bd5e27441f0200f90e2.tar.bz2
spack-3e4fd64169be7bbdc2a78bd5e27441f0200f90e2.tar.xz
spack-3e4fd64169be7bbdc2a78bd5e27441f0200f90e2.zip
concretizer: handle "none" value and '*' wildcard
The "none" variant value cannot be combined with other values. The '*' wildcard matches anything, including "none". It's thus relevant in queries, but disregarded in concretization.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/solver/asp.py6
-rw-r--r--lib/spack/spack/solver/concretize.lp5
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py
index 5689bf4861..ed0109856f 100644
--- a/lib/spack/spack/solver/asp.py
+++ b/lib/spack/spack/solver/asp.py
@@ -1150,8 +1150,10 @@ class SpackSolverSetup(object):
value = variant.value
if isinstance(value, tuple):
for v in value:
+ if v == '*':
+ continue
clauses.append(f.variant(spec.name, vname, v))
- else:
+ elif value != '*':
clauses.append(f.variant(spec.name, vname, variant.value))
# compiler and compiler version
@@ -1424,7 +1426,7 @@ class SpackSolverSetup(object):
possible = spack.package.possible_dependencies(
*specs,
virtuals=self.possible_virtuals,
- deptype=("build", "link", "run")
+ deptype=("build", "link", "run", "test")
)
pkgs = set(possible)
diff --git a/lib/spack/spack/solver/concretize.lp b/lib/spack/spack/solver/concretize.lp
index e495db4664..77bc45bcde 100644
--- a/lib/spack/spack/solver/concretize.lp
+++ b/lib/spack/spack/solver/concretize.lp
@@ -194,6 +194,11 @@ variant_default_value(Package, Variant, Value)
variant_default_value(Package, Variant, Value)
:- variant_default_value_from_packages_yaml(Package, Variant, Value).
+% Treat 'none' in a special way - it cannot be combined with other
+% values even if the variant is multi-valued
+:- 2 {variant_value(Package, Variant, Value): variant_possible_value(Package, Variant, Value)},
+ variant_value(Package, Variant, "none").
+
% suppress warnings about this atom being unset. It's only set if some
% spec or some package sets it, and without this, clingo will give
% warnings like 'info: atom does not occur in any rule head'.