fix: give shared files every reading system

This commit is contained in:
Abdessamad Derraz committed 2026-10-23 00:35:47 +02:00
1 parent 7a5bc1d2e3
commit d4f02de3fd
15 files changed
+6688 -195

No files matched your search

+2 -2
View File
@@ -19,7 +19,7 @@ from dataclasses import dataclass
import region as region_mod
from common import _norm_system_id, sanitize_pack_path
from packextras import _extra_system_ids, _kept, extra_region_groups, system_spellings
from packextras import _kept, _serving_system_ids, extra_region_groups, system_spellings
def _dest(entry: dict) -> str:
@@ -68,7 +68,7 @@ class SelectionIndex:
)
# A profile system the platform does not have is no system the
# pack's --system accepts: it would offer what the pack refuses.
for sys_id in _extra_system_ids(extra):
for sys_id in _serving_system_ids(extra):
owned_by.setdefault(dest, set()).update(
by_norm.get(_norm_system_id(sys_id), ())
)
+13 -2
View File
@@ -1459,6 +1459,17 @@ def _extra_system_ids(extra: dict) -> list[str]:
return [str(explicit)]
return [str(value) for value in extra.get("source_systems", []) if value]
def _serving_system_ids(extra: dict) -> list[str]:
"""Every system the extra's file serves: its own core's and those of the
other cores whose claim rides on it. One file stands per destination, so
narrowed to any of their systems the file is what that core reads.
"""
ids = list(_extra_system_ids(extra))
for claim in extra.get("other_claims", []):
ids.extend(s for s in _extra_system_ids(claim) if s not in ids)
return ids
def _kept(entries: list[dict], required_only: bool) -> list[dict]:
"""The entries a pack keeps: optional ones go under --required-only."""
if not required_only:
@@ -1476,8 +1487,8 @@ def extras_for_systems(extras: list[dict], system_ids: list[str]) -> list[dict]:
return [
fe for fe in extras
if (
set(_extra_system_ids(fe))
| {_norm_system_id(s) for s in _extra_system_ids(fe)}
set(_serving_system_ids(fe))
| {_norm_system_id(s) for s in _serving_system_ids(fe)}
) & wanted
]