[projects/pld-ftp-admin] sign: remove a signature file left by an interrupted signing

arekm arekm at pld-linux.org
Thu Oct 29 09:17:35 CET 2026


commit 6e0eca79703caf717c4a8c8607c353c292bcbeb1
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Wed Oct 28 23:15:55 2026 +0100

    sign: remove a signature file left by an interrupted signing
    
    rpm has gpg write each signature to <package>.sig, and removes it once
    read, or when gpg fails. A signing interrupted by Ctrl-C or a lost
    session can leave one behind. On the next run gpg asked "File '….sig'
    exists. Overwrite? (y/N)", which pfa-signpkg, talking to rpm through
    pexpect, could not answer: it waited for ever.
    
    The leftover file is now removed, with a warning, before rpm runs.

 modules/sign.py | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/modules/sign.py b/modules/sign.py
index 9142721..59f21ac 100644
--- a/modules/sign.py
+++ b/modules/sign.py
@@ -66,6 +66,15 @@ def signpkgs(files, password, force=False):
     if not os.path.isfile('/bin/rpm'):
         raise OSError('Missing rpm binary')
 
+    for rpmfile in files:
+        # rpm has gpg write the signature to <file>.sig; one left by an interrupted signing makes gpg ask to overwrite it
+        try:
+            os.remove(rpmfile + '.sig')
+        except FileNotFoundError:
+            pass
+        else:
+            print(f'WARN: removed {rpmfile}.sig, left by an interrupted signing', file=sys.stderr)
+
     os.putenv('LC_ALL', 'C')
     args = ['--verbose', '--define', '_signature gpg', '--define', '_gpg_name ' + sign_key] + files
     if force:
================================================================

---- gitweb:

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



More information about the pld-cvs-commit mailing list