mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-29 12:58:51 -06:00
refactor: read declared hashes with one helper
core.hashing.declared_hash_lists gives an entry's declared values per field in the order written, and declared_hashes builds its sets on it. The gap page, the doubled-destination report and the file lookup used their own copies of that reader. The wanted page keeps its filters on top of it. sitegen.lookup.hash_pairs replaces sorted_hash_values for the lookup, the data exports and the structured data. The one-field aliases parse_md5_list and reconcile.hash_values are gone, and model.profiles reads HASH_FIELDS instead of a fourth tuple.
This commit is contained in:
1 parent
ea68e85c06
commit
02969dda06
30 files changed
+176
-195
No files matched your search
@@ -12,7 +12,7 @@ from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING, TypedDict
|
||||
|
||||
from core.hashing import parse_hash_list, parse_md5_list, stream_hashes
|
||||
from core.hashing import parse_hash_list, stream_hashes
|
||||
from core.paths import BIOS_DIR, PLATFORMS_DIR, REPO_ROOT
|
||||
from model.alternatives import set_keys, set_requirements, settle_sets
|
||||
from model.database import get_mame_clone_map, sha1_at
|
||||
@@ -630,7 +630,7 @@ def entry_source(f: dict, index: dict) -> str | None:
|
||||
# The declared content anywhere in bios/ comes before a data/ copy, as in
|
||||
# the resolver: the hash steps run before the data directories.
|
||||
held = (
|
||||
any(index["by_md5"].get(v) for v in parse_md5_list(f.get("md5")))
|
||||
any(index["by_md5"].get(v) for v in parse_hash_list(f.get("md5")))
|
||||
or any(v in db_files for v in values("sha1"))
|
||||
# rust_dos names its SC-55 ROMs by sha256 alone
|
||||
or any(v in index["by_sha256"] for v in values("sha256"))
|
||||
|
||||
@@ -6,7 +6,7 @@ import os
|
||||
from dataclasses import dataclass, field
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from core.hashing import lists_hashes, parse_md5_list
|
||||
from core.hashing import lists_hashes, parse_hash_list
|
||||
from model.declarations import declared_slot
|
||||
from model.profiles import entry_system_ids, lists_files
|
||||
from packs.gaps import gap_destination
|
||||
@@ -336,7 +336,7 @@ def checked_by_path(mode: str, entry: dict, rule: str = "") -> bool:
|
||||
else:
|
||||
fields = (nativemode.digest_algorithm(mode) or "",)
|
||||
return not any(
|
||||
parse_md5_list(entry.get(name)) if name == "md5" else entry.get(name)
|
||||
parse_hash_list(entry.get(name)) if name == "md5" else entry.get(name)
|
||||
for name in fields
|
||||
)
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from core.hashing import compute_hashes, md5sum, parse_md5_list
|
||||
from core.hashing import compute_hashes, md5sum, parse_hash_list
|
||||
from core.ziptools import check_inside_zip
|
||||
from resolve.nativemode import SIZE_AND_ANY_HASH, reads_file_contents
|
||||
from resolve.validation import (
|
||||
@@ -142,7 +142,7 @@ def verify_entry_md5(
|
||||
# One parse for verify, the builder and the pack check: Recalbox writes
|
||||
# md5 in uppercase, and a copy that lowercased only comma lists judged
|
||||
# a single uppercase value differently from the others.
|
||||
md5_list = parse_md5_list(expected_md5)
|
||||
md5_list = parse_hash_list(expected_md5)
|
||||
|
||||
if not local_path:
|
||||
return {**base, "status": Status.MISSING}
|
||||
|
||||
Reference in new issue
Block a user