mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-10 13:33:24 -05:00
fix: decide destination winners without data dirs
This commit is contained in:
1 parent
26ea5336a7
commit
315549a5b0
3 files changed
+22
-8
No files matched your search
@@ -442,7 +442,6 @@ def _preferred_entries(
|
|||||||
base_dest: str,
|
base_dest: str,
|
||||||
required_only: bool,
|
required_only: bool,
|
||||||
zip_contents,
|
zip_contents,
|
||||||
data_registry,
|
|
||||||
offline,
|
offline,
|
||||||
) -> dict[str, int]:
|
) -> dict[str, int]:
|
||||||
"""Which declaration wins when several claim the same destination.
|
"""Which declaration wins when several claim the same destination.
|
||||||
@@ -451,6 +450,9 @@ def _preferred_entries(
|
|||||||
in one and hash-constrained in another. First-come dedup would let
|
in one and hash-constrained in another. First-come dedup would let
|
||||||
the bare entry pack whatever answers to the name, so a constrained
|
the bare entry pack whatever answers to the name, so a constrained
|
||||||
sibling that resolves by content claims the destination instead.
|
sibling that resolves by content claims the destination instead.
|
||||||
|
The choice is about the baseline and reads no data directory, for the
|
||||||
|
pack, the manifest and verify alike: verify alone passed the registry
|
||||||
|
and could crown a declaration only a data/ cache satisfies.
|
||||||
"""
|
"""
|
||||||
preferred_entries: dict[str, int] = {}
|
preferred_entries: dict[str, int] = {}
|
||||||
dest_entries: dict[str, list[dict]] = {}
|
dest_entries: dict[str, list[dict]] = {}
|
||||||
@@ -481,7 +483,6 @@ def _preferred_entries(
|
|||||||
db,
|
db,
|
||||||
bios_dir,
|
bios_dir,
|
||||||
zip_contents,
|
zip_contents,
|
||||||
data_dir_registry=data_registry,
|
|
||||||
offline=offline,
|
offline=offline,
|
||||||
))
|
))
|
||||||
for fe in constrained
|
for fe in constrained
|
||||||
@@ -734,7 +735,7 @@ def generate_pack(
|
|||||||
# atari-5200). No data directories: the choice is about the baseline.
|
# atari-5200). No data directories: the choice is about the baseline.
|
||||||
preferred_entries = _preferred_entries(
|
preferred_entries = _preferred_entries(
|
||||||
pack_systems, db, bios_dir, base_dest, required_only,
|
pack_systems, db, bios_dir, base_dest, required_only,
|
||||||
zip_contents, None, offline,
|
zip_contents, offline,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Region selection is decided once, over both the platform baseline and the
|
# Region selection is decided once, over both the platform baseline and the
|
||||||
@@ -3362,7 +3363,7 @@ def generate_manifest(
|
|||||||
# does; a manifest carries no data directories.
|
# does; a manifest carries no data directories.
|
||||||
preferred_entries = _preferred_entries(
|
preferred_entries = _preferred_entries(
|
||||||
pack_systems, db, bios_dir, base_dest, required_only,
|
pack_systems, db, bios_dir, base_dest, required_only,
|
||||||
zip_contents, None, offline,
|
zip_contents, offline,
|
||||||
)
|
)
|
||||||
for sys_id, system in sorted(pack_systems.items()):
|
for sys_id, system in sorted(pack_systems.items()):
|
||||||
for file_entry in system.get("files", []):
|
for file_entry in system.get("files", []):
|
||||||
|
|||||||
+2
-3
@@ -776,14 +776,13 @@ def _mark_unplaced(config: dict, undeclared: list[dict], profiles: dict) -> None
|
|||||||
|
|
||||||
def _twin_index(
|
def _twin_index(
|
||||||
verify_systems: dict, db: dict, base_dest: str, zip_contents: dict,
|
verify_systems: dict, db: dict, base_dest: str, zip_contents: dict,
|
||||||
data_dir_registry: dict | None,
|
|
||||||
) -> tuple[dict[str, int], dict[int, tuple[str, dict]]]:
|
) -> tuple[dict[str, int], dict[int, tuple[str, dict]]]:
|
||||||
"""Which declaration the pack ships at each destination, and every declaration by id."""
|
"""Which declaration the pack ships at each destination, and every declaration by id."""
|
||||||
from generate_pack import _preferred_entries
|
from generate_pack import _preferred_entries
|
||||||
|
|
||||||
preferred_entries = _preferred_entries(
|
preferred_entries = _preferred_entries(
|
||||||
verify_systems, db, DEFAULT_BIOS_DIR, base_dest, False,
|
verify_systems, db, DEFAULT_BIOS_DIR, base_dest, False,
|
||||||
zip_contents, data_dir_registry, True,
|
zip_contents, True,
|
||||||
)
|
)
|
||||||
winners = {
|
winners = {
|
||||||
id(fe): (sid, fe)
|
id(fe): (sid, fe)
|
||||||
@@ -968,7 +967,7 @@ def verify_platform(
|
|||||||
# xroar component hashes bios/disk.rom and finds the PC-88 ROM.
|
# xroar component hashes bios/disk.rom and finds the PC-88 ROM.
|
||||||
base_dest = config.get("base_destination", "")
|
base_dest = config.get("base_destination", "")
|
||||||
preferred_entries, winners = _twin_index(
|
preferred_entries, winners = _twin_index(
|
||||||
verify_systems, db, base_dest, zip_contents, data_dir_registry
|
verify_systems, db, base_dest, zip_contents
|
||||||
)
|
)
|
||||||
|
|
||||||
for sys_id, system in verify_systems.items():
|
for sys_id, system in verify_systems.items():
|
||||||
|
|||||||
@@ -54,12 +54,26 @@ class PreferredArchive(unittest.TestCase):
|
|||||||
]
|
]
|
||||||
systems = {"s": {"files": declarations}}
|
systems = {"s": {"files": declarations}}
|
||||||
preferred = generate_pack._preferred_entries(
|
preferred = generate_pack._preferred_entries(
|
||||||
systems, db, "bios", "", False, {}, None, True)
|
systems, db, "bios", "", False, {}, True)
|
||||||
chosen = next(fe for fe in declarations if id(fe) == preferred["set.zip"])
|
chosen = next(fe for fe in declarations if id(fe) == preferred["set.zip"])
|
||||||
path, _status = generate_pack.resolve_file(chosen, db, "bios", {}, offline=True)
|
path, _status = generate_pack.resolve_file(chosen, db, "bios", {}, offline=True)
|
||||||
self.assertEqual(path, "bios/b/set.zip")
|
self.assertEqual(path, "bios/b/set.zip")
|
||||||
|
|
||||||
|
|
||||||
|
class OneWinnerRuleForEveryReader(unittest.TestCase):
|
||||||
|
"""verify passed the data-directory registry to the winner rule, the pack
|
||||||
|
and the manifest passed none: a declaration only a data/ cache satisfies
|
||||||
|
won in the report and lost in the pack. The rule takes no registry."""
|
||||||
|
|
||||||
|
def test_the_rule_reads_no_data_directory(self):
|
||||||
|
import inspect # noqa: PLC0415
|
||||||
|
|
||||||
|
import generate_pack # noqa: PLC0415
|
||||||
|
|
||||||
|
parameters = inspect.signature(generate_pack._preferred_entries).parameters
|
||||||
|
self.assertFalse([name for name in parameters if "registry" in name])
|
||||||
|
|
||||||
|
|
||||||
class IntegrityChecksEveryMember(unittest.TestCase):
|
class IntegrityChecksEveryMember(unittest.TestCase):
|
||||||
"""A pack holding one ROM of an archive declared per ROM fails its check.
|
"""A pack holding one ROM of an archive declared per ROM fails its check.
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user