56 lines
2.3 KiB
Python
56 lines
2.3 KiB
Python
#!/usr/bin/env python3
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
"""Validate the exact Phase-1.0AY private source base selection."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
import hashlib
|
|
import json
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
|
|
def git(repo: Path, *args: str) -> str:
|
|
return subprocess.run(["git", *args], cwd=repo, check=True,
|
|
capture_output=True, text=True).stdout.strip()
|
|
|
|
|
|
def main() -> int:
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("--root", type=Path, required=True)
|
|
parser.add_argument("--retroarch-root", type=Path, required=True)
|
|
args = parser.parse_args()
|
|
root = args.root
|
|
path = root / "manifests/retroarch/phase-1.0ay-target-source-base.json"
|
|
data = json.loads(path.read_text(encoding="utf-8"))
|
|
b = data["source_bindings"]
|
|
ax = root / "manifests/retroarch/phase-1.0ax-canary-protocol-model.json"
|
|
assert hashlib.sha256(ax.read_bytes()).hexdigest() == b["phase10ax_manifest_sha256"]
|
|
assert git(args.retroarch_root, "rev-parse", b["selected_remote_ref"]) == b["selected_retroarch_commit"]
|
|
assert git(args.retroarch_root, "merge-base", b["phase10m_source_commit"],
|
|
b["selected_retroarch_commit"]) == b["phase10m_source_commit"]
|
|
paths = {
|
|
"retroarch_c": "retroarch.c", "sdl2_gfx": "gfx/drivers/sdl2_gfx.c",
|
|
"platform_smoke_c": "frontend/drivers/platform_ps5_smoke.c",
|
|
"platform_smoke_h": "frontend/drivers/platform_ps5_smoke.h",
|
|
"diag_c": "pkg/ps5/chimera_ps5_diag.c",
|
|
"diag_h": "pkg/ps5/chimera_ps5_diag.h",
|
|
"stream_c": "pkg/ps5/chimera_ps5_diag_stream.c",
|
|
"stream_h": "pkg/ps5/chimera_ps5_diag_stream.h",
|
|
"makefile": "Makefile.ps5",
|
|
}
|
|
for prefix, source in paths.items():
|
|
assert git(args.retroarch_root, "rev-parse",
|
|
f'{b["selected_retroarch_commit"]}:{source}') == b[f"{prefix}_blob"]
|
|
assert data["base_selection"]["existing_runner_must_remain_inactive"] is True
|
|
assert data["permitted_patch_scope"]["target_profile"] is False
|
|
assert not any(data["authorizations"].values())
|
|
assert data["decision"]["target_artifact_build_allowed"] is False
|
|
print("Phase-1.0AY target-source base validation passed")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|