refactor: build platform packs without printing

build_platform_pack and build_split_packs return what the build came to and print nothing. print_platform_pack holds the report lines, and generate_pack and generate_split_packs compose the two. The variant choice, the plan and the data directory pass return their notices instead of printing them. The callers that silenced stdout to get a record now call the builder.
This commit is contained in:
Abdessamad Derraz committed 2026-11-22 02:26:45 +01:00
1 parent 977d3f6874
commit d8570c6480
15 files changed
+295 -205

No files matched your search

+9 -11
View File
@@ -26,7 +26,7 @@ import yaml
from model.profiles import emulator_profiles_cache
from model.platforms import load_platform_config
from packs.platformpack import generate_pack
from packs.platformpack import build_platform_pack, generate_pack
from packs.coverage import verify_platform
REPO_ROOT = Path(__file__).resolve().parents[1]
@@ -83,11 +83,10 @@ class ACoreFileFillsAFreeDeclaration(unittest.TestCase):
self.config, self.db, str(self.emulators),
)
out = self.root / "out"
with redirect_stdout(io.StringIO()):
zip_path = generate_pack(
"fakeplat", str(self.platforms), self.db, str(self.root / "bios"),
str(out), emulators_dir=str(self.emulators), offline=True,
)
zip_path = build_platform_pack(
"fakeplat", str(self.platforms), self.db, str(self.root / "bios"),
str(out), emulators_dir=str(self.emulators), offline=True,
).zip_path
with zipfile.ZipFile(zip_path) as zf:
self.assertIn("zzz_absent.bin", zf.namelist())
self.assertEqual(result["status_counts"], {"ok": 1})
@@ -133,11 +132,10 @@ class AFileDeclaredUnderAnotherName(unittest.TestCase):
}))
config = load_platform_config("fakeplat", str(root / "platforms"))
result = verify_platform(config, db, str(root / "emulators"))
with redirect_stdout(io.StringIO()):
zip_path = generate_pack(
"fakeplat", str(root / "platforms"), db, str(root / "bios"),
str(root / "out"), emulators_dir=str(root / "emulators"), offline=True,
)
zip_path = build_platform_pack(
"fakeplat", str(root / "platforms"), db, str(root / "bios"),
str(root / "out"), emulators_dir=str(root / "emulators"), offline=True,
).zip_path
with zipfile.ZipFile(zip_path) as zf:
self.assertIn("gs/ROM", zf.namelist())
reported = [(u["name"], u["in_repo"]) for u in result["undeclared_files"]]