]> git.pld-linux.org Git - projects/pld-ftp-admin.git/blobdiff - modules/sign.py
- reset file perms after signing, rpm5 leaves them with 0600
[projects/pld-ftp-admin.git] / modules / sign.py
index 153ec67ea32a996d04f53edbdbbb6417524efa42..522af24699b91970b70af62a5fa5d73b0c207413 100644 (file)
@@ -4,7 +4,6 @@
 import os
 import sys
 import rpm
-import subprocess
 import pexpect
 from config import sign_key
 
@@ -17,7 +16,7 @@ def getSigInfo(hdr):
     siginfo = hdr.sprintf(string)
     if siginfo == '(none)':
         return None
-   
+
     return siginfo.split(',')[2].lstrip()
 
 def is_signed(rpm_file):
@@ -28,7 +27,6 @@ def is_signed(rpm_file):
         return None
 
     ts = rpm.ts()
-    ts.setVSFlags(rpm._RPMVSF_NOSIGNATURES)
     fdno = os.open(rpm_file, os.O_RDONLY)
     hdr = ts.hdrFromFdno(fdno)
     os.close(fdno)
@@ -48,13 +46,13 @@ def signpkgs(files, password):
     os.putenv('LC_ALL', 'C')
     args = ['--resign', '--define', '_signature gpg', '--define', '_gpg_name ' + sign_key] + files
     child = pexpect.spawn('/bin/rpm', args)
-    child.logfile = sys.stderr
+    child.logfile_read = sys.stderr
     child.expect('Enter pass phrase:', timeout=30)
     child.sendline(password)
-    child.expect(pexpect.EOF)
+    child.expect(pexpect.EOF, timeout=None)
     child.close()
     rc = child.exitstatus
-    #cmd = ['/bin/rpm', '--resign', '--define', '_signature gpg', '--define', '_gpg_name ' + sign_key] + files
-    #rc = subprocess.call(cmd, stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE, close_fds = True)
     if rc != 0:
         raise OSError, 'package signing failed'
+    for rpm in files:
+        os.chmod(rpm, 0644)
This page took 0.029443 seconds and 4 git commands to generate.