fix: prove launcher records against run profiles

This commit is contained in:
Abdessamad Derraz committed 2026-11-21 21:42:19 +01:00
1 parent e36516f3b0
commit 1839916ca2
35 files changed
+179 -160

No files matched your search

+2 -2
View File
@@ -66,7 +66,7 @@ def platform_configs(platforms_dir: str, platforms: list[str] | None = None) ->
def global_report_scope(
configs: list[dict], db: dict,
configs: list[dict], db: dict, profiles: dict[str, dict],
) -> tuple[dict[str, set[str]], ReportScope]:
"""What a gap report over *configs* compares against: the names each
system declares, and the scope cross_reference reads.
@@ -101,7 +101,7 @@ def global_report_scope(
))
return declared, {
"all_declared": merged_platform_declarations(configs, db),
"standalone_cores": merged_standalone_set(configs),
"standalone_cores": merged_standalone_set(configs, profiles),
"folded_slots": folded,
"declared_contents": merged_platform_declared_contents(configs, db),
}
+2 -2
View File
@@ -70,13 +70,13 @@ def run_gap_report(args: argparse.Namespace, parser: argparse.ArgumentParser) ->
raise SystemExit(f"ERROR: {exc}") from None
profiles = {k: v for k, v in profiles.items() if k == emulator}
tree = tree_scope(args.platform, args.target, args.platforms_dir, profiles)
tree = tree_scope(args.platform, args.target, args.platforms_dir, profiles, all_profiles)
if not tree.profiles:
refuse_empty_scope(args, emulator, tree)
return
db = load_database(args.db)
report = scope_gaps(tree, db, args.platforms_dir, args.platform)
report = scope_gaps(tree, db, args.platforms_dir, args.platform, all_profiles)
launcher_reads, unproven = launcher_rows(
tree.selected, args.platforms_dir, db, all_profiles, registry, emulator,
)
+5 -2
View File
@@ -12,11 +12,14 @@ from packs.crossrefscope import TreeScope
from resolve.launchers import LauncherLayer, declared_destinations
def scope_gaps(tree: TreeScope, db: dict, platforms_dir: str, platform: str | None) -> dict:
def scope_gaps(
tree: TreeScope, db: dict, platforms_dir: str, platform: str | None,
all_profiles: dict[str, dict],
) -> dict:
"""Each profile of the scope with the files its platforms leave undeclared."""
platform_scope = tree.platform
declared, global_scope = global_report_scope(
platform_configs(platforms_dir, tree.selected), db)
platform_configs(platforms_dir, tree.selected), db, all_profiles)
global_scope["standalone_cores"] = tree.standalone_cores
data_names = build_supplemental_index()
return cross_reference(
+16 -8
View File
@@ -26,8 +26,12 @@ class PlatformScope:
def platform_scope(
platform: str, target: str | None, platforms_dir: str, profiles: dict[str, dict],
all_profiles: dict[str, dict],
) -> PlatformScope:
"""The scope of a --platform run, narrowed to its --target cores."""
"""The scope of a --platform run, narrowed to its --target cores.
*all_profiles* is every profile of the run, whatever --emulator keeps:
the launcher records are proven against them."""
# A typo ended in a traceback where verify and slots name the closest
# target, and is refused the way they refuse it.
target_cores = target_scope(
@@ -40,7 +44,7 @@ def platform_scope(
)
return PlatformScope(
{k: v for k, v in profiles.items() if k in relevant},
standalone_set(config),
standalone_set(config, all_profiles),
config,
relevant,
run_anywhere,
@@ -60,7 +64,7 @@ class TreeScope:
def target_platforms_scope(
target: str, platforms_dir: str, profiles: dict[str, dict],
target: str, platforms_dir: str, profiles: dict[str, dict], all_profiles: dict[str, dict],
) -> TreeScope:
"""--target without --platform: every platform that has the target, each
with the cores it builds for it, the way verify and generate_pack read
@@ -75,28 +79,32 @@ def target_platforms_scope(
relevant |= set(resolve_platform_cores(config, profiles, target_cores=cache.get(name)))
return TreeScope(
{k: v for k, v in profiles.items() if k in relevant},
merged_standalone_set(configs.values()),
merged_standalone_set(configs.values(), all_profiles),
kept,
)
def tree_scope(
platform: str | None, target: str | None, platforms_dir: str, profiles: dict[str, dict],
all_profiles: dict[str, dict],
) -> TreeScope:
"""The scope --platform, --target or neither asks for."""
if platform:
scope = platform_scope(platform, target, platforms_dir, profiles)
scope = platform_scope(platform, target, platforms_dir, profiles, all_profiles)
return TreeScope(scope.profiles, scope.standalone_cores, [platform], scope)
if target:
return target_platforms_scope(target, platforms_dir, profiles)
return target_platforms_scope(target, platforms_dir, profiles, all_profiles)
# The tree as every platform runs it: a profile some platform runs
# standalone keeps its standalone entries. Laid out as libretro only,
# eka2l1, dolphin and xenia-edge lost 133 files no platform declares.
return TreeScope(
profiles,
merged_standalone_set(
load_platform_config(name, platforms_dir)
for name in list_registered_platforms(platforms_dir)
(
load_platform_config(name, platforms_dir)
for name in list_registered_platforms(platforms_dir)
),
all_profiles,
),
None,
)
+1 -1
View File
@@ -67,7 +67,7 @@ def core_data_trees(
if not data_registry:
return []
installed = installed_data_refs(platform_name)
handed = standalone_set(config)
handed = standalone_set(config, profiles)
# Relative to base_destination, which the members are written under. A
# platform with none writes its BIOS folder into every destination, and
# the trees go there as the core extras do.
+1 -1
View File
@@ -1535,7 +1535,7 @@ def collect_emulator_extras(
return extras
relevant = resolve_platform_cores(config, profiles, target_cores=target_cores)
standalone_set = platform_standalone_set(config)
standalone_set = platform_standalone_set(config, profiles)
by_name = db.get("indexes", {}).get("by_name", {})
# Build set of filenames already covered (platform baseline + first pass extras)
+2 -2
View File
@@ -484,7 +484,7 @@ def find_undeclared_files(
)
relevant = resolve_platform_cores(config, profiles, target_cores=target_cores)
standalone_set = platform_standalone_set(config)
standalone_set = platform_standalone_set(config, profiles)
# What the platform's own launchers open, matched to the cores it runs:
# the one decision the builder and this report both read.
launcher_layer = LauncherLayer(
@@ -647,6 +647,7 @@ def find_exclusion_notes(
platform_systems.add(sys_id)
relevant = resolve_platform_cores(config, profiles, target_cores=target_cores)
standalone_set = platform_standalone_set(config, profiles)
notes = []
for emu_name, profile in sorted(profiles.items()):
emu_systems = set(profile.get("systems", []))
@@ -682,7 +683,6 @@ def find_exclusion_notes(
# Count standalone-only files, but only report as excluded if the
# platform does NOT use this emulator in standalone mode
standalone_set = platform_standalone_set(config)
is_standalone = runs_standalone(emu_name, profile, standalone_set)
if not is_standalone:
standalone_files = [
+1 -1
View File
@@ -544,7 +544,7 @@ def slot_choices(
platform_profiles,
db,
config.get("base_destination", ""),
platform_standalone_set(config),
platform_standalone_set(config, profiles),
zip_contents,
data_dir_registry,
)
+1 -1
View File
@@ -29,7 +29,7 @@ def scan_platform(
relevant,
db,
config.get("base_destination", ""),
platform_standalone_set(config),
platform_standalone_set(config, profiles),
build_zip_contents_index(db) if zip_index is None else zip_index,
load_data_dir_registry(platforms_dir) if data_registry is None else data_registry,
)