From 8e067c1c3aa84add742803ce31f8ec76cc81c5fb Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Sun, 18 Oct 2026 16:21:54 +0200 Subject: [PATCH] fix: name the packs that fail verification --- scripts/generate_pack.py | 7 ++++++- scripts/packextras.py | 3 ++- tests/test_audit_regressions.py | 11 +++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/scripts/generate_pack.py b/scripts/generate_pack.py index 7ae6912e..10d095de 100644 --- a/scripts/generate_pack.py +++ b/scripts/generate_pack.py @@ -2713,7 +2713,6 @@ def _run_platform_packs( print(f"ERROR: no pack for {', '.join(sorted(set(failed)))}") sys.exit(1) if not all_ok: - print("WARNING: some packs have verification errors") sys.exit(1) @@ -4511,6 +4510,7 @@ def verify_and_finalize_packs( if name in expected[pname]: pack_to_platform.setdefault(name, []).append(pname) + failing: list[str] = [] for name in _pack_archives(output_dir): zip_path = os.path.join(output_dir, name) @@ -4526,6 +4526,7 @@ def verify_and_finalize_packs( for err in manifest["errors"]: print(f" ERROR: {err}") all_ok = False + failing.append(name) inject_manifest(zip_path, manifest) # Stage 2: platform conformance (extract + verify) @@ -4569,8 +4570,12 @@ def verify_and_finalize_packs( for err in p_errors: print(f" {err}") all_ok = False + failing.append(f"{name} ({pname})") generate_sha256sums(output_dir) + if failing: + # Named at the end, where a 4,000-line log is read, and on stderr. + print(f"ERROR: packs failed verification: {', '.join(failing)}", file=sys.stderr) return all_ok from packpaths import ( # noqa: E402,F401 diff --git a/scripts/packextras.py b/scripts/packextras.py index 2e1f33bd..c2861bbe 100644 --- a/scripts/packextras.py +++ b/scripts/packextras.py @@ -775,7 +775,8 @@ def _collect_emulator_extras( full_dest = f"{extras_prefix}/{dest}" if extras_prefix else dest if full_dest in seen_dests and full_dest not in taken: continue - # Check file exists in repo or data dirs + # Only files the database indexes: members of a data + # directory are not in it and are not duplicated here. if not ( by_name.get(fname) or by_name.get(dest.rsplit("/", 1)[-1]) diff --git a/tests/test_audit_regressions.py b/tests/test_audit_regressions.py index 44c47600..fd8e81f4 100644 --- a/tests/test_audit_regressions.py +++ b/tests/test_audit_regressions.py @@ -4990,5 +4990,16 @@ class AnAliasNamesItsProfile(unittest.TestCase): self.assertIn(expected, str(caught.exception)) + +class AFailedVerificationIsAnError(unittest.TestCase): + """--all ended on "WARNING: some packs have verification errors" and + exit 1: a warning that fails the run, naming no pack.""" + + def test_the_last_line_names_the_packs(self): + source = (ROOT / "scripts" / "generate_pack.py").read_text() + self.assertNotIn("WARNING: some packs have verification errors", source) + self.assertIn('print(f"ERROR: packs failed verification: {\', \'.join(failing)}", file=sys.stderr)', source) + + if __name__ == "__main__": unittest.main()