[sysadmin-bin] rpm -qpi output differs from the one-column provided by Fedora, make use of rpmsign -K (verify) inst



commit 3ccb47adec5786cb409e4816709885a330f1c994
Author: Andrea Veri <av gnome org>
Date:   Tue Jun 2 02:13:51 2015 +0200

    rpm -qpi output differs from the one-column provided by Fedora, make use of rpmsign -K (verify) instead.

 rpm-signer.py |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)
---
diff --git a/rpm-signer.py b/rpm-signer.py
index 56c9814..b8de375 100755
--- a/rpm-signer.py
+++ b/rpm-signer.py
@@ -64,18 +64,15 @@ def list_rpm_files_signature():
                         print '  %s - SIGNED' % (os.path.join(reposdir, repo, arch, _file)) + '\n'
 
 def check_valid_signature(package):
-    command = 'rpm -qpi --nosignature %s' % package
+    command = 'rpmsign -K %s' % package
     command = shlex.split(command)
     rpm_qpi = subprocess.Popen(command, stdout=subprocess.PIPE)
     rpm_qpi.wait()
 
-    for line in rpm_qpi.stdout.readlines():
-        splitted_line = line.split('   ')
-        if '\n' or ':' in splitted_line[-1]:
-            fixed_value = splitted_line[-1].replace('\n', '')
-            fixed_value = splitted_line[-1].replace(':', '')
-            if 'none' in fixed_value:
-                return False
+    for line in rpm_qpi.stdout.readlines(13):
+        splitted_line = line.split(' ')
+        if ('NOT' or 'NON') in splitted_line:
+            return False
 
 def sign_rpm(package):
     package = options.package_name
@@ -88,7 +85,7 @@ def sign_rpm(package):
 
     if query_user == 'YES' or 'yes':
 
-        command = 'rpm -D "%%_signature gpg" -D "%%_gpg_name %s" -D "%%__gpg /usr/bin/gpg" --resign %s' % 
(gpgname, package)
+        command = 'rpm -D "%%_signature gpg" -D "%%_gpg_home %s" -D "%%_gpg_name %s" -D "%%__gpg 
/usr/bin/gpg" --resign %s' % (gpghome, gpgname, package)
         command = shlex.split(command)
         sign = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
         sign.wait()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]