fix: count a core file only where it is packed

verify kept its own copy of the placement rule and missed the flat RomM folder, so the report still counted 543 unreachable files as packed. It now asks the builder's ExtraPlacement. The README fraction counted every held core file, including those a platform cannot place or that a same-named packed file hides. It now counts what the pack holds.
This commit is contained in:
Abdessamad Derraz committed 2026-10-19 07:44:12 +02:00
1 parent 7d1e9f8816
commit 53f9746bfa
5 files changed
+83 -35

No files matched your search

+5 -1
View File
@@ -63,7 +63,11 @@ def compute_coverage(
present = ok + untested
pct = (present / total * 100) if total > 0 else 0
undeclared = result.get("undeclared_files", [])
core_present = sum(1 for u in undeclared if u.get("in_repo"))
# Held is not packed: a file the platform has no folder for, or one below
# a folder it lists flat, stays out of the pack the fraction describes.
core_present = sum(
1 for u in undeclared if u.get("in_repo") and u.get("in_pack", True)
)
core_missing = len(undeclared) - core_present
# Files a profile marks unsourceable never reach the undeclared list, so
# the gap they represent has to be counted back in.
+33 -21
View File
@@ -224,27 +224,41 @@ def hidden_extras(
return hidden
def unplaceable_extras(config: dict, undeclared: list[dict], profiles: dict) -> set:
"""Keys of the report entries a slug-based platform cannot place.
def _extra_dest(u: dict) -> str:
"""Where a report entry lands before any platform prefix.
An archive entry goes by the archive's name, and a directory path takes
the file's name after it ("cafeLibs/" + "snd_user.rpl").
"""
archive = u.get("archive")
raw = archive if archive else (u.get("path") or u["name"])
return f"{raw}{u['name']}" if raw.endswith("/") else raw
def unplaceable_extras(
config: dict, undeclared: list[dict], profiles: dict
) -> dict[tuple[str, str, str], str]:
"""The report entries a slug-based platform cannot place, with the reason.
RomM files every BIOS under the slug of its system and knows no slug
for DOS or for the arcade sets MAME 2003 reads. The builder skipped
those entries and the report counted them in the pack.
for DOS or for the arcade sets MAME 2003 reads, and it lists each folder
flat. The builder skipped those entries and the report counted them in
the pack. The answer comes from the builder's own placement.
"""
from common import _norm_system_id
is_slug_based, sys_to_slug = _detect_slug_structure(config)
if not is_slug_based:
return set()
platform_systems = set(config.get("systems", {}).keys())
norm_map = {_norm_system_id(sid): sid for sid in platform_systems}
native = native_slug_systems(config)
return {
(u.get("emulator", ""), u.get("name", ""), u.get("path") or "")
for u in undeclared
if u.get("in_repo")
and not _slug_for(u, profiles, platform_systems, norm_map, sys_to_slug, native)
}
placement = ExtraPlacement(config, "", profiles)
if not placement.slug_based:
return {}
unplaced: dict[tuple[str, str, str], str] = {}
for u in undeclared:
if not u.get("in_repo"):
continue
dest = _extra_dest(u)
if placement.place(u, dest) is None:
key = (u.get("emulator", ""), u.get("name", ""), u.get("path") or "")
unplaced[key] = (
"below_platform_folder" if placement.nested(dest) else "no_platform_slug"
)
return unplaced
def _agnostic_scan_extras(
@@ -795,9 +809,7 @@ def _collect_emulator_extras(
# For archive entries, use the archive name for resolution
archive = u.get("archive")
name = archive if archive else u["name"]
raw_dest = archive if archive else (u.get("path") or u["name"])
# Directory path: append filename (e.g. "cafeLibs/" + "snd_user.rpl")
dest = f"{raw_dest}{u['name']}" if raw_dest.endswith("/") else raw_dest
dest = _extra_dest(u)
# Slug-based platforms: prefix dest with system slug
placed = placement.place(u, dest)
+11 -2
View File
@@ -762,15 +762,24 @@ def find_exclusion_notes(
# Platform verification
_UNPLACED_REASONS = {
"no_platform_slug": "no platform slug for its system",
"below_platform_folder": "below the folder the platform lists",
}
def _mark_unplaced(config: dict, undeclared: list[dict], profiles: dict) -> None:
"""What the builder cannot place is not in the pack, held or not."""
from packextras import unplaceable_extras
unplaced = unplaceable_extras(config, undeclared, profiles)
for u in undeclared:
if (u.get("emulator", ""), u.get("name", ""), u.get("path") or "") in unplaced:
reason = unplaced.get(
(u.get("emulator", ""), u.get("name", ""), u.get("path") or "")
)
if reason:
u["in_pack"] = False
u["omitted"] = "no platform slug for its system"
u["omitted"] = _UNPLACED_REASONS[reason]
_HIDDEN_REASONS = {