feat: keep platform-built cores out of all_libretro

Recalbox compiles libretro/mame at 0.258 and 0.278 itself; typed
libretro, both profiles were resolved for every all_libretro platform
although the buildbot RetroArch installs from has neither. A profile
now names the platforms that build it (built_by), and is reached only
when a platform lists it by name.
This commit is contained in:
Abdessamad Derraz committed 2026-10-17 04:44:25 +02:00
1 parent d9ef6ad0ad
commit e09a37d21e
7 files changed
+53 -10

No files matched your search

+10 -7
View File
@@ -1694,12 +1694,18 @@ def resolve_platform_cores(
"""
cores_config = config.get("cores")
if cores_config == "all_libretro":
result = {
def every_libretro() -> set[str]:
# A build only some platforms compile (built_by) is reached by name:
# the buildbot RetroArch installs from does not publish it.
return {
name
for name, p in profiles.items()
if "libretro" in p.get("type", "") and p.get("type") != "alias"
and not p.get("built_by")
}
if cores_config == "all_libretro":
result = every_libretro()
elif isinstance(cores_config, list):
core_set = {str(c) for c in cores_config}
index = upstream_profile_index(profiles)
@@ -1712,11 +1718,7 @@ def resolve_platform_cores(
# profiles with explicitly listed standalone cores (e.g. RetroDECK
# ships RetroArch + standalone emulators)
if "all_libretro" in core_set or "retroarch" in core_set:
result |= {
name
for name, p in profiles.items()
if "libretro" in p.get("type", "") and p.get("type") != "alias"
}
result |= every_libretro()
else:
# Fallback: system ID intersection with normalization
norm_plat_systems = {_norm_system_id(s) for s in config.get("systems", {})}
@@ -1725,6 +1727,7 @@ def resolve_platform_cores(
for name, p in profiles.items()
if {_norm_system_id(s) for s in p.get("systems", [])} & norm_plat_systems
and p.get("type") != "alias"
and not p.get("built_by")
}
if target_cores is not None:
+10 -2
View File
@@ -336,6 +336,7 @@ def release_profile(
source_commit: str,
cores: list[str],
reference: dict[str, Any],
built_by: list[str],
) -> dict[str, Any]:
"""A profile for one MAME release a platform builds, from its own source.
@@ -376,6 +377,7 @@ def release_profile(
"core_version": version,
"display_name": f"Arcade (MAME {version})",
"cores": cores,
"built_by": built_by,
"systems": list(reference.get("systems") or []),
"notes": (
f"libretro/mame built at the {version} release. BIOS root sets "
@@ -398,7 +400,8 @@ def _write_release(args: argparse.Namespace) -> None:
raise RuntimeError(f"no BIOS root set read at {args.release}")
reference = yaml_load((_EMULATORS_DIR / "mame.yml").read_text(encoding="utf-8"))
profile = release_profile(
args.release, bios_sets, commit, args.source_commit, args.core, reference
args.release, bios_sets, commit, args.source_commit, args.core, reference,
args.built_by,
)
text = yaml.safe_dump(profile, sort_keys=False, allow_unicode=True, width=100)
write_text_atomic(str(args.profile), text)
@@ -429,12 +432,16 @@ def build_parser() -> argparse.ArgumentParser:
"release profile",
"write the profile of one MAME release a platform builds "
"(e.g. --release mame0278 --profile emulators/mame0278.yml "
"--source-commit <libretro/mame sha> --core mame0278)",
"--source-commit <libretro/mame sha> --core mame0278 --built-by recalbox)",
)
release.add_argument("--release", help="mamedev/mame tag, such as mame0278")
release.add_argument("--profile", type=Path, help="profile file to write")
release.add_argument("--source-commit", help="libretro/mame commit the platform builds")
release.add_argument("--core", action="append", default=[], help="core name, repeatable")
release.add_argument(
"--built-by", action="append", default=[],
help="platform that compiles this build, repeatable",
)
return parser
@@ -450,6 +457,7 @@ def main() -> None:
flag for flag, value in (
("--release", args.release), ("--profile", args.profile),
("--source-commit", args.source_commit), ("--core", args.core),
("--built-by", args.built_by),
) if not value
]
if missing: