mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-10 21:43:23 -05:00
fix: publish target lists as the builder resolves them
This commit is contained in:
1 parent
5691e809c7
commit
97f741bf0f
5 files changed
+103
-14
No files matched your search
+16
-11
@@ -275,19 +275,24 @@ def load_target_config(
|
||||
raise ValueError(msg)
|
||||
|
||||
cores = set(str(c) for c in targets[canonical].get("cores", []))
|
||||
return apply_target_overrides(cores, overrides, canonical)
|
||||
|
||||
default_ovr = overrides.get("_default", {})
|
||||
ovr = overrides.get(canonical, {})
|
||||
for c in default_ovr.get("add_cores", []):
|
||||
cores.add(str(c))
|
||||
for c in default_ovr.get("remove_cores", []):
|
||||
cores.discard(str(c))
|
||||
for c in ovr.get("add_cores", []):
|
||||
cores.add(str(c))
|
||||
for c in ovr.get("remove_cores", []):
|
||||
cores.discard(str(c))
|
||||
|
||||
return cores
|
||||
def apply_target_overrides(
|
||||
cores: set[str], overrides: dict, target: str
|
||||
) -> set[str]:
|
||||
"""Cores of one target once the platform's overrides are applied.
|
||||
|
||||
``_default`` applies to every target of the platform, then the target's
|
||||
own entry: a name the scraper reads as a core on every board (a machine
|
||||
variant, a launcher) is written once instead of once per board.
|
||||
"""
|
||||
result = set(cores)
|
||||
for scope in ("_default", target):
|
||||
entry = overrides.get(scope) or {}
|
||||
result |= {str(c) for c in entry.get("add_cores") or []}
|
||||
result -= {str(c) for c in entry.get("remove_cores") or []}
|
||||
return result
|
||||
|
||||
|
||||
def list_available_targets(
|
||||
|
||||
@@ -29,6 +29,7 @@ from pathlib import Path
|
||||
|
||||
sys.path.insert(0, os.path.dirname(__file__))
|
||||
from common import (
|
||||
apply_target_overrides,
|
||||
artifact_lock,
|
||||
ArtifactLockBusy,
|
||||
build_target_cores_cache,
|
||||
@@ -1896,12 +1897,14 @@ def generate_target_manifests(targets_dir: str, output_dir: str) -> None:
|
||||
# file instead: the user asked for a filter and got the full pack.
|
||||
overrides_path = targets_path / "_overrides.yml"
|
||||
alias_map: dict[str, list[str]] = {}
|
||||
platform_overrides: dict = {}
|
||||
if overrides_path.is_file():
|
||||
with open(overrides_path) as f:
|
||||
all_overrides = yaml_load(f) or {}
|
||||
for tname, ovr in (
|
||||
platform_overrides = (
|
||||
all_overrides.get(yml_file.stem, {}).get("targets", {}) or {}
|
||||
).items():
|
||||
)
|
||||
for tname, ovr in platform_overrides.items():
|
||||
names = [a for a in (ovr or {}).get("aliases", []) if isinstance(a, str)]
|
||||
if names:
|
||||
alias_map[tname] = names
|
||||
@@ -1925,7 +1928,12 @@ def generate_target_manifests(targets_dir: str, output_dir: str) -> None:
|
||||
f"{yml_file}: target {target_name!r} cores must be unique "
|
||||
"non-empty strings"
|
||||
)
|
||||
result[target_name] = cores
|
||||
# The same add/remove lists the pack builder applies: a list
|
||||
# published without them makes the installer skip files of a
|
||||
# core the pack for that target ships.
|
||||
result[target_name] = sorted(
|
||||
apply_target_overrides(set(cores), platform_overrides, target_name)
|
||||
)
|
||||
|
||||
for target_name, names in alias_map.items():
|
||||
if target_name not in result:
|
||||
|
||||
Reference in new issue
Block a user