From 28857da8a689fc1dc6e4593f239dec7d21153059 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Thu, 15 Oct 2026 23:38:16 +0200 Subject: [PATCH] fix: lift unsourceable flags on collected paks --- emulators/iortcw.yml | 2 -- emulators/openmohaa.yml | 1 - tests/test_game_data_homonyms.py | 31 +++++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/emulators/iortcw.yml b/emulators/iortcw.yml index 7d88a59d..52fd76b1 100644 --- a/emulators/iortcw.yml +++ b/emulators/iortcw.yml @@ -177,7 +177,6 @@ files: required: false source_ref: "SP/code/qcommon/files.c:181, 3858-3863, 3933-3946, 3969-3970" note: "Single-player build: a pak0 under demomain/ with checksum 2985661941 stands in for main/pak0.pk3 with a warning, and the point-release check is skipped." - unsourceable: "demo data the collection does not hold yet; a same-named file of another game must not stand in" - name: "pak0.pk3" description: "Multiplayer demo" @@ -187,4 +186,3 @@ files: required: false source_ref: "MP/code/qcommon/files.c:192, 3852-3857, 3927-3940, 3963-3964" note: "Multiplayer build: a pak0 under demomain/ with checksum 2031778175 stands in for main/pak0.pk3 with a warning, and the point-release check is skipped." - unsourceable: "demo data the collection does not hold yet; a same-named file of another game must not stand in" diff --git a/emulators/openmohaa.yml b/emulators/openmohaa.yml index 694948f8..aaf05b6e 100644 --- a/emulators/openmohaa.yml +++ b/emulators/openmohaa.yml @@ -145,7 +145,6 @@ files: required: false source_ref: "code/qcommon/files.cpp:339 (fs_originalPaks_mainta[2])" note: "Added by the 2.11 patch." - unsourceable: "patch data the collection does not hold yet; a same-named file of another game must not stand in" - name: "pak4.pk3" category: game_data diff --git a/tests/test_game_data_homonyms.py b/tests/test_game_data_homonyms.py index 277618e5..afa1318c 100644 --- a/tests/test_game_data_homonyms.py +++ b/tests/test_game_data_homonyms.py @@ -374,5 +374,36 @@ class BundledFilesComeFromTheirOwnTree(unittest.TestCase): self.assertIn(f"/{owner}/", path or "") +class HeldFilesAreNotUnsourceable(unittest.TestCase): + """`unsourceable:` says the collection cannot hold a file; once its bytes + sit at the path the entry names, the flag hides them. + + The RTCW demo paks and the Spearhead 2.11 pak3 were collected the night + their entries were flagged "does not hold yet" and the flags stayed: they + reached two packs only through another game's same-named file, and left + them when that path closed. + """ + + def test_no_flagged_entry_has_a_file_at_its_path(self): + db_path = REPO_ROOT / "database.json" + if not db_path.exists(): + self.skipTest("database.json is not built") + by_suffix = load_database(str(db_path))["indexes"]["by_path_suffix"] + stale = [] + for name, profile in load_emulator_profiles(str(REPO_ROOT / "emulators")).items(): + for entry in profile.get("files", []): + if not entry.get("unsourceable"): + continue + for key in ("path", "standalone_path"): + dest = entry.get(key) + if not isinstance(dest, str) or "/" not in dest: + continue + if dest.endswith("/"): + dest += entry.get("name", "") + if dest in by_suffix: + stale.append((name, dest)) + self.assertEqual(stale, []) + + if __name__ == "__main__": unittest.main()