fix: a container md5 leaves a zippedFile md5 alone

Batocera and KNULLI check a zippedFile item's md5 against the member inside the archive. A profile's container md5 for the archive would have replaced it as a correction. The item's md5 is now read as Recalbox's composite md5 is: neither compared with the container's nor overwritten by it.
This commit is contained in:
Abdessamad Derraz committed 2026-11-06 04:00:15 +01:00
1 parent 6427e46e25
commit 290c0b73ff
2 files changed
+23 -3

No files matched your search

+6 -3
View File
@@ -148,8 +148,10 @@ class NativeFile:
# platform gives it), empty when no core the platform runs is named.
runners: list[tuple[bool, str]] = field(default_factory=list)
# The platform reads this file's md5 as a composite of its members
# (Recalbox on a .zip): the truth's md5 describes the container and
# can be neither compared with it nor written in its place.
# (Recalbox on a .zip) or as one member's (Batocera's zippedFile, which
# checkInsideZip compares inside the archive): the truth's md5 describes
# the container and can be neither compared with it nor written in its
# place.
composite_md5: bool = False
# Every truth entry of the system that answers to this platform entry's
# name, whichever one the pairing took: the element names its cores, and
@@ -531,7 +533,8 @@ def build_native_model(
destination=destination,
native_system=native_id,
platform=file_entry,
composite_md5=file_entry.get("zip_digest") == "composite",
composite_md5=file_entry.get("zip_digest") == "composite"
or bool(file_entry.get("zipped_file")),
)
)
report.files_kept += 1
+17
View File
@@ -499,6 +499,23 @@ class Reconciliation(unittest.TestCase):
systems, _ = build_native_model({"systems": {}}, scraped)
self.assertEqual(sorted(systems), ["pcengine", "supergrafx"])
def test_a_container_md5_leaves_a_zipped_file_md5_alone(self):
"""Batocera's checkInsideZip compares a zippedFile item's md5 with
the member's. A profile's container md5 was written in its place
and counted as a hash updated to the emulator source."""
scraped = {"systems": {"pc6001": {"native_id": "pc6001", "files": [
{"name": "pc6001.zip", "destination": "pc6001.zip", "md5": "1" * 32,
"zipped_file": "basicrom.60"},
]}}}
truth = {"systems": {"pc6001": {"files": [
{"name": "pc6001.zip", "md5": "2" * 32},
]}}}
systems, report = build_native_model(truth, scraped)
entry = systems["pc6001"].files[0]
self.assertEqual(entry.corrections, [])
self.assertEqual(report.hashes_corrected, [])
self.assertEqual(entry.hashes("md5"), ["1" * 32])
def test_an_addition_joins_the_native_id_its_cores_read(self):
"""RetroDECK's arcade spans mame and fbneo with no primary id. Every
addition went under fbneo, the first sorted, MAME device archives