From cdecb096a119cfcbb0490766039953e8fa6de943 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Tue, 6 Oct 2026 09:24:24 +0200 Subject: [PATCH] fix: refuse --refresh-data where nothing refreshes --- scripts/generate_pack.py | 12 ++++++++++++ tests/test_e2e.py | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/scripts/generate_pack.py b/scripts/generate_pack.py index 817c0fd7..979dea12 100644 --- a/scripts/generate_pack.py +++ b/scripts/generate_pack.py @@ -2457,6 +2457,18 @@ def _refuse_unapplied_flags(args, parser) -> None: parser.error("--region is incompatible with --manifest-targets") if args.one_per_slot and args.manifest_targets: parser.error("--one-per-slot is incompatible with --manifest-targets") + # Only the platform pack path refreshes the data directories; elsewhere + # the cache on disk was packed as it stood. + if args.refresh_data: + if args.offline: + parser.error("--refresh-data is incompatible with --offline") + for flag, on in ( + ("--emulator", args.emulator), + ("--system", args.system and not (args.platform or args.all)), + ("--from-md5", args.from_md5 or args.from_md5_file), + ): + if on: + parser.error(f"--refresh-data is incompatible with {flag}") _refuse_for_all_variants(args, parser) mode = next( diff --git a/tests/test_e2e.py b/tests/test_e2e.py index e9590b00..0f15d59f 100644 --- a/tests/test_e2e.py +++ b/tests/test_e2e.py @@ -6004,6 +6004,11 @@ struct BurnDriver BurnDrvneogeo = { "refuse"), (["--list-systems"], ["--region", "us"], "refuse"), (["--list-emulators"], ["--target", "switch"], "refuse"), + # Only the platform path refreshes data directories. + (["--emulator", "dolphin"], ["--refresh-data"], "refuse"), + (["--system", "sony-playstation"], ["--refresh-data"], "refuse"), + (["--from-md5", "d8f1"], ["--refresh-data"], "refuse"), + (["--platform", "retroarch", "--offline"], ["--refresh-data"], "refuse"), ] for mode, flag, expected in matrix: with self.subTest(mode=mode, flag=flag):