[Pkg-privacy-commits] [torbrowser-launcher] 32/48: Parse output of refresh_keys and display nicer output.

Roger Shimizu rosh at moszumanska.debian.org
Mon Sep 4 16:42:34 UTC 2017


This is an automated email from the git hooks/post-receive script.

rosh pushed a commit to branch debian/sid
in repository torbrowser-launcher.

commit 452c99832e8f8e50d7b85c3afd530499285691e2
Author: Dan Snider <dan at dephekt.net>
Date:   Sun Apr 23 18:41:24 2017 -0500

    Parse output of refresh_keys and display nicer output.
---
 torbrowser_launcher/common.py | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/torbrowser_launcher/common.py b/torbrowser_launcher/common.py
index edad35a..6ed1eb5 100644
--- a/torbrowser_launcher/common.py
+++ b/torbrowser_launcher/common.py
@@ -207,6 +207,11 @@ class Common:
         self.import_keys()
 
     def refresh_keyring(self, fingerprint=None):
+        if fingerprint is not None:
+            print('Refreshing local keyring... Missing key: ' + fingerprint)
+        else:
+            print('Refreshing local keyring...')
+
         p = subprocess.Popen(['/usr/bin/gpg', '--status-fd', '2',
                               '--homedir', self.paths['gnupg_homedir'],
                               '--keyserver', 'hkps://hkps.pool.sks-keyservers.net',
@@ -214,13 +219,17 @@ class Common:
                               + ',include-revoked,no-honor-keyserver-url,no-honor-pka-record',
                               '--refresh-keys'], stderr=subprocess.PIPE)
         p.wait()
-        for output in p.stderr.readlines():
-            print(str(output))
 
-        if fingerprint is not None:
-            print('Refreshing local keyring. Missing key: ' + fingerprint)
-        else:
-            print('Refreshing local keyring.')
+        for output in p.stderr.readlines():
+            match = gnupg_import_ok_pattern.match(output)
+            if match and match.group(2) == 'IMPORT_OK':
+                fingerprint = str(match.group(4))
+                if match.group(3) == '0':
+                    print('Keyring refreshed successfully...\n  No key updates for key: ' + fingerprint)
+                elif match.group(3) == '4':
+                    print('Keyring refreshed successfully...\n  New signatures for key: ' + fingerprint)
+                else:
+                    print('Keyring refreshed successfully...')
 
     def import_key_and_check_status(self, key):
         """Import a GnuPG key and check that the operation was successful.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/torbrowser-launcher.git



More information about the Pkg-privacy-commits mailing list