🔒 Repository is read-only – file editing is disabled.

PaganLinux/tmp-crit-list.py main

53 linii Raw ← Powrót
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
#!/usr/bin/env python3
"""Inwentaryzacja sum kontrolnych dla pakietow krytycznych."""
import os, 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"]

found = {}
for dp, _d, fs in os.walk(R):
    if "PAGBUILD.yaml" not in fs:
        continue
    p = os.path.join(dp, "PAGBUILD.yaml")
    try:
        d = yaml.safe_load(open(p, encoding="utf-8")) or {}
    except Exception:
        continue
    n = d.get("pkgname")
    if n in CRIT and n not in found:
        sums = d.get("sha256sums") or []
        if not isinstance(sums, list):
            sums = [sums]
        srcs = d.get("source") or []
        if not isinstance(srcs, list):
            srcs = [srcs]
        skip = sum(1 for s in sums if str(s).strip().upper().startswith("SKIP"))
        found[n] = (p, d.get("pkgver"), skip, len(sums), srcs)

miss = [c for c in CRIT if c not in found]
print("krytyczne z receptura:", len(found), "| bez receptury:", miss)
print()
print("--- MAJA SKIP (do uzupelnienia) ---")
urls = 0
for n, (p, v, skip, nsum, srcs) in sorted(found.items()):
    if skip:
        rel = p[len(R) + 1:]
        print(f"{n:16s} {str(v):12s} SKIP={skip}/{nsum}  {rel}")
        for s in srcs:
            s = str(s)
            if s.startswith(("http://", "https://", "ftp://", "git://")):
                urls += 1
print()
print("--- MAJA REALNE SUMY ---")
for n, (p, v, skip, nsum, srcs) in sorted(found.items()):
    if not skip:
        print(f"{n:16s} {str(v):12s} {nsum} sum")
print()
print("URL-i do pobrania i zahashowania:", urls)