fix: show packed core files with an empty gap list

verify --platform recalbox --system nec-pc-engine printed no Core files line while the pack held six syscard copies for geargrafx: the section returned on an empty gap report before reading packed_extras. It now prints the pack's counts whenever they are not zero.
This commit is contained in:
Abdessamad Derraz committed 2026-11-05 19:32:05 +01:00
1 parent 137f971dae
commit d8cfd283b4
2 files changed
+36 -3

No files matched your search

+6 -3
View File
@@ -1827,7 +1827,11 @@ def _omission_reasons(entries: list[dict]) -> str:
def _print_undeclared_section(result: dict, verbose: bool) -> None:
"""Print cross-reference section for undeclared files used by cores."""
undeclared = result.get("undeclared_files", [])
if not undeclared:
# The pack's core copies can come from no gap entry: recalbox
# --system nec-pc-engine packs six root syscard copies for geargrafx
# with an empty gap report, and returning here hid them.
packed = result.get("packed_extras")
if not undeclared and not (packed and any(packed.values())):
return
game_data, bios_files, unplaced = _split_undeclared(undeclared)
@@ -1850,7 +1854,6 @@ def _print_undeclared_section(result: dict, verbose: bool) -> None:
# The builder's count, one file per pack path, when the platform pass
# replayed it. Counting entries said 1130 for RetroArch, 48 more than the
# pack holds: rom.key alone was claimed by three Amiga cores.
packed = result.get("packed_extras")
core_in_pack = (
packed["bios"] if packed is not None else len(req_in_repo) + len(opt_in_repo)
)
@@ -1880,7 +1883,7 @@ def _print_undeclared_section(result: dict, verbose: bool) -> None:
print(f" Core files held but not packed: {len(unplaced)} "
f"({_omission_reasons(unplaced)})")
if game_data:
if game_data or (packed and packed.get("game_data")):
gd_missing = [u for u in game_data if not u["in_repo"]]
gd_packed = (
packed["game_data"] if packed is not None
+30
View File
@@ -200,5 +200,35 @@ class EveryGapCountedIsNamed(unittest.TestCase):
self.assertIn("MISSING (game data): engine needs level.dat", verbose.getvalue())
class CoreCopiesWithoutAGapEntryAreCounted(unittest.TestCase):
"""verify --platform recalbox --system nec-pc-engine printed no Core
files line while the pack held six geargrafx syscard copies: the gap
report was empty, and the section returned before reading the pack's
count."""
def test_the_packed_count_is_printed(self):
import contextlib # noqa: PLC0415
import io # noqa: PLC0415
sys.path.insert(0, str(REPO_ROOT / "scripts"))
import verify # noqa: PLC0415
for packed, expected in (({"bios": 6, "game_data": 0}, "Core files: 6 in pack"),
({"bios": 0, "game_data": 3}, "Game data: 3 in pack")):
out = io.StringIO()
with contextlib.redirect_stdout(out):
verify._print_undeclared_section(
{"undeclared_files": [], "packed_extras": packed}, verbose=False
)
with self.subTest(packed=packed):
self.assertIn(expected, out.getvalue())
out = io.StringIO()
with contextlib.redirect_stdout(out):
verify._print_undeclared_section(
{"undeclared_files": [], "packed_extras": {"bios": 0, "game_data": 0}}, False
)
self.assertEqual(out.getvalue(), "")
if __name__ == "__main__":
unittest.main()