Bugfix: propagation of multivalued variants (#39833)

Don't encourage use of default value if propagating a multivalued variant.
This commit is contained in:
Richarda Butler
2023-11-03 12:09:39 -07:00
committed by GitHub
parent 668a5b45e5
commit 8fc1ba2d7a
4 changed files with 18 additions and 1 deletions

View File

@@ -881,6 +881,7 @@ variant_default_not_used(node(ID, Package), Variant, Value)
:- variant_default_value(Package, Variant, Value),
node_has_variant(node(ID, Package), Variant),
not attr("variant_value", node(ID, Package), Variant, Value),
not attr("variant_propagate", node(ID, Package), Variant, _, _),
attr("node", node(ID, Package)).
% The variant is set in an external spec

View File

@@ -472,6 +472,18 @@ def test_concretize_propagated_variant_is_not_passed_to_dependent(self):
assert spec.satisfies("^openblas+shared")
@pytest.mark.only_clingo("Original concretizer is allowed to forego variant propagation")
def test_concretize_propagate_multivalue_variant(self):
"""Test that multivalue variants are propagating the specified value(s)
to their dependecies. The dependencies should not have the default value"""
spec = Spec("multivalue-variant foo==baz,fee")
spec.concretize()
assert spec.satisfies("^a foo=baz,fee")
assert spec.satisfies("^b foo=baz,fee")
assert not spec.satisfies("^a foo=bar")
assert not spec.satisfies("^b foo=bar")
def test_no_matching_compiler_specs(self, mock_low_high_config):
# only relevant when not building compilers as needed
with spack.concretize.enable_compiler_existence_check():