mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-30 21:38:55 -06:00
refactor: read hashes and the registry one way
Hash fields go through core.hashing.parse_hash_list, which also splits comma-joined list items: the truth model compared a comma-joined sha256 list as one value. _registry.yml goes through load_platform_registry (required= where an absent file must stop the run), database.json through load_database, file and member digests through file_digest and stream_hashes. download.py and check_release read SHA256SUMS.txt with one parser: a sha256sum -b line matched nothing in download.py and the pack went unchecked.
This commit is contained in:
1 parent
7cd499531d
commit
348d5b51c3
32 files changed
+130
-217
No files matched your search
@@ -25,20 +25,6 @@ class Finding:
|
||||
detail: str
|
||||
|
||||
|
||||
def parse_sums(text: str) -> dict[str, str]:
|
||||
"""`sha256sum` output: digest, then a space and a mode character."""
|
||||
sums: dict[str, str] = {}
|
||||
for line in text.splitlines():
|
||||
line = line.strip()
|
||||
if not line:
|
||||
continue
|
||||
digest, _, name = line.partition(" ")
|
||||
if len(digest) != 64 or not name:
|
||||
raise ValueError(f"not a sha256sum line: {line!r}")
|
||||
sums[name.lstrip(" *")] = digest.lower()
|
||||
return sums
|
||||
|
||||
|
||||
def _registry_findings(packs: dict, released: set[str]) -> list[Finding]:
|
||||
"""Each platform marked release_pack has a pack, and each pack serves one."""
|
||||
served = {p for pack in packs.values() for p in pack.get("platforms", ())}
|
||||
|
||||
@@ -8,6 +8,7 @@ import sys
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
from model.largefiles import registered_paths
|
||||
from core.artifacts import copy_file_atomic, set_plain_mode
|
||||
from core.hashing import file_digest
|
||||
from model.database import load_database
|
||||
@@ -19,10 +20,7 @@ def gitignored_paths(gitignore: str) -> set[str]:
|
||||
A missing file raises: read as empty, it left nothing to restore and
|
||||
nothing unsatisfied, and the run exited 0 with every asset absent.
|
||||
"""
|
||||
with open(gitignore) as f:
|
||||
return {
|
||||
line.strip() for line in f if line.strip().startswith("bios/")
|
||||
}
|
||||
return set(registered_paths(Path(gitignore).read_text(encoding="utf-8")))
|
||||
|
||||
|
||||
def index_cache(cache_dir: str) -> dict[str, str]:
|
||||
|
||||
Reference in new issue
Block a user