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.
This commit is contained in:
Abdessamad Derraz committed 2026-11-05 19:38:21 +01:00
1 parent 0d21566183
commit b20d65d129
2 files changed
+21 -1

No files matched your search

+5 -1
View File
@@ -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)
)
+16
View File
@@ -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"})