summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2020-10-22 09:47:02 +0200
committerTodd Gamblin <tgamblin@llnl.gov>2020-11-17 10:04:13 -0800
commit116f6b30eb7820b5f39e3edf0a94b8f0e2308dc9 (patch)
treea333bf85b33adf873afe3a0561764614182415ef /lib
parentada2fa36a9aae3b2f328ac5c553c30cf25bd79df (diff)
downloadspack-116f6b30eb7820b5f39e3edf0a94b8f0e2308dc9.tar.gz
spack-116f6b30eb7820b5f39e3edf0a94b8f0e2308dc9.tar.bz2
spack-116f6b30eb7820b5f39e3edf0a94b8f0e2308dc9.tar.xz
spack-116f6b30eb7820b5f39e3edf0a94b8f0e2308dc9.zip
concretizer: handle variants defined through validators
Variant of this kind don't have a list of possible values encoded in the ASP facts. Since all we have is a validator the list of possible values just includes just the default value and possibly the value passed from packages.yaml or cli.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/solver/asp.py15
-rw-r--r--lib/spack/spack/test/cmd/install.py10
2 files changed, 23 insertions, 2 deletions
diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py
index 292d3a5a3f..9e37ab5cf8 100644
--- a/lib/spack/spack/solver/asp.py
+++ b/lib/spack/spack/solver/asp.py
@@ -1486,6 +1486,21 @@ class SpackSolverSetup(object):
else:
for clause in self.spec_clauses(dep):
self.gen.fact(clause)
+ # TODO: This might need to be moved somewhere else.
+ # TODO: It's needed to account for open-ended variants
+ # TODO: validated through a function. The rationale is
+ # TODO: that if a value is set from cli and validated
+ # TODO: then it's also a possible value.
+ if clause.name == 'variant_set':
+ variant_name = clause.args[1]
+ variant_def = dep.package.variants[variant_name]
+ variant_def.validate_or_raise(
+ dep.variants[variant_name],
+ dep.package
+ )
+ self.gen.fact(
+ fn.variant_possible_value(*clause.args)
+ )
self.gen.h1("Virtual Constraints")
self.define_virtual_constraints()
diff --git a/lib/spack/spack/test/cmd/install.py b/lib/spack/spack/test/cmd/install.py
index 93b1bc2eae..8e87f97c98 100644
--- a/lib/spack/spack/test/cmd/install.py
+++ b/lib/spack/spack/test/cmd/install.py
@@ -467,8 +467,14 @@ def test_cdash_report_concretization_error(tmpdir, mock_fetch, install_mockery,
report_file = report_dir.join('Update.xml')
assert report_file in report_dir.listdir()
content = report_file.open().read()
- assert '<UpdateReturnStatus>Conflicts in concretized spec' \
- in content
+ assert '<UpdateReturnStatus>' in content
+ # The message is different based on using the
+ # new or the old concretizer
+ expected_messages = (
+ 'Conflicts in concretized spec',
+ 'does not satisfy'
+ )
+ assert any(x in content for x in expected_messages)
@pytest.mark.disable_clean_stage_check