Files
govoplan/tools/release/prepare-developer-meta-package.py
T
zemion 58d320d9b3
Dependency Audit / dependency-audit (push) Successful in 1m51s
Deployment Installer / deployment-installer (push) Successful in 8s
Security Audit / security-audit (push) Successful in 12m32s
Harden source release preparation and record verified security follow-up
2026-09-08 08:04:12 +02:00

52 lines
1.7 KiB
Python

#!/usr/bin/env python3
"""Preview or explicitly prepare Meta outside a durable release run."""
from __future__ import annotations
import argparse
import json
from pathlib import Path
from govoplan_release.meta_preparation import (
MetaPreparationAmbiguous,
MetaPreparationError,
_read_input,
prepare_developer_meta_package,
)
def main() -> int:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--workspace", type=Path, required=True)
parser.add_argument("--target-version", required=True)
parser.add_argument("--apply", action="store_true")
parser.add_argument("--receipt", type=Path)
parser.add_argument("--confirm-out-of-run", action="store_true")
args = parser.parse_args()
try:
expected = None
if args.apply:
if args.receipt is None:
raise MetaPreparationError(
"Apply requires the reviewed preview JSON via --receipt."
)
payload, _ = _read_input(args.receipt)
expected = json.loads(payload)["receipt"]
result = prepare_developer_meta_package(
repo_path=args.workspace.absolute() / "govoplan",
target_version=args.target_version,
apply=args.apply,
expected_receipt=expected,
confirm_out_of_run=args.confirm_out_of_run,
)
except (MetaPreparationError, OSError, ValueError, KeyError, TypeError) as exc:
status = "needs-reconciliation" if isinstance(exc, MetaPreparationAmbiguous) else "blocked"
print(json.dumps({"status": status, "detail": str(exc)}))
return 1
print(json.dumps(result, indent=2))
return 0
if __name__ == "__main__":
raise SystemExit(main())