fix: key losing core claims like the winner

_collect_emulator_extras recorded a losing claim's path without the
declared root, while the winner's was rewritten with it. On RetroDECK
verify --region kept Rustation and Mednafen STV copies of withdrawn
bios/ files in undeclared_files as packed (7 under japan, 4 under
north-america, 3 under europe).
This commit is contained in:
Abdessamad Derraz committed 2026-11-06 15:09:21 +01:00
1 parent bc489273a0
commit 0ec99cc771
2 files changed
+39 -1

No files matched your search

+7 -1
View File
@@ -1222,8 +1222,14 @@ def _collect_emulator_extras(
)
continue
if claimants is not None:
# Keyed as extra_region_key keys the extra that wins the path: a
# losing claim kept the bare path, and on RetroDECK (declared
# root bios/) verify --region listed Rustation's scph1002b.bin
# as packed while the builder had withdrawn bios/scph1002b.bin.
claimants[(u.get("emulator", ""), u.get("name", ""), u.get("path") or "")] = (
sanitize_pack_path(placements[0][0])
prefixed_destination(
sanitize_pack_path(placements[0][0]), declared_root(config)
)
)
for dest, full_dest in placements:
candidates = [
+32
View File
@@ -98,5 +98,37 @@ class TheGroupTakesThePlatformSpelling(unittest.TestCase):
)
class ALosingClaimIsKeyedLikeTheWinner(unittest.TestCase):
"""RetroDECK writes its BIOS under bios/. The extra that won a path was
keyed bios/scph1002b.bin, the losing claims bare scph1002b.bin, so verify
--region never matched them against the drops and listed Rustation's
copies as packed while the builder had withdrawn them."""
def test_a_losing_claim_carries_the_declared_root(self):
import os
from common import declared_root, load_database, load_emulator_profiles
from common import load_platform_config
from packextras import platform_region_groups
previous = os.getcwd()
os.chdir(REPO_ROOT)
self.addCleanup(os.chdir, previous)
config = load_platform_config("retrodeck", "platforms")
root = declared_root(config)
self.assertTrue(root)
_groups, claims = platform_region_groups(
config, config["systems"], "emulators", load_database("database.json"),
config.get("base_destination", ""), load_emulator_profiles("emulators"),
)
rustation = {
name: dest for (emulator, name, _path), dest in claims.items()
if emulator == "Rustation" and name.startswith("scph")
}
self.assertTrue(rustation)
for name, dest in rustation.items():
self.assertEqual(dest, f"{root}/{name}")
if __name__ == "__main__":
unittest.main()