Bugfix: propagation of multivalued variants (#39833)
Don't encourage use of default value if propagating a multivalued variant.
This commit is contained in:
parent
668a5b45e5
commit
8fc1ba2d7a
4 changed files with 18 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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():
|
||||
|
|
|
@ -15,4 +15,8 @@ class B(Package):
|
|||
version("1.0", md5="0123456789abcdef0123456789abcdef")
|
||||
version("0.9", md5="abcd456789abcdef0123456789abcdef")
|
||||
|
||||
variant(
|
||||
"foo", description="", values=any_combination_of("bar", "baz", "fee").with_default("bar")
|
||||
)
|
||||
|
||||
depends_on("test-dependency", type="test")
|
||||
|
|
|
@ -19,7 +19,7 @@ class MultivalueVariant(Package):
|
|||
variant(
|
||||
"foo",
|
||||
description="Multi-valued variant",
|
||||
values=any_combination_of("bar", "baz", "barbaz"),
|
||||
values=any_combination_of("bar", "baz", "barbaz", "fee"),
|
||||
)
|
||||
|
||||
variant(
|
||||
|
|
Loading…
Reference in a new issue