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.
This commit is contained in:
Massimiliano Culpo 2020-10-19 15:16:36 +02:00 committed by Todd Gamblin
parent 8b055ac8d8
commit 3e4fd64169
2 changed files with 9 additions and 2 deletions

View file

@ -1150,8 +1150,10 @@ class Body(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 @@ def setup(self, driver, specs):
possible = spack.package.possible_dependencies(
*specs,
virtuals=self.possible_virtuals,
deptype=("build", "link", "run")
deptype=("build", "link", "run", "test")
)
pkgs = set(possible)

View file

@ -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'.