[Pkg-privacy-commits] [torbrowser-launcher] 21/28: Merge branch 'fix/137' of https://github.com/isislovecruft/torbrowser-launcher into isislovecruft-fix/137

Ulrike Uhlig u-guest at moszumanska.debian.org
Sun Jul 10 21:18:18 UTC 2016


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

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

commit 3dc82e10de3d1f2e6b14a431bc33dca8dad61ce3
Merge: 43a549c b337b3d
Author: Micah Lee <micah at micahflee.com>
Date:   Fri Jul 8 16:33:57 2016 -0700

    Merge branch 'fix/137' of https://github.com/isislovecruft/torbrowser-launcher into isislovecruft-fix/137

 torbrowser_launcher/common.py | 81 ++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 77 insertions(+), 4 deletions(-)

diff --cc torbrowser_launcher/common.py
index 3065503,510706e..92345ea
--- a/torbrowser_launcher/common.py
+++ b/torbrowser_launcher/common.py
@@@ -26,7 -26,7 +26,7 @@@ FROM, OUT OF OR IN CONNECTION WITH THE 
  OTHER DEALINGS IN THE SOFTWARE.
  """
  
- import os, sys, platform, subprocess, locale, pickle, json, psutil
 -import os, sys, platform, subprocess, locale, pickle, psutil, re
++import os, sys, platform, subprocess, locale, pickle, json, psutil, re
  
  import pygtk
  pygtk.require('2.0')
@@@ -135,9 -142,9 +145,11 @@@ class Common
                  },
                  'old_data_dir': old_tbb_data,
                  'tbl_bin': sys.argv[0],
 -                'icon_file': os.path.join(os.path.dirname(SHARE), 'pixmaps/torbrowser80.xpm'),
 +                'icon_file': os.path.join(os.path.dirname(SHARE), 'pixmaps/torbrowser.png'),
                  'torproject_pem': os.path.join(SHARE, 'torproject.pem'),
-                 'signing_keys': [os.path.join(SHARE, 'tor-browser-developers.asc')],
 -                'erinn_key': os.path.join(SHARE, 'erinn.asc'),
++                'signing_keys': {
++                    'tor_browser_developers': os.path.join(SHARE, 'tor-browser-developers.asc')
++                },
                  'mirrors_txt': [os.path.join(SHARE, 'mirrors.txt'),
                                  tbb_config+'/mirrors.txt'],
                  'modem_sound': os.path.join(SHARE, 'modem.ogg'),
@@@ -155,6 -160,12 +167,11 @@@
                  },
              }
  
 -        self.fingerprints = {}
 -
+         # Add the expected fingerprint for imported keys:
 -        if self.paths['erinn_key']:
 -            self.fingerprints['erinn_key'] = '8738A680B84B3031A630F2DB416F061063FEE659'
++        self.fingerprints = {
++            'tor_browser_developers': 'EF6E286DDA85EA2A4BA7DE684E2C6E8793298290'
++        }
+ 
      # create a directory
      @staticmethod
      def mkdir(path):
@@@ -177,10 -188,59 +194,66 @@@
              self.mkdir(self.paths['gnupg_homedir'])
          self.import_keys()
  
+     def import_key_and_check_status(self, key):
+         """Import a GnuPG key and check that the operation was successful.
+ 
+         :param str key: A string specifying the key's filepath from
+             ``Common.paths``, as well as its fingerprint in
+             ``Common.fingerprints``.
+         :rtype: bool
+         :returns: ``True`` if the key is now within the keyring (or was
+             previously and hasn't changed). ``False`` otherwise.
+         """
+         success = False
+ 
+         p = subprocess.Popen(['/usr/bin/gpg', '--status-fd', '2',
+                               '--homedir', self.paths['gnupg_homedir'],
 -                              '--import', self.paths[key]],
++                              '--import', self.paths['signing_keys'][key]],
+                              stderr=subprocess.PIPE)
+         p.wait()
+ 
+         output = p.stderr.read()
++        print "---output begin---\n{}\n---output end---".format(output)
+         match = gnupg_import_ok_pattern.match(output)
+         if match:
+             # The output must match everything in the
+             # ``gnupg_import_ok_pattern``, as well as the expected fingerprint:
+             if match.group().find(self.fingerprints[key]) >= 0:
+                 success = True
+ 
+         return success
+ 
      # import gpg keys
      def import_keys(self):
-         for key in self.paths['signing_keys']:
-             subprocess.Popen(['/usr/bin/gpg', '--quiet', '--homedir', self.paths['gnupg_homedir'], '--import', key]).wait()
+         """Import all GnuPG keys.
+ 
+         :rtype: bool
+         :returns: ``True`` if all keys were successfully imported; ``False``
+             otherwise.
+         """
 -        keys = ['erinn_key',]
++
++        # run "gpg --list-keys" first, to create an empty keyring before importing
++        #subprocess.call(['/usr/bin/gpg',
++        #    '--homedir', self.paths['gnupg_homedir'],
++        #    '--list-secret-keys'])
++
++        keys = ['tor_browser_developers',]
+         all_imports_succeeded = True
+ 
+         print _('Importing keys')
+         for key in keys:
+             imported = self.import_key_and_check_status(key)
+             if not imported:
+                 print _('Could not import key with fingerprint: %s.'
+                         % self.fingerprints[key])
+                 all_imports_succeeded = False
+ 
+         if all_imports_succeeded:
+             print _('Successfully imported all keys.')
+         else:
+             print _('Not all keys were imported successfully!')
+ 
+         return all_imports_succeeded
  
      # load mirrors
      def load_mirrors(self):

-- 
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