Fix for duplicate glibc in concretization

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

View File

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