From a4455ef6a7ea8307245b16446be9f730cd16cf9b Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Sun, 6 Sep 2026 23:01:14 +0200 Subject: [PATCH] fix: refuse flags verify-packs cannot honour --- scripts/generate_pack.py | 13 +++++++++++++ tests/test_e2e.py | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/scripts/generate_pack.py b/scripts/generate_pack.py index 1edf01de..839e3845 100644 --- a/scripts/generate_pack.py +++ b/scripts/generate_pack.py @@ -2421,6 +2421,19 @@ def main(): # Quick-exit modes: --verify-packs alone = verify existing packs only # Combined with --all-variants, generation runs first then verify if args.verify_packs and not args.all_variants: + # This mode checks packs already on disk against the platform's own + # list. It reads the region priority above and nothing else, so a + # narrowing flag it cannot honour is refused rather than dropped: a + # dropped flag answers about an artifact the caller did not name, and + # an unknown target name reads as accepted. + for flag, given in ( + ("--target", args.target), + ("--one-per-slot", args.one_per_slot), + ("--required-only", args.required_only), + ("--source", args.source != "full"), + ): + if given: + parser.error(f"{flag} is incompatible with --verify-packs") with _pack_output_lock(args.output_dir, exclusive=False): _run_verify_packs(args) return diff --git a/tests/test_e2e.py b/tests/test_e2e.py index 2a97db6e..8380c38e 100644 --- a/tests/test_e2e.py +++ b/tests/test_e2e.py @@ -5814,6 +5814,19 @@ struct BurnDriver BurnDrvneogeo = { "refuse"), (["--platform", "retroarch", "--from-md5", "d8f1"], ["--one-per-slot"], "refuse"), + # --verify-packs returns before the argument checks run, so it used + # to accept all four of these -- an unknown target name included -- + # and answer about the pack sitting in the output directory. + (["--platform", "retroarch", "--verify-packs"], ["--target", "switch"], + "refuse"), + (["--platform", "retroarch", "--verify-packs"], ["--target", "no-such-xyz"], + "refuse"), + (["--platform", "retroarch", "--verify-packs"], ["--one-per-slot"], + "refuse"), + (["--platform", "retroarch", "--verify-packs"], ["--required-only"], + "refuse"), + (["--platform", "retroarch", "--verify-packs"], ["--source", "truth"], + "refuse"), ] for mode, flag, expected in matrix: with self.subTest(mode=mode, flag=flag):