From b9746bfa320cdd1464eb6c91fbadad35c84d2459 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Sun, 9 Aug 2026 15:03:34 +0200 Subject: Harden build workflows and OBS selection Add preflight, cancellation, confined status, and timeout handling for local Sailfish and remote Android build jobs. Vendor helper 2.0.0 with explicit backend/pull controls, build locking, local RPM validation, metadata, and structured failure reporting. Expose named internal, partner, and community OBS servers while retaining raw osc API aliases. --- scripts/update_build_helper.py | 66 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 scripts/update_build_helper.py (limited to 'scripts/update_build_helper.py') diff --git a/scripts/update_build_helper.py b/scripts/update_build_helper.py new file mode 100644 index 0000000..c9436a1 --- /dev/null +++ b/scripts/update_build_helper.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python3 + +import argparse +import importlib.util +import os +from pathlib import Path +import py_compile +import shutil +import tempfile + + +DESTINATION = ( + Path(__file__).resolve().parents[1] + / "src" + / "sailfish_devel_mcp" + / "vendor" + / "build_sailfishos.py" +) + + +def helper_version(path: Path) -> str: + spec = importlib.util.spec_from_file_location("candidate_build_sailfishos", path) + if spec is None or spec.loader is None: + raise RuntimeError(f"could not load helper: {path}") + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + version = getattr(module, "HELPER_VERSION", None) + if not isinstance(version, str) or not version: + raise RuntimeError(f"helper has no HELPER_VERSION: {path}") + return version + + +def main() -> int: + parser = argparse.ArgumentParser(description="Update the vendored build-sailfishos helper") + parser.add_argument("source", type=Path, help="Canonical build_sailfishos.py") + args = parser.parse_args() + + source = args.source.expanduser().resolve() + if not source.is_file(): + parser.error(f"source helper not found: {source}") + version = helper_version(source) + py_compile.compile(str(source), doraise=True) + + DESTINATION.parent.mkdir(parents=True, exist_ok=True) + descriptor, temporary_name = tempfile.mkstemp( + prefix=f".{DESTINATION.name}.", + suffix=".tmp", + dir=DESTINATION.parent, + ) + os.close(descriptor) + temporary = Path(temporary_name) + try: + shutil.copyfile(source, temporary) + temporary.chmod(0o755 if source.stat().st_mode & 0o111 else 0o644) + os.replace(temporary, DESTINATION) + finally: + try: + temporary.unlink() + except FileNotFoundError: + pass + print(f"vendored build helper {version}: {DESTINATION}") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) -- cgit v1.2.3