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

+4 -3
View File
@@ -15,6 +15,7 @@ from model.registry import load_platform_registry
from core.hashing import compute_hashes
from core.options import reject_unknown
from core.paths import EMULATORS_DIR, declared_destination, sanitize_pack_path
from core.ziptools import is_archive_path
from model.alternatives import core_file_spares
from model.declarations import OUTER_ROOTS, declared_root
from model.platforms import load_platform_config
@@ -778,9 +779,9 @@ class _PlatformPackBuild:
extract = file_entry.get("extract", False)
flat_dest = self._flat(full_dest)
if extract and local_path.endswith(".zip"):
if extract and is_archive_path(local_path):
extract_zip_to_archive(local_path, flat_dest, self.zf)
elif local_path.endswith(".zip"):
elif is_archive_path(local_path):
add_zip_to_pack(local_path, flat_dest, self.zf, file_entry)
else:
add_pack_member(self.zf, local_path, flat_dest)
@@ -876,7 +877,7 @@ class _PlatformPackBuild:
within = plan.opts.within
if within is not None and not same_bytes(local_path, within.get(flat_dest)):
return
if local_path.endswith(".zip"):
if is_archive_path(local_path):
add_zip_to_pack(local_path, flat_dest, self.zf, fe)
else:
add_pack_member(self.zf, local_path, flat_dest)