From b20d65d12930be4f339efbe5cfdba00a35e6d971 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Thu, 5 Nov 2026 19:38:21 +0100 Subject: [PATCH] fix: verify only pack archives in the output dir verify_and_finalize_packs took every ZIP of the directory, so the launcher archives build_port.py writes to the same dist/ were judged as packs, failed, and were rewritten with a manifest after build_port had printed their hashes. Every name the builder gives ends in _BIOS_Pack.zip, and only those are taken. --- scripts/generate_pack.py | 6 +++++- tests/test_split_pack.py | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/scripts/generate_pack.py b/scripts/generate_pack.py index 64c026d85..b4b8fd31c 100644 --- a/scripts/generate_pack.py +++ b/scripts/generate_pack.py @@ -5083,11 +5083,15 @@ def _pack_archives(output_dir: str) -> list[str]: A part of a split pack holds a share of a platform by design and was checked against the whole when it was cut: judged as a pack it would fail conformance, and injecting a manifest would change published bytes. + Every name the builder gives ends in the pack suffix: build_port.py + writes its launcher archives (RetroBIOS.zip) to the same dist/, and + taking every ZIP rewrote them with a manifest after build_port had + printed their hashes. """ return sorted( name for name in os.listdir(output_dir) - if name.endswith(".zip") and not split_pack.is_part(name) + if name.endswith(split_pack.PACK_SUFFIX) and not split_pack.is_part(name) ) diff --git a/tests/test_split_pack.py b/tests/test_split_pack.py index 497380d2b..99d54b4fb 100644 --- a/tests/test_split_pack.py +++ b/tests/test_split_pack.py @@ -14,6 +14,8 @@ parts extracted into one folder are the pack. from __future__ import annotations +import contextlib +import io import os import stat import subprocess @@ -230,6 +232,20 @@ class PartsAreNotTakenForPacks(SplitFixture): [p.name for p in parts], ) + def test_launcher_archives_are_not_packs(self): + """build_port.py writes RetroBIOS.zip, RetroBIOS-tools.zip and + RetroBIOS-batocera.zip to dist/: verify_and_finalize_packs judged + them as packs, failed them and injected a manifest into each.""" + for name in ("RetroBIOS.zip", "RetroBIOS-tools.zip", "RetroBIOS-batocera.zip"): + self._build(self.dist / name, {"RetroBIOS.sh": b"#!/bin/sh\n"}) + before = {p.name: p.read_bytes() for p in self.dist.glob("RetroBIOS*.zip")} + self.assertEqual(builder._pack_archives(str(self.dist)), [self.pack.name]) + with contextlib.redirect_stdout(io.StringIO()): + builder.verify_and_finalize_packs(str(self.dist), {"files": {}, "indexes": {}}, + skip_conformance=True) + self.assertEqual({p.name: p.read_bytes() for p in self.dist.glob("RetroBIOS*.zip")}, + before) + def test_the_directory_form_splits_only_what_is_too_large(self): small = self.dist / "Small_BIOS_Pack.zip" self._build(small, {"one.bin": b"1"})