fix: parse member md5 lists one way

This commit is contained in:
Abdessamad Derraz committed 2026-10-18 14:50:26 +02:00
1 parent dbd47886ce
commit 0c53d165c1
4 files changed
+40 -6

No files matched your search

+2 -1
View File
@@ -22,6 +22,7 @@ from nativemode import hash_mismatch_excludes_file
import functools
import hashlib
from common import filter_systems_by_target
from hashing import parse_md5_list
from common import load_emulator_profiles
from common import load_platform_config
import os
@@ -447,7 +448,7 @@ def _repo_satisfies_declaration(
def _repo_holds_member(file_entry: dict, db: dict) -> bool:
"""Whether a held archive of that name carries the declared member."""
files_db = db.get("files", {})
declared = [m.strip() for m in str(file_entry.get("md5") or "").split(",") if m.strip()]
declared = parse_md5_list(file_entry.get("md5"))
for sha1 in db.get("indexes", {}).get("by_name", {}).get(file_entry.get("name", ""), []):
path = (files_db.get(sha1) or {}).get("path", "")
if not path.endswith(".zip") or not os.path.exists(path):
+1 -1
View File
@@ -703,7 +703,7 @@ def inner_rom_check(file_entry: dict, local_path: str) -> str:
matches, else for the last one tried. The pack and the install manifest
both read it, so a file one of them ships is a file the other lists.
"""
declared = [m.strip() for m in file_entry.get("md5", "").split(",") if m.strip()]
declared = parse_md5_list(file_entry.get("md5"))
result = "not_in_zip"
for candidate in declared or [""]:
result = check_inside_zip(local_path, file_entry["zipped_file"], candidate)
+5 -4
View File
@@ -34,6 +34,7 @@ from collections.abc import Mapping
import slots
sys.path.insert(0, os.path.dirname(__file__))
from hashing import parse_md5_list
from common import (
platform_arg,
target_listing_line,
@@ -190,10 +191,10 @@ def verify_entry_md5(
required = file_entry.get("required", True)
base = {"name": name, "required": required}
if expected_md5 and "," in expected_md5:
md5_list = [m.strip().lower() for m in expected_md5.split(",") if m.strip()]
else:
md5_list = [expected_md5] if expected_md5 else []
# 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)
if not local_path:
return {**base, "status": Status.MISSING}