#!/usr/bin/env python3 """check-upstream.py — every image of every template names where its security notices are published (R-1303). The rule and its reader live in ONE place, `felhom.eu/scripts/security_watch_inventory.py` (the reuse_refs_check.py rule: never copied); the nightly security watch reads the same lines. A template image with no line in its `.felhom.yml` `upstream:` block refuses the push; a `gap:` is allowed (a stated hole, listed in every weekly mail). If the sibling felhom.eu clone is absent this FAILS and names the path it tried — never a skip. USAGE python3 scripts/check-upstream.py [--root=] (the decoy suite judges a scratch catalog) Exit: 0 every image has an upstream · 1 convicted · 2 inconclusive. Decoys: scripts/test_gate_decoys.py `upstream_cases` (COVERS "upstream"). """ import os import subprocess import sys ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) SHARED = os.path.join(os.path.dirname(ROOT), "felhom.eu", "scripts", "security_watch_inventory.py") if __name__ == "__main__": root = ROOT for a in sys.argv[1:]: if a.startswith("--root="): root = a.split("=", 1)[1] shared = os.environ.get("FELHOM_UPSTREAM_GATE", SHARED) if not os.path.isfile(shared): print("FAIL: the shared gate is MISSING beside this clone (tried %s) — a failure, never a skip" % shared) sys.exit(1) sys.exit(subprocess.call([sys.executable, shared, "--gate=catalog", root]))