[projects/pld-ftp-admin] pfa-signpkg: check the signatures in parallel

arekm arekm at pld-linux.org
Thu Oct 29 09:18:01 CET 2026


commit dac3504b0948293509f426e989fbe8bde69ef14b
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Wed Oct 28 21:49:07 2026 +0100

    pfa-signpkg: check the signatures in parallel
    
    Before signing, pfa-signpkg read the header of each file in turn, with
    a new rpm transaction set per file: 16 s for 6020 files here, minutes
    for a whole tree.  It now reads them with read_rpms(), the parallel read
    of the move checks: 0.5 s.  A missing file no longer stops the check
    with a traceback: it counts as not signed, the other files are signed,
    and rpm reports the missing one.

 bin/pfa-signpkg | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/bin/pfa-signpkg b/bin/pfa-signpkg
index 5778b6e..cc40fbe 100755
--- a/bin/pfa-signpkg
+++ b/bin/pfa-signpkg
@@ -3,6 +3,7 @@
 
 import argparse
 import getpass
+import itertools
 import os
 import sys
 
@@ -20,7 +21,7 @@ import ftpio
 import ftptree
 from common import checkdir
 from config import sign_key
-from sign import is_signed, signpkgs
+from sign import signpkgs
 
 os.umask(0o022)
 
@@ -55,8 +56,12 @@ finally:
 print(f"Checking signatures of {len(files)} files from {len(tree.loadedpkgs)} packages")
 sign = []
 c = 0
-for n, file in enumerate(files, 1):
-    if force_resign or not is_signed(file):
+# -f signs every file again, so none is read
+infos = itertools.repeat(None, len(files)) if force_resign else ftptree.read_rpms(files)
+# strict takes the end of read_rpms() too, which stops its pool before the signing
+for n, (file, info) in enumerate(zip(files, infos, strict=True), 1):
+    # a missing file counts as not signed too: signing it fails
+    if info is None or not info.signed:
         sign.append(file)
         c += 1
     print(f"\r{n}/{c} {file}\033[0K", end='')
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/pld-ftp-admin.git/commitdiff/16c6c5f2d4269aef64813afc632c36b5ce242afa



More information about the pld-cvs-commit mailing list