#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-3.0-or-later """Prove that an unreviewed minimal PS5 startup cannot enter the build graph.""" from __future__ import annotations import argparse import subprocess import tempfile from pathlib import Path def main() -> int: parser = argparse.ArgumentParser() parser.add_argument("--root", type=Path, required=True) parser.add_argument("--cmake", type=Path, required=True) parser.add_argument("--compiler", type=Path, required=True) args = parser.parse_args() with tempfile.TemporaryDirectory() as directory: result = subprocess.run( [ str(args.cmake), "-S", str(args.root.resolve()), "-B", directory, "-G", "Ninja", f"-DCMAKE_C_COMPILER={args.compiler}", "-DBUILD_TESTING=OFF", "-DCHIMERA_GFX_BUILD_PS5_MINIMAL_STARTUP=ON", ], check=False, capture_output=True, text=True, ) output = result.stdout + result.stderr if result.returncode == 0: raise RuntimeError("minimal startup configure unexpectedly succeeded") required = ( "BLOCKED", "no pinned public loader caller", "no minimal PS5 ELF may be built", ) if any(snippet not in output for snippet in required): raise RuntimeError(f"configure failed without the policy reason:\n{output}") print("minimal PS5 startup build remains fail-closed") return 0 if __name__ == "__main__": raise SystemExit(main())