fix: find an archive by the ROM a list pins in it

This commit is contained in:
Abdessamad Derraz committed 2026-11-05 12:08:26 +01:00
1 parent 3ef7b2fbe5
commit ea2e0b10c4
4 files changed
+57 -4

No files matched your search

+9 -1
View File
@@ -49,6 +49,7 @@ from hashing import parse_hash_list
from validation import (
case_folded_slots,
declaration_settles,
inner_rom_check,
installed_with_emulator,
outside_gap_scope,
read_from_save_dir,
@@ -476,7 +477,14 @@ class FileConsumers:
entry, self._db, self._zip_contents, dest_hint=dest,
data_dir_registry=self._data_dir_registry,
)
if not path or status in ("not_found", "hash_mismatch"):
if not path or status == "not_found":
return None
# Batocera pins naomi2.zip by the md5 of a ROM inside it: the resolver
# hands back the archive as a mismatch, and the member settles it as
# the builder does.
if status == "hash_mismatch" and not (
entry.get("zipped_file") and inner_rom_check(entry, path) == "ok"
):
return None
return self._sha1_by_path.get(path)
+8 -2
View File
@@ -4746,12 +4746,17 @@ def file_lookup_records(
url = _site_path(f"platforms/{key}.md#{system_id.replace(' ', '-')}")
system_label = _lookup_system_name(system_id)
for entry in system.get("files") or []:
# A hash of a ROM inside the archive (zipped_file) designates
# no collection file by itself: the archive holding it is the one.
archive = (consumers.sha1_of(entry)
if consumers is not None and entry.get("zipped_file") else None)
for algorithm in HASH_ALGORITHMS:
for value in _hash_values(entry.get(algorithm)):
records.append({
"value": value, "algorithm": algorithm, "layer": "platform",
"owner": key, "name": str(entry.get("name", "")), "url": url,
**({"system_name": system_label} if system_label else {}),
**({"sha1": archive} if archive else {}),
})
for key, profile in sorted(profiles.items()):
if profile.get("type") in ("alias", "test"):
@@ -4843,8 +4848,9 @@ def _held_under_every_hash(records: list[dict], files: dict, indexes: dict) -> l
for record in records:
if record["layer"] not in ("platform", "emulator"):
continue
sha1 = _collection_sha1(files, indexes, record["algorithm"], record["value"])
if sha1 is None:
sha1 = record.get("sha1") or _collection_sha1(
files, indexes, record["algorithm"], record["value"])
if sha1 not in files:
continue
record["sha1"] = sha1
for algorithm in HASH_ALGORITHMS: