bugfix: associate nodes directly with specs for compiler flag reordering (#48496)
This commit is contained in:
parent
8196c68ff3
commit
2447d16e55
@ -3540,15 +3540,13 @@ def reorder_flags(self):
|
||||
)
|
||||
cmd_specs = dict((s.name, s) for spec in self._command_line_specs for s in spec.traverse())
|
||||
|
||||
for spec in self._specs.values():
|
||||
for node, spec in self._specs.items():
|
||||
# if bootstrapping, compiler is not in config and has no flags
|
||||
flagmap_from_compiler = {}
|
||||
if spec.compiler in compilers:
|
||||
flagmap_from_compiler = compilers[spec.compiler].flags
|
||||
|
||||
for flag_type in spec.compiler_flags.valid_compiler_flags():
|
||||
node = SpecBuilder.make_node(pkg=spec.name)
|
||||
|
||||
ordered_flags = []
|
||||
|
||||
# 1. Put compiler flags first
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.environment as ev
|
||||
import spack.paths
|
||||
@ -96,6 +97,18 @@ def test_mix_spec_and_compiler_cfg(concretize_scope, test_repo):
|
||||
assert s1.satisfies('cflags="-Wall -O2"')
|
||||
|
||||
|
||||
def test_pkg_flags_from_compiler_and_none(concretize_scope, mock_packages):
|
||||
conf_str = _compiler_cfg_one_entry_with_cflags("-Wall")
|
||||
update_concretize_scope(conf_str, "compilers")
|
||||
|
||||
s1 = Spec("cmake%gcc@12.100.100")
|
||||
s2 = Spec("cmake-client^cmake%clang")
|
||||
concrete = dict(spack.concretize.concretize_together([(s1, None), (s2, None)]))
|
||||
|
||||
assert concrete[s1].compiler_flags["cflags"] == ["-Wall"]
|
||||
assert concrete[s2].compiler_flags["cflags"] == []
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"cmd_flags,req_flags,cmp_flags,dflags,expected_order",
|
||||
[
|
||||
|
@ -20,6 +20,8 @@ class Cmake(Package):
|
||||
homepage = "https://www.cmake.org"
|
||||
url = "https://cmake.org/files/v3.4/cmake-3.4.3.tar.gz"
|
||||
|
||||
tags = ["build-tools"]
|
||||
|
||||
version(
|
||||
"3.23.1",
|
||||
md5="4cb3ff35b2472aae70f542116d616e63",
|
||||
|
Loading…
Reference in New Issue
Block a user