Fix cflags requirements (#40639)
This commit is contained in:
parent
f9c0a15ba0
commit
2f2d9ae30d
2 changed files with 21 additions and 12 deletions
|
@ -696,15 +696,18 @@ requirement_group_satisfied(node(ID, Package), X) :-
|
||||||
% flags if their only source is from a requirement. This is overly-specific
|
% flags if their only source is from a requirement. This is overly-specific
|
||||||
% and should use a more-generic approach like in https://github.com/spack/spack/pull/37180
|
% and should use a more-generic approach like in https://github.com/spack/spack/pull/37180
|
||||||
|
|
||||||
{ attr("node_flag", node(ID, A1), A2, A3) } :-
|
{ attr("node_flag", node(ID, Package), FlagType, FlagValue) } :-
|
||||||
requirement_group_member(Y, Package, X),
|
requirement_group_member(ConditionID, Package, RequirementID),
|
||||||
activate_requirement(node(ID, Package), X),
|
activate_requirement(node(ID, Package), RequirementID),
|
||||||
imposed_constraint(Y,"node_flag_set", A1, A2, A3).
|
pkg_fact(Package, condition_effect(ConditionID, EffectID)),
|
||||||
|
imposed_constraint(EffectID, "node_flag_set", Package, FlagType, FlagValue).
|
||||||
|
|
||||||
{ attr("node_flag_source", node(ID, A1), A2, node(ID, A3)) } :-
|
{ attr("node_flag_source", node(NodeID1, Package1), FlagType, node(NodeID2, Package2)) } :-
|
||||||
requirement_group_member(Y, Package, X),
|
requirement_group_member(ConditionID, Package1, RequirementID),
|
||||||
activate_requirement(node(ID, Package), X),
|
activate_requirement(node(NodeID1, Package1), RequirementID),
|
||||||
imposed_constraint(Y,"node_flag_source", A1, A2, A3).
|
pkg_fact(Package1, condition_effect(ConditionID, EffectID)),
|
||||||
|
imposed_constraint(EffectID, "node_flag_source", Package1, FlagType, Package2),
|
||||||
|
imposed_packages(NodeID2, Package2).
|
||||||
|
|
||||||
requirement_weight(node(ID, Package), Group, W) :-
|
requirement_weight(node(ID, Package), Group, W) :-
|
||||||
W = #min {
|
W = #min {
|
||||||
|
|
|
@ -469,16 +469,22 @@ def test_one_package_multiple_oneof_groups(concretize_scope, test_repo):
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.regression("34241")
|
@pytest.mark.regression("34241")
|
||||||
def test_require_cflags(concretize_scope, test_repo):
|
def test_require_cflags(concretize_scope, mock_packages):
|
||||||
"""Ensures that flags can be required from configuration."""
|
"""Ensures that flags can be required from configuration."""
|
||||||
conf_str = """\
|
conf_str = """\
|
||||||
packages:
|
packages:
|
||||||
y:
|
mpich2:
|
||||||
require: cflags="-g"
|
require: cflags="-g"
|
||||||
|
mpi:
|
||||||
|
require: mpich cflags="-O1"
|
||||||
"""
|
"""
|
||||||
update_packages_config(conf_str)
|
update_packages_config(conf_str)
|
||||||
spec = Spec("y").concretized()
|
|
||||||
assert spec.satisfies("cflags=-g")
|
spec_mpich2 = Spec("mpich2").concretized()
|
||||||
|
assert spec_mpich2.satisfies("cflags=-g")
|
||||||
|
|
||||||
|
spec_mpi = Spec("mpi").concretized()
|
||||||
|
assert spec_mpi.satisfies("mpich cflags=-O1")
|
||||||
|
|
||||||
|
|
||||||
def test_requirements_for_package_that_is_not_needed(concretize_scope, test_repo):
|
def test_requirements_for_package_that_is_not_needed(concretize_scope, test_repo):
|
||||||
|
|
Loading…
Reference in a new issue