🔒 Repository is read-only – file editing is disabled.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
#!/usr/bin/env python3
"""Ktore receptury krytyczne maja jeszcze SKIP w sha256sums.
Te buildy zostana zablokowane przez pagbuild (CRITICAL_PKGS_SUMS).
"""
import os
import yaml
R = "/var/lib/pagan-sync/recipes"
CRIT = ("glibc gcc binutils openssl gnutls nettle sudo shadow pam systemd dbus bash coreutils "
"util-linux curl wget gnupg libgcrypt libgpg-error libassuan libksba libxcrypt make-ca "
"openssh polkit seatd kernel kernel-lts kernel-mainline libcap e2fsprogs procps-ng python "
"perl zlib xz tar libarchive pcre2 expat iproute2 kmod elfutils attr acl gzip bzip2 less "
"sed grep findutils gawk").split()
found = {}
for dp, _d, fs in os.walk(R):
if ".git" in dp or "PAGBUILD.yaml" not in fs:
continue
p = os.path.join(dp, "PAGBUILD.yaml")
rel = os.path.relpath(p, R)
try:
d = yaml.safe_load(open(p, newline="", encoding="utf-8")) or {}
except Exception:
continue
name = d.get("pkgname")
if name not in CRIT:
continue
s = d.get("sha256sums") or []
if not isinstance(s, list):
s = [s]
skips = sum(1 for x in s if str(x).strip().upper().startswith("SKIP"))
srcs = d.get("source") or []
if not isinstance(srcs, list):
srcs = [srcs]
found.setdefault(name, []).append((rel, skips, len(srcs)))
print("=== receptury krytyczne z SKIP (build zostanie zablokowany) ===")
blocked = 0
for name in CRIT:
for rel, skips, n in found.get(name, []):
if skips:
blocked += 1
d = yaml.safe_load(open(f"{R}/{rel}", newline="", encoding="utf-8"))
s = d.get("sha256sums") or []
s = s if isinstance(s, list) else [s]
srcs = d.get("source") or []
srcs = srcs if isinstance(srcs, list) else [srcs]
print(f"\n {rel} ({skips}/{n} SKIP)")
for a, b in zip(srcs, s):
mark = "SKIP" if str(b).strip().upper().startswith("SKIP") else "ok "
print(f" [{mark}] {a}")
print(f"\nzablokowanych receptur krytycznych: {blocked}")
missing = [n for n in CRIT if n not in found]
print(f"krytycznych bez receptury w repo: {missing if missing else 'brak'}")
ok = [n for n in CRIT if n in found and all(sk == 0 for _, sk, _ in found[n])]
print(f"krytycznych z kompletnymi sumami: {len(ok)}/{len(CRIT)}")