public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Brian Dolbec" <dolsen@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoo-keys:master commit in: gkeys/gkeys/
Date: Sun, 31 May 2015 05:03:19 +0000 (UTC)	[thread overview]
Message-ID: <1433027931.8c6da8152ca04b3a1d706abc2bbd57b1cd982e82.dolsen@gentoo> (raw)

commit:     8c6da8152ca04b3a1d706abc2bbd57b1cd982e82
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 21 19:12:22 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat May 30 23:18:51 2015 +0000
URL:        https://gitweb.gentoo.org/proj/gentoo-keys.git/commit/?id=8c6da815

gkeys/actions.py: Refactor installkey to refresh keys that are already installed and unchanged

 gkeys/gkeys/actions.py | 78 +++++++++++++++++++++++++++++---------------------
 1 file changed, 46 insertions(+), 32 deletions(-)

diff --git a/gkeys/gkeys/actions.py b/gkeys/gkeys/actions.py
index 8e078f0..7b834a4 100644
--- a/gkeys/gkeys/actions.py
+++ b/gkeys/gkeys/actions.py
@@ -245,11 +245,11 @@ class Actions(object):
     def installkey(self, args):
         '''Install a key from the seed(s)'''
         self.logger.debug("ACTIONS: installkey; args: %s" % str(args))
-        success, gkey = self.listseed(args)[1]
-        if gkey:
-            if gkey and not args.nick == '*' and self.output:
-                self.output(['', gkey], "\n Found GKEY seeds:")
-            elif gkey and self.output:
+        success, gkeys = self.listseed(args)[1]
+        if gkeys:
+            if gkeys and not args.nick == '*' and self.output:
+                self.output(['', gkeys], "\n Found GKEY seeds:")
+            elif gkeys and self.output:
                 self.output(['all'], "\n Installing seeds:")
             else:
                 self.logger.info("ACTIONS: installkey; "
@@ -269,33 +269,47 @@ class Actions(object):
             self.logger.debug(_unicode("ACTIONS: installkey; catdir = %s")
                 % catdir)
             self.gpg = GkeysGPG(self.config, catdir, self.logger)
-            results = {}
-            failed = []
-            for key in gkey:
-                self.logger.debug("ACTIONS: installkey; adding key:")
-                self.logger.debug("ACTIONS: " + str(key))
-                results[key.name] = self.gpg.add_key(key)
-                for result in results[key.name]:
-                    self.logger.debug("ACTIONS: installkey; result.failed = " +
-                                      str(result.failed))
-                if self.config.options['print_results']:
-                    msg = _unicode("key desired: %(name)s, key added: %(key)s, succeeded:" +\
-                        " %(success)s, fingerprint: %(fpr)s")
-                    for result in results[key.name]:
-                        umsg = msg % ({'name': key.name, 'key': result.username,
-                                'success': str(not result.failed),
-                                'fpr': result.fingerprint})
-                        try:
-                            print(umsg)
-                        except UnicodeDecodeError:
-                            print(_unicode("UnicodeDecodeError printing results for:"), key.name)
-                            self.logger.debug(_unicode("installkey(); UnicodeDecodeError for:") + key.name)
-                            self.logger.debug(_unicode("    result.username...:") + result.username)
-                            self.logger.debug(_unicode("    result.failed.....:") + result.failed)
-                            self.logger.debug(_unicode("    result.fingerprint:") + result.fingerprint)
-                        self.logger.debug("stderr_out: " + str(result.stderr_out))
-                        if result.failed:
-                            failed.append(key)
+            for gkey in gkeys:
+                self.gpg.set_keydir(gkey.keydir, "recv-keys")
+                self.gpg.set_keyseedfile()
+                seeds = self.gpg.seedfile.seeds
+                #print(seeds)
+                if seeds:
+                    self.logger.debug("ACTIONS: installkey; found installed seeds:"
+                        "\n %s" % seeds)
+                results = {}
+                failed = []
+                if gkey.nick in seeds and gkey.keys == seeds[gkey.nick].keys:
+                    self.logger.debug("ACTIONS: installkey; refreshing key:")
+                    if self.config.options['print_results']:
+                        print(_unicode("Refreshing already installed key: %s, %s"
+                            %(gkey.nick, gkey.keys)))
+                    self.gpg.refresh_key(gkey)
+                else:
+                    self.logger.debug("ACTIONS: installkey; adding key:")
+                    self.logger.debug("ACTIONS: " + str(gkey))
+                    results[gkey.name] = self.gpg.add_key(gkey)
+                    for result in results[gkey.name]:
+                        self.logger.debug("ACTIONS: installkey; result.failed = " +
+                                          str(result.failed))
+                    if self.config.options['print_results']:
+                        msg = _unicode("key desired: %(name)s, key added: %(key)s, succeeded:" +\
+                            " %(success)s, fingerprint: %(fpr)s")
+                        for result in results[gkey.name]:
+                            umsg = msg % ({'name': gkey.name, 'key': result.username,
+                                    'success': str(not result.failed),
+                                    'fpr': result.fingerprint})
+                            try:
+                                print(umsg)
+                            except UnicodeDecodeError:
+                                print(_unicode("UnicodeDecodeError printing results for:"), gkey.name)
+                                self.logger.debug(_unicode("installkey(); UnicodeDecodeError for:") + gkey.name)
+                                self.logger.debug(_unicode("    result.username...:") + result.username)
+                                self.logger.debug(_unicode("    result.failed.....:") + result.failed)
+                                self.logger.debug(_unicode("    result.fingerprint:") + result.fingerprint)
+                            self.logger.debug("stderr_out: " + str(result.stderr_out))
+                            if result.failed:
+                                failed.append(gkey)
             if failed and self.output:
                 self.output([failed], "\n Failed to install:")
             if failed:


             reply	other threads:[~2015-05-31  5:03 UTC|newest]

Thread overview: 144+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-31  5:03 Brian Dolbec [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-08-15 16:15 [gentoo-commits] proj/gentoo-keys:master commit in: gkeys/gkeys/ Brian Dolbec
2018-08-15  1:51 Brian Dolbec
2018-08-15  1:05 Brian Dolbec
2018-07-07 15:10 Brian Dolbec
2018-07-07 15:10 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2016-12-24  9:13 [gentoo-commits] proj/gentoo-keys:gsoc-2016 " Brian Dolbec
2016-12-24  0:38 ` [gentoo-commits] proj/gentoo-keys:master " Brian Dolbec
2016-12-24  9:13 [gentoo-commits] proj/gentoo-keys:gsoc-2016 " Brian Dolbec
2016-12-24  0:38 ` [gentoo-commits] proj/gentoo-keys:master " Brian Dolbec
2016-12-24  9:13 [gentoo-commits] proj/gentoo-keys:gsoc-2016 " Brian Dolbec
2016-10-27 18:41 ` [gentoo-commits] proj/gentoo-keys:master " Brian Dolbec
2016-12-24  9:13 [gentoo-commits] proj/gentoo-keys:gsoc-2016 " Brian Dolbec
2016-10-27 21:49 ` [gentoo-commits] proj/gentoo-keys:master " Brian Dolbec
2016-12-24  4:52 Brian Dolbec
2016-06-01 15:16 Brian Dolbec
2016-06-01 15:16 Brian Dolbec
2016-01-23 23:33 Brian Dolbec
2016-01-23 23:33 Brian Dolbec
2016-01-23 19:04 Brian Dolbec
2015-12-25 17:03 Brian Dolbec
2015-12-13  0:51 Brian Dolbec
2015-08-25 14:10 Brian Dolbec
2015-08-25 14:10 Brian Dolbec
2015-08-09 22:52 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-07-25 16:45 Brian Dolbec
2015-07-25 16:45 Brian Dolbec
2015-07-25 16:45 Brian Dolbec
2015-06-22 13:41 Brian Dolbec
2015-06-01  1:56 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-03-18 15:32 Brian Dolbec
2015-03-17 19:51 Brian Dolbec
2015-03-08 15:09 Brian Dolbec
2015-03-06 21:04 Brian Dolbec
2015-02-11 17:37 Brian Dolbec
2015-02-11 17:37 Brian Dolbec
2015-02-11 17:37 Brian Dolbec
2015-02-11 17:37 Brian Dolbec
2015-02-11 17:37 Brian Dolbec
2015-02-11 17:37 Brian Dolbec
2015-02-11 17:37 Brian Dolbec
2015-02-11 17:37 Brian Dolbec
2015-01-09 21:07 Brian Dolbec
2015-01-09 21:07 Brian Dolbec
2015-01-09 21:07 Brian Dolbec
2015-01-09 21:07 Brian Dolbec
2015-01-09 21:07 Brian Dolbec
2015-01-09 21:07 Brian Dolbec
2015-01-09 21:07 Brian Dolbec
2015-01-08  4:13 Brian Dolbec
2015-01-07 23:39 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-01 22:32 Brian Dolbec
2015-01-01 17:44 Brian Dolbec
2015-01-01 17:44 Brian Dolbec
2015-01-01 17:44 Brian Dolbec
2015-01-01 17:44 Brian Dolbec
2015-01-01 17:44 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-26 18:37 Brian Dolbec
2014-12-26 18:37 Brian Dolbec
2014-12-26 18:37 Brian Dolbec
2014-12-26  5:02 Brian Dolbec
2014-12-26  5:02 Brian Dolbec
2014-12-26  5:02 Brian Dolbec
2014-12-25 22:07 Brian Dolbec
2014-12-25 22:07 Brian Dolbec
2014-12-25 20:43 Brian Dolbec
2014-12-25 20:43 Brian Dolbec
2014-12-25 20:43 Brian Dolbec
2014-12-24 19:59 Brian Dolbec
2014-12-24 19:59 Brian Dolbec
2014-12-24 19:59 Brian Dolbec
2014-12-24 19:59 Brian Dolbec
2014-12-24 19:59 Brian Dolbec
2014-12-24 19:59 Brian Dolbec
2014-12-24 19:59 Brian Dolbec
2014-12-24 19:59 Brian Dolbec
2014-12-23  2:50 Brian Dolbec
2014-12-23  2:50 Brian Dolbec
2014-12-23  0:13 Brian Dolbec
2014-12-22 23:11 Brian Dolbec
2014-12-22 23:11 Brian Dolbec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1433027931.8c6da8152ca04b3a1d706abc2bbd57b1cd982e82.dolsen@gentoo \
    --to=dolsen@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox