From 3e4fd64169be7bbdc2a78bd5e27441f0200f90e2 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Mon, 19 Oct 2020 15:16:36 +0200 Subject: 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. --- lib/spack/spack/solver/asp.py | 6 ++++-- lib/spack/spack/solver/concretize.lp | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'lib') 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'. -- cgit v1.2.3-70-g09d2