67 lines
3.0 KiB
Python
67 lines
3.0 KiB
Python
#!/usr/bin/env python3
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
"""Validate the local, host-only Phase-1.0AZ RetroArch source commit."""
|
|
|
|
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()
|
|
path = args.root / "manifests/retroarch/phase-1.0az-host-av-source.json"
|
|
data = json.loads(path.read_text(encoding="utf-8"))
|
|
binding = data["source_bindings"]
|
|
ay = args.root / "manifests/retroarch/phase-1.0ay-target-source-base.json"
|
|
assert hashlib.sha256(ay.read_bytes()).hexdigest() == binding["phase10ay_manifest_sha256"]
|
|
commit = binding["retroarch_local_commit"]
|
|
assert git(args.retroarch_root, "rev-parse", "HEAD") == commit
|
|
assert git(args.retroarch_root, "rev-parse", binding["verified_remote_ref"]) == commit
|
|
assert git(args.retroarch_root, "rev-parse", f"{commit}^") == binding["retroarch_base_commit"]
|
|
expected = {
|
|
"Makefile.ps5", "docs/ps5-phase10az-host-av-source.md",
|
|
"frontend/drivers/platform_ps5_smoke.c",
|
|
"frontend/drivers/platform_ps5_smoke.h", "pkg/ps5/chimera_ps5_diag.c",
|
|
"pkg/ps5/chimera_ps5_diag.h", "pkg/ps5/chimera_ps5_diag_stream.c",
|
|
"tests/chimera_ps5_av_diag_test.c",
|
|
}
|
|
assert set(git(args.retroarch_root, "show", "--format=", "--name-only", commit).splitlines()) == expected
|
|
blobs = {
|
|
"makefile": "Makefile.ps5",
|
|
"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",
|
|
"host_test": "tests/chimera_ps5_av_diag_test.c",
|
|
"source_doc": "docs/ps5-phase10az-host-av-source.md",
|
|
}
|
|
for key, source in blobs.items():
|
|
assert git(args.retroarch_root, "rev-parse", f"{commit}:{source}") == binding[f"{key}_blob"]
|
|
makefile = git(args.retroarch_root, "show", f"{commit}:Makefile.ps5")
|
|
assert makefile.count("-DCHIMERA_PS5_AV_DIAG=1") == 1
|
|
assert "PS5_PROFILE=av" not in makefile and "retroarch_ps5_av" not in makefile
|
|
assert git(args.retroarch_root, "diff", "--quiet", f'{binding["retroarch_base_commit"]}', commit, "--", "retroarch.c") == ""
|
|
assert binding["remote_push_verified"] is True
|
|
assert not any(data["authorizations"].values())
|
|
assert data["decision"]["target_profile_reassessment_allowed"] is True
|
|
assert data["decision"]["target_artifact_build_allowed"] is False
|
|
print("Phase-1.0AZ host-only source validation passed")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|