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.
This commit is contained in:
parent
ada2fa36a9
commit
116f6b30eb
@ -1486,6 +1486,21 @@ def setup(self, driver, specs):
|
|||||||
else:
|
else:
|
||||||
for clause in self.spec_clauses(dep):
|
for clause in self.spec_clauses(dep):
|
||||||
self.gen.fact(clause)
|
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.gen.h1("Virtual Constraints")
|
||||||
self.define_virtual_constraints()
|
self.define_virtual_constraints()
|
||||||
|
@ -467,8 +467,14 @@ def test_cdash_report_concretization_error(tmpdir, mock_fetch, install_mockery,
|
|||||||
report_file = report_dir.join('Update.xml')
|
report_file = report_dir.join('Update.xml')
|
||||||
assert report_file in report_dir.listdir()
|
assert report_file in report_dir.listdir()
|
||||||
content = report_file.open().read()
|
content = report_file.open().read()
|
||||||
assert '<UpdateReturnStatus>Conflicts in concretized spec' \
|
assert '<UpdateReturnStatus>' in content
|
||||||
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
|
@pytest.mark.disable_clean_stage_check
|
||||||
|
Loading…
Reference in New Issue
Block a user