refactor: read archive members in one place

core.ziptools.zip_members lists the name, size and crc32 of each member once per archive revision. The site lookup and cards, the gap report, the pack check, the romset importer, the recipe identification and build, provenance, derivations and the atom pool read it instead of opening each archive again.

Each reader also tested a .zip suffix and skipped the .variants/ copies (x.zip.1a2b3c4d): the site lookup listed no member of a copy, the gap report's member index never saw one, the pack check never compared a copy's members, and the pack builders copied a copy without its CRC test. They now use is_archive_path. The inner ROM index of the resolver reads copies too, and a copy answers only for a member no primary holds.
This commit is contained in:
Abdessamad Derraz committed 2026-11-21 10:30:40 +01:00
1 parent 331f244aac
commit 74fcdd2bc5
16 files changed
+213 -103

No files matched your search

+2 -2
View File
@@ -21,7 +21,7 @@ from core.hashing import declared_hash_lists, file_digest
from resolve.content import declared_hash_verdict
from resolve.localfile import resolution_is_hash_exact, resolve_local_file
from core.paths import REPO_ROOT, declared_destination
from core.ziptools import readable_zip_member_crcs
from core.ziptools import is_archive_path, readable_zip_member_crcs
from resolve.validation import inner_rom_check
# CLI-wide network policy. Public helpers can override it explicitly, while
# every CLI mode inherits --offline (including large-file release fallback).
@@ -425,7 +425,7 @@ def _archive_choice(
# that answers one of them (adam_fdc.zip: a one-member MAME set
# answered first, the eight-member set sat beside it).
def accepted(path: str | None) -> int:
if not path or not path.endswith(".zip"):
if not path or not is_archive_path(path):
return -1
return sum(inner_rom_check(fe, path) == "ok" for fe in members)