Fix a bug preventing to set platform= on externals (#43758)
closes #43406
This commit is contained in:
parent
7c1a309453
commit
a450dd31fa
3 changed files with 20 additions and 7 deletions
|
@ -1610,6 +1610,7 @@ def external_imposition(input_spec, requirements):
|
|||
self.gen.newline()
|
||||
|
||||
self.trigger_rules()
|
||||
self.effect_rules()
|
||||
|
||||
def preferred_variants(self, pkg_name):
|
||||
"""Facts on concretization preferences, as read from packages.yaml"""
|
||||
|
|
|
@ -993,14 +993,13 @@ pkg_fact(Package, variant_single_value("dev_path"))
|
|||
% Platform semantics
|
||||
%-----------------------------------------------------------------------------
|
||||
|
||||
% if no platform is set, fall back to the default
|
||||
error(100, "platform '{0}' is not allowed on the current host", Platform)
|
||||
:- attr("node_platform", _, Platform), not allowed_platform(Platform).
|
||||
% NOTE: Currently we have a single allowed platform per DAG, therefore there is no
|
||||
% need to have additional optimization criteria. If we ever add cross-platform dags,
|
||||
% this needs to be changed.
|
||||
:- 2 { allowed_platform(Platform) }, internal_error("More than one allowed platform detected").
|
||||
|
||||
attr("node_platform", PackageNode, Platform)
|
||||
:- attr("node", PackageNode),
|
||||
not attr("node_platform_set", PackageNode),
|
||||
node_platform_default(Platform).
|
||||
1 { attr("node_platform", PackageNode, Platform) : allowed_platform(Platform) } 1
|
||||
:- attr("node", PackageNode).
|
||||
|
||||
% setting platform on a node is a hard constraint
|
||||
attr("node_platform", PackageNode, Platform)
|
||||
|
|
|
@ -2398,6 +2398,19 @@ def test_reuse_specs_from_non_available_compilers(self, mutable_config, mutable_
|
|||
for s in root.traverse(root=False):
|
||||
assert s.satisfies("%gcc@10.2.1")
|
||||
|
||||
@pytest.mark.regression("43406")
|
||||
def test_externals_with_platform_explicitly_set(self, tmp_path):
|
||||
"""Tests that users can specify platform=xxx in an external spec"""
|
||||
external_conf = {
|
||||
"mpich": {
|
||||
"buildable": False,
|
||||
"externals": [{"spec": "mpich@=2.0.0 platform=test", "prefix": str(tmp_path)}],
|
||||
}
|
||||
}
|
||||
spack.config.set("packages", external_conf)
|
||||
s = Spec("mpich").concretized()
|
||||
assert s.external
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def duplicates_test_repository():
|
||||
|
|
Loading…
Reference in a new issue