fix: accept RomM files on size and any hash

RomM's verify_file_hashes compares the size, then md5, sha1 or crc. We
compared md5 alone, so a fixture entry with one mistyped hash was left out
of the pack RomM would accept it from. The rule is declared in romm.yml
and read by verify, the builder and the manifest.
This commit is contained in:
Abdessamad Derraz committed 2026-10-18 07:24:33 +02:00
1 parent 731faee6e1
commit ae3dc63bc3
10 files changed
+182 -20

No files matched your search

+6
View File
@@ -34,6 +34,12 @@ MODES = ("existence", "md5", "sha1")
MODE_DIGEST = {"md5": "md5", "sha1": "sha1"}
#: A frontend that accepts a file on its size and any one declared hash.
#: RomM's Firmware.verify_file_hashes: size first, then md5, sha1 or crc.
SIZE_AND_ANY_HASH = "size_and_any_hash"
HASH_RULES = (SIZE_AND_ANY_HASH,)
def normalize(mode: str | None) -> str:
"""Return a declared mode, falling back to the schema default."""
return mode if mode in MODES else DEFAULT_MODE