From d8cfd283b4ef1d02b46e785ebdec6b8546949cb6 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Thu, 5 Nov 2026 19:32:05 +0100 Subject: [PATCH] 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. --- scripts/verify.py | 9 ++++++--- tests/test_verify_listing.py | 30 ++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/scripts/verify.py b/scripts/verify.py index 67aef9f42..1d9d78d71 100644 --- a/scripts/verify.py +++ b/scripts/verify.py @@ -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 diff --git a/tests/test_verify_listing.py b/tests/test_verify_listing.py index 82b25229b..c825b52a5 100644 --- a/tests/test_verify_listing.py +++ b/tests/test_verify_listing.py @@ -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()