fix: read archive members under the collection

This commit is contained in:
Abdessamad Derraz committed 2026-11-24 03:38:59 +01:00
1 parent 27dc26bd80
commit 95cbb5af1d
28 files changed
+104 -49

No files matched your search

+3 -1
View File
@@ -2,6 +2,8 @@
from __future__ import annotations
from pathlib import Path
from model.dbpaths import collection_root
import os
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, TypedDict
@@ -816,7 +818,7 @@ def verify_platform(
for sys in config.get("systems", {}).values()
for fe in sys.get("files", [])
)
zip_contents = build_zip_contents_index(db) if has_zipped else {}
zip_contents = build_zip_contents_index(db, collection_root(Path(BIOS_DIR))) if has_zipped else {}
# Loaded before the slot overrides: a caller passing no profiles (the
# README's coverage) got no override and reported a discrepancy at a slot
+3 -1
View File
@@ -2,6 +2,8 @@
from __future__ import annotations
from pathlib import Path
from model.dbpaths import collection_root
import os
from collections.abc import Callable
from dataclasses import dataclass, field
@@ -510,7 +512,7 @@ def verify_emulator(
# The member index only answers a zipped_file entry, and decompressing
# every archive took 23 of the 24 seconds of a run that had none.
zip_contents = (
build_zip_contents_index(db)
build_zip_contents_index(db, collection_root(Path(BIOS_DIR)))
if any(f.get("zipped_file") for _name, profile in selected
for f in profile.get("files") or [])
else {}
+3 -1
View File
@@ -2,6 +2,8 @@
from __future__ import annotations
from pathlib import Path
from model.dbpaths import collection_root
import contextlib
import functools
import os
@@ -481,7 +483,7 @@ def build_emulator_pack(
all_profiles = load_emulator_profiles(emulators_dir, skip_aliases=False)
zip_contents = options.get("zip_contents")
if zip_contents is None:
zip_contents = build_zip_contents_index(db)
zip_contents = build_zip_contents_index(db, collection_root(Path(bios_dir)))
try:
selected = select_emulator_profiles(profile_names, all_profiles, standalone)
+6 -4
View File
@@ -6,6 +6,8 @@ coverage report that disagree describe different collections."""
from __future__ import annotations
from pathlib import Path
from model.dbpaths import collection_root
from collections import Counter
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, TypedDict
@@ -214,7 +216,7 @@ def verify_pack(
by_md5 = db.get("indexes", {}).get("by_md5", {}) # MD5 -> SHA1
# Built on the first archive no hash recognises, once per pack: the
# index opens every archive of the collection.
held_inside = _once(lambda: build_zip_contents_index(db))
held_inside = _once(lambda: build_zip_contents_index(db, collection_root(Path(BIOS_DIR))))
by_name = db.get("indexes", {}).get("by_name", {}) # name -> [SHA1]
# Data directory file index
@@ -581,7 +583,7 @@ def _builder_extras(
config, expect.opts.emulators_dir, db, emu_profiles, shipped, expect.target_cores,
expect.region_drops or None,
resolver=ExtraResolver(
db, BIOS_DIR, build_zip_contents_index(db), data_registry,
db, BIOS_DIR, build_zip_contents_index(db, collection_root(Path(BIOS_DIR))), data_registry,
build_validation_index(platform_profiles),
destination_owners(platform_profiles), True, profiles=emu_profiles,
),
@@ -707,7 +709,7 @@ def _region_drops(
config, emu_profiles, target_cores
)
held: set[str] = set()
held_zip_contents = build_zip_contents_index(db) if db is not None else {}
held_zip_contents = build_zip_contents_index(db, collection_root(Path(BIOS_DIR))) if db is not None else {}
region_groups, _extra_dests = platform_region_groups(
config,
expected_systems,
@@ -803,7 +805,7 @@ def _count_baseline(
for fe in declarations
if fe.get("group")
}
exclusion_index = build_zip_contents_index(db) if db is not None else {}
exclusion_index = build_zip_contents_index(db, collection_root(Path(BIOS_DIR))) if db is not None else {}
categories = EntryCategories(expect.config, expect.emu_profiles, data_registry)
for expected, declarations in baseline_groups.items():
if expected in view.zip_set:
+4 -2
View File
@@ -2,6 +2,8 @@
from __future__ import annotations
from pathlib import Path
from model.dbpaths import collection_root
import argparse
import contextlib
import os
@@ -97,7 +99,7 @@ def _run_hash_mode(args: argparse.Namespace) -> None:
if print_hash_lookup(lookup_hashes(hashes, db, args.bios_dir)):
sys.exit(1)
return
zip_contents = build_zip_contents_index(db)
zip_contents = build_zip_contents_index(db, collection_root(Path(args.bios_dir)))
try:
with pack_output_lock(args.output_dir):
outcome = generate_md5_pack(
@@ -222,7 +224,7 @@ def run_pack_command(
return args
db = load_database(args.db)
zip_contents = build_zip_contents_index(db)
zip_contents = build_zip_contents_index(db, collection_root(Path(args.bios_dir)))
if args.emulator or (args.system and not args.platform and not args.all):
_run_profile_mode(args, db, zip_contents)
return args
+5 -3
View File
@@ -2,7 +2,9 @@
from __future__ import annotations
from core.paths import PLATFORMS_DIR
from pathlib import Path
from model.dbpaths import collection_root
from core.paths import BIOS_DIR, PLATFORMS_DIR
from core.ziptools import build_zip_contents_index
from model.platforms import load_platform_config
from model.registry import load_data_dir_registry
@@ -31,7 +33,7 @@ def scan_platform(
db,
config.get("base_destination", ""),
platform_launches(config, profiles),
build_zip_contents_index(db) if zip_index is None else zip_index,
build_zip_contents_index(db, collection_root(Path(BIOS_DIR))) if zip_index is None else zip_index,
load_data_dir_registry(platforms_dir) if data_registry is None else data_registry,
)
@@ -41,7 +43,7 @@ def scan_platforms(
target_cores: dict[str, set[str] | None], data_registry: dict,
) -> tuple[dict[str, list[Conflict]], dict[str, list[Collision]]]:
"""The platforms with a contested destination, and those declaring one twice."""
zip_index = build_zip_contents_index(db)
zip_index = build_zip_contents_index(db, collection_root(Path(BIOS_DIR)))
found: dict[str, list[Conflict]] = {}
collided: dict[str, list[Collision]] = {}
for name in names: