fix: decide standalone builds from standalone_set

This commit is contained in:
Abdessamad Derraz committed 2026-11-21 06:01:19 +01:00
1 parent b4075bf1ad
commit e3294d08ea
5 files changed
+21 -8

No files matched your search

+4 -3
View File
@@ -37,7 +37,8 @@ from probes.packlayout import (
pack_layout,
)
from resolve.cores import resolve_platform_cores
from resolve.layout import runs_standalone
from resolve.layout import DUAL_MODE_PREFIX, runs_standalone
from resolve.standalone import standalone_set
from resolve.validation import filter_files_by_mode
@@ -79,10 +80,10 @@ def libretro_build_runs(name: str, profile: dict, config: dict) -> bool:
the platform does not run the emulator standalone only."""
if "libretro" not in str(profile.get("type", "")) or profile.get("type") == "alias":
return False
standalone = {str(c) for c in config.get("standalone_cores") or ()}
standalone = standalone_set(config)
if not runs_standalone(name, profile, standalone):
return True
dual = {str(c) for c in config.get("dual_mode_cores") or ()}
dual = {c.removeprefix(DUAL_MODE_PREFIX) for c in standalone if c.startswith(DUAL_MODE_PREFIX)}
return bool(dual & ({name} | {str(c) for c in profile.get("cores") or ()}))
+5 -1
View File
@@ -770,10 +770,14 @@ def _attach_runners(systems: dict[str, NativeSystem], scraped: dict | None) -> N
return
from model.profiles import load_emulator_profiles
from resolve.layout import runs_standalone
from resolve.standalone import standalone_set
declared = scraped.get("cores")
libretro = {str(c) for c in declared} if isinstance(declared, list) else set()
standalone = {str(c) for c in scraped.get("standalone_cores") or []}
# The build decision reads the tagged set (own builds, twins), as the
# pack does; the runner's name is looked up among the plain names.
layout_set = standalone_set(scraped)
profiles = load_emulator_profiles(str(REPO_ROOT / "emulators"))
for system in systems.values():
for fe in system.files:
@@ -785,7 +789,7 @@ def _attach_runners(systems: dict[str, NativeSystem], scraped: dict | None) -> N
sorted((key, build == "standalone") for key, _, build in
(b.partition(":") for b in brought))
if brought is not None
else [(key, runs_standalone(key, profiles.get(key, {}), standalone))
else [(key, runs_standalone(key, profiles.get(key, {}), layout_set))
for key in sorted(fe.truth.get("_cores") or ())]
)
for key, as_standalone in layers:
+2 -1
View File
@@ -16,6 +16,7 @@ from model.platforms import load_platform_config
from model.registry import list_release_pack_platforms
from model.profiles import reads_own_files
from resolve.layout import runs_standalone
from resolve.standalone import standalone_set
from sitegen import markup
from core.paths import REPO_ROOT
from sitegen.fields import search_excluded
@@ -180,7 +181,7 @@ def _standalone_cores(platform: str) -> frozenset[str]:
@functools.cache
def _standalone_cores_in(platforms_dir: str, platform: str) -> frozenset[str]:
config = load_platform_config(platform, platforms_dir)
return frozenset(str(c) for c in config.get("standalone_cores") or [])
return frozenset(standalone_set(config))
def _said_or(names: list[str]) -> str:
+6 -3
View File
@@ -23,6 +23,7 @@ from pathlib import Path
from romrecipes import ledger as romrecipes_ledger
from resolve.layout import runs_standalone
from resolve.standalone import standalone_set
from model.profiles import unique_emulator_profiles
from packs.crossref import first_hash
from core.hashing import cut_md5_owner, parse_hash_list
@@ -158,7 +159,9 @@ def _paired(files: list, details: list[dict]) -> Iterable[tuple[dict, dict]]:
yield detail, same[position]
def _brought_by_readers(detail: dict, config: dict, platform: str, profiles: dict) -> bool:
def _brought_by_readers(
detail: dict, standalone_cores: set[str], platform: str, profiles: dict,
) -> bool:
"""Whether every core that reads a platform entry installs it itself.
The readers are those verify names for the entry's category, the cores
@@ -168,7 +171,6 @@ def _brought_by_readers(detail: dict, config: dict, platform: str, profiles: dic
"""
readers = (detail.get("category_evidence") or {}).get("read_by") or []
own = [r for r in readers if r.get("runs_system")] or readers
standalone_cores = set(config.get("standalone_cores") or [])
verdicts = []
for reader in own:
profile = profiles.get(reader.get("emulator", ""))
@@ -197,6 +199,7 @@ def wanted_declarations(profiles: dict, coverages: dict, gap_report: dict) -> li
found: list[dict] = []
for key, coverage in sorted(coverages.items()):
systems = coverage.get("config", {}).get("systems") or {}
standalone_cores = standalone_set(coverage.get("config", {}))
by_system: dict[str, list[dict]] = {}
for detail in coverage.get("details", []):
by_system.setdefault(detail.get("system", ""), []).append(detail)
@@ -206,7 +209,7 @@ def wanted_declarations(profiles: dict, coverages: dict, gap_report: dict) -> li
if detail.get("settled_by") or detail.get("status") not in ("missing", "untested"):
continue
if detail.get("category") == GAME_DATA or _brought_by_readers(
detail, coverage.get("config", {}), key, profiles):
detail, standalone_cores, key, profiles):
continue
found.append({
"name": str(entry["name"]), "system": system,
+4
View File
@@ -77,6 +77,10 @@ class CoreChoice(unittest.TestCase):
self.assertFalse(packprobe.libretro_build_runs("duckstation", both, {"standalone_cores": ["duckstation"]}))
self.assertTrue(packprobe.libretro_build_runs("duckstation", both, {
"standalone_cores": ["duckstation"], "dual_mode_cores": ["duckstation-sa"]}))
# A buildbot core installable under the standalone name is its
# libretro build, run both ways (standalone_set).
self.assertTrue(packprobe.libretro_build_runs("duckstation", both, {
"standalone_cores": ["duckstation"], "installable_cores": ["duckstation"]}))
self.assertFalse(packprobe.libretro_build_runs("x", {"type": "standalone"}, {}))
self.assertFalse(packprobe.libretro_build_runs("x", {"type": "alias"}, {}))