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:
Abdessamad Derraz committed 2026-11-20 18:28:40 +01:00
1 parent 7cd499531d
commit 348d5b51c3
32 files changed
+130 -217

No files matched your search

+2 -6
View File
@@ -20,7 +20,7 @@ from .originals import collect_originals, unpinned, wanted_sources
from model.database import load_database
from model.platforms import load_platform_config, native_layer
from model.profiles import load_emulator_profiles
from model.registry import load_data_dir_registry
from model.registry import load_data_dir_registry, load_platform_registry
from model.safeparse import yaml_load
from resolve.categories import removal_candidates
from resolve.reconcile import Report, build_native_model
@@ -56,11 +56,7 @@ class StaleTruth(ValueError):
@functools.cache
def _truth_sources(platforms_dir: str) -> tuple[dict, dict, dict | None]:
"""Registry, profiles and database, as generate_truth reads them."""
registry_path = Path(platforms_dir) / "_registry.yml"
registry: dict = {}
if registry_path.exists():
with open(registry_path) as handle:
registry = (yaml_load(handle) or {}).get("platforms", {})
registry = load_platform_registry(platforms_dir)
profiles = load_emulator_profiles("emulators")
db = load_database(TRUTH_DB) if Path(TRUTH_DB).exists() else None
return registry, profiles, db