fix: one rule for the held file a hash names

The system index read sha1 and md5 only, the file lookup any index
with no size bound, the gap table any index unbounded. declared_records
in model.database follows the resolver: a crc32 names only a record of
the declared size, and beside a stronger hash only what it names.
systems.json gains 511 held files declared by sha256 or crc32, and 41
MAME members no longer point at Chihiro's ver1305.bin through the crc32
of an erased flash block.
This commit is contained in:
Abdessamad Derraz committed 2026-11-24 02:18:40 +01:00
1 parent f143a8719b
commit 40dadc5dcd
6 files changed
+98 -44

No files matched your search

+3 -13
View File
@@ -9,7 +9,7 @@ from typing import TYPE_CHECKING
from core.hashing import declared_hash_lists
from core.text import series
from model.database import sha1_at
from model.database import declared_records, sha1_at
from model.platforms import native_layer
from packs.crossref import gap_source_counts, whole_tree_gaps
from resolve.nativemode import check_label
@@ -46,19 +46,9 @@ def _held_accepted(accepted: dict[str, list[str]], db: dict | None) -> str:
"""
if not accepted or not db:
return ""
indexes = db.get("indexes", {})
files = db.get("files", {})
for algo, values in accepted.items():
for value in values:
value = value.lower()
if algo == "sha1":
sha1 = value if value in files else None
else:
sha1 = indexes.get(f"by_{algo}", {}).get(value)
path = files.get(sha1 or "", {}).get("path")
if path:
return path
return ""
return next((path for named in declared_records(db, accepted).values()
for sha1 in named if (path := files[sha1].get("path"))), "")
def _declarations(cov: dict) -> dict[int, dict]: