fix: align verify and pack validation, pipeline 100% consistent

generate_pack.py now applies emulator-level validation (crc32, sha1,
adler32) matching verify.py behavior. existence mode: validation is
informational (file present = OK). md5 mode: validation downgrades
to UNTESTED. clone resolution moved to common.py resolve_local_file.
all 6 platforms pass consistency check.
This commit is contained in:
Abdessamad Derraz
2026-03-24 22:21:47 +01:00
parent ae4846550f
commit 94000bdaef
3 changed files with 25 additions and 3 deletions

View File

@@ -255,6 +255,12 @@ def generate_pack(
file_status: dict[str, str] = {}
file_reasons: dict[str, str] = {}
# Build emulator-level validation index (same as verify.py)
from verify import _build_validation_index
validation_index = {}
if emu_profiles:
validation_index = _build_validation_index(emu_profiles)
with zipfile.ZipFile(zip_path, "w", zipfile.ZIP_DEFLATED) as zf:
for sys_id, system in sorted(config.get("systems", {}).items()):
for file_entry in system.get("files", []):
@@ -356,6 +362,22 @@ def generate_pack(
else:
file_status.setdefault(dedup_key, "ok")
# Emulator-level validation (matches verify.py behavior)
# In existence mode: validation is informational (warning, not downgrade)
# In md5 mode: validation downgrades OK to UNTESTED
if (file_status.get(dedup_key) == "ok"
and local_path and validation_index):
from verify import check_file_validation
fname = file_entry.get("name", "")
reason = check_file_validation(local_path, fname, validation_index)
if reason:
if verification_mode == "existence":
# Existence mode: file present = OK, validation is extra info
file_reasons.setdefault(dedup_key, reason)
else:
file_status[dedup_key] = "untested"
file_reasons[dedup_key] = reason
if already_packed:
continue
seen_destinations.add(dedup_key)