Fix for duplicate glibc in concretization

This commit is contained in:
Massimiliano Culpo 2024-10-24 18:45:22 +02:00
parent da06ad3303
commit 96b54ec59c
No known key found for this signature in database
GPG Key ID: 3E52BB992233066C

View File

@ -280,12 +280,11 @@ def _create_counter(specs: List[spack.spec.Spec], tests: bool):
def all_libcs() -> Set[spack.spec.Spec]:
"""Return a set of all libc specs targeted by any configured compiler. If none, fall back to
libc determined from the current Python process if dynamically linked."""
libcs = {
CompilerPropertyDetector(c).default_libc()
for c in spack.compilers.config.all_compilers_from(spack.config.CONFIG)
}
libcs.discard(None)
libcs = set()
for c in spack.compilers.config.all_compilers_from(spack.config.CONFIG):
candidate = CompilerPropertyDetector(c).default_libc()
if candidate is not None:
libcs.add(candidate)
if libcs:
return libcs
@ -598,9 +597,11 @@ def _external_config_with_implicit_externals(configuration):
if not using_libc_compatibility():
return packages_yaml
seen = set()
for compiler in spack.compilers.config.all_compilers_from(configuration):
libc = CompilerPropertyDetector(compiler).default_libc()
if libc:
if libc and libc not in seen:
seen.add(libc)
entry = {"spec": f"{libc}", "prefix": libc.external_path}
packages_yaml.setdefault(libc.name, {}).setdefault("externals", []).append(entry)
return packages_yaml
@ -1804,8 +1805,6 @@ def emit_facts_from_requirement_rules(self, rules: List[RequirementRule]):
def external_packages(self):
"""Facts on external packages, from packages.yaml and implicit externals."""
packages_yaml = _external_config_with_implicit_externals(spack.config.CONFIG)
self.gen.h1("External packages")
spec_filters = []
concretizer_yaml = spack.config.get("concretizer")
@ -1813,7 +1812,6 @@ def external_packages(self):
if isinstance(reuse_yaml, typing.Mapping):
default_include = reuse_yaml.get("include", [])
default_exclude = reuse_yaml.get("exclude", [])
libc_externals = list(all_libcs())
for source in reuse_yaml.get("from", []):
if source["type"] != "external":
continue
@ -1821,7 +1819,7 @@ def external_packages(self):
include = source.get("include", default_include)
if include:
# Since libcs are implicit externals, we need to implicitly include them
include = include + libc_externals
include = include + self.libcs
exclude = source.get("exclude", default_exclude)
spec_filters.append(
SpecFilter(
@ -1832,6 +1830,7 @@ def external_packages(self):
)
)
packages_yaml = _external_config_with_implicit_externals(spack.config.CONFIG)
for pkg_name, data in packages_yaml.items():
if pkg_name == "all":
continue
@ -2997,7 +2996,10 @@ def possible_compilers(*, configuration) -> List["spack.spec.Spec"]:
continue
result.add(c)
return sorted(result)
result = list(result)
result.sort()
return result
class RuntimePropertyRecorder: