diff --git a/scripts/generate_pack.py b/scripts/generate_pack.py index 41ac7c5b..b7ff1691 100644 --- a/scripts/generate_pack.py +++ b/scripts/generate_pack.py @@ -1261,17 +1261,6 @@ def _normalize_zip_for_pack( -def _archive_destination( - archive_name: str, archive_prefix: str, pack_structure: dict | None, standalone: bool -) -> str: - """Where an emulator pack places one of the profile's archives.""" - archive_dest = sanitize_pack_path(archive_name) - if archive_prefix: - archive_dest = f"{archive_prefix}/{archive_dest}" - prefix = (pack_structure or {}).get("standalone" if standalone else "libretro", "") - return f"{prefix}/{archive_dest}" if prefix else archive_dest - - def _archive_is_optional(archive_entry: dict, archive_name: str, files: list[dict]) -> bool: """Optional as a whole: its own entry and every member it carries. @@ -4036,6 +4025,7 @@ def verify_and_finalize_packs( return all_ok from packpaths import ( # noqa: E402,F401 + _archive_destination, _path_parents, _has_path_conflict, _register_path, diff --git a/scripts/packpaths.py b/scripts/packpaths.py index 63910345..1359b318 100644 --- a/scripts/packpaths.py +++ b/scripts/packpaths.py @@ -62,3 +62,14 @@ def _resolve_destination( rel = f"{prefix}/{rel}" return rel + + +def _archive_destination( + archive_name: str, archive_prefix: str, pack_structure: dict | None, standalone: bool +) -> str: + """Where an emulator pack places one of the profile's archives.""" + archive_dest = sanitize_pack_path(archive_name) + if archive_prefix: + archive_dest = f"{archive_prefix}/{archive_dest}" + prefix = (pack_structure or {}).get("standalone" if standalone else "libretro", "") + return f"{prefix}/{archive_dest}" if prefix else archive_dest diff --git a/scripts/verify.py b/scripts/verify.py index 46646038..c3a8f2bf 100644 --- a/scripts/verify.py +++ b/scripts/verify.py @@ -1420,7 +1420,7 @@ def verify_emulator( A region priority list narrows the report the same way a pack built with the same list would be narrowed, through the emulator pack's own drop set. """ - from packpaths import _resolve_destination + from packpaths import _archive_destination, _resolve_destination load_emulator_profiles(emulators_dir) zip_contents = build_zip_contents_index(db) @@ -1543,7 +1543,12 @@ def verify_emulator( result["hle_fallback"] = False result["ground_truth"] = build_ground_truth(archive, validation_index) details.append(result) - dest = archive + # Where the pack puts it: an archive_prefix or pack_structure + # moves it, and a loose same-named entry is another file. + dest = _archive_destination( + archive, profile.get("archive_prefix", ""), + profile.get("pack_structure"), standalone, + ) dest_to_name[dest] = archive cur = result["status"] prev = file_status.get(dest) diff --git a/tests/test_emulator_pack_counts.py b/tests/test_emulator_pack_counts.py index e1383172..61fc95c0 100644 --- a/tests/test_emulator_pack_counts.py +++ b/tests/test_emulator_pack_counts.py @@ -18,7 +18,11 @@ from pathlib import Path REPO_ROOT = Path(__file__).resolve().parent.parent -CASES = ("raze", "rust_dos", "hatari", "xash3d_fwgs", "catacombgl", "openjk", "sonic2013") +# kronos: an archive unit under its archive_prefix and a loose same-named file. +CASES = ( + "raze", "rust_dos", "hatari", "xash3d_fwgs", "catacombgl", "openjk", "sonic2013", + "kronos", +) def _count(text: str, word: str) -> int: