public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Brian Dolbec" <brian.dolbec@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoo-keys:master commit in: gkeys/
Date: Mon, 10 Dec 2012 04:56:54 +0000 (UTC)	[thread overview]
Message-ID: <1355115368.ba85abe6630b8735459506ef210b4361c819174c.dol-sen@gentoo> (raw)

commit:     ba85abe6630b8735459506ef210b4361c819174c
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 10 04:56:08 2012 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Dec 10 04:56:08 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-keys.git;a=commit;h=ba85abe6

add moveseed functionality.

---
 gkeys/cli.py |   45 +++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/gkeys/cli.py b/gkeys/cli.py
index c3d0fd8..b000f58 100644
--- a/gkeys/cli.py
+++ b/gkeys/cli.py
@@ -68,6 +68,8 @@ class Main(object):
         # options
         parser.add_argument('-c', '--config', dest='config', default=None,
             help='The path to an alternate config file')
+        parser.add_argument('-d', '--dest', dest='destination', default=None,
+            help='The destination seed file or keyring for move, copy operations')
         parser.add_argument('-f', '--fingerprint', dest='fingerprint', default=None,
             help='The fingerprint of the the key')
         parser.add_argument('-n', '--name', dest='name', default=None,
@@ -78,10 +80,10 @@ class Main(object):
             help='The longkeyid of the the key')
         parser.add_argument('-r', '--keyring',
             choices=['release', 'dev', 'overlays'], dest='keyring', default=None,
-            help='The keyring to use')
+            help='The keyring to use or update')
         parser.add_argument('-s', '--seeds',
             choices=['release', 'dev'], dest='seeds', default=None,
-            help='The seeds file to update')
+            help='The seeds file to use or update')
         parser.add_argument('-S', '--seedfile', dest='seedfile', default=None,
             help='The seedfile path to use')
 
@@ -106,6 +108,7 @@ class Main(object):
         func = getattr(self, '_action_%s' % args.action)
         logger.debug('Found action: %s' % args.action)
         results = func(args)
+        # super simple output for the time being
         if self.print_results:
             print('\n\nGkey results:')
             print("\n".join([str(x) for x in results]))
@@ -182,7 +185,7 @@ class Main(object):
         seeds = self._load_seeds(args.seeds)
         gkeys = self._action_listseed(args)
         if len(gkeys) == 1:
-            logger.debug("_action_removekey(); now deleting gkey: %s" % str(gkeys[0]))
+            logger.debug("_action_removeseed(); now deleting gkey: %s" % str(gkeys[0]))
             success = seeds.delete(gkeys[0])
             if success:
                 success = seeds.save()
@@ -198,7 +201,41 @@ class Main(object):
 
     def _action_moveseed(self, args):
         '''Action moveseed method'''
-        pass
+        parts = self.build_gkeylist(args)
+        searchkey = GKEY._make(parts)
+        logger.debug("_action_moveseed(); gkey: %s" % str(searchkey))
+        seeds = self._load_seeds(args.seeds)
+        kwargs = self.build_gkeydict(args)
+        sourcekeys = seeds.list(**kwargs)
+        dest = self._load_seeds(args.destination)
+        destkeys = dest.list(**kwargs)
+        messages = []
+        if len(sourcekeys) == 1 and destkeys == []:
+            logger.debug("_action_moveseed(); now adding destination gkey: %s"
+                % str(sourcekeys[0]))
+            success = dest.add(sourcekeys[0])
+            logger.debug("_action_moveseed(); success: %s" %str(success))
+            logger.debug("_action_moveseed(); now deleting sourcekey: %s" % str(sourcekeys[0]))
+            success = seeds.delete(sourcekeys[0])
+            if success:
+                success = dest.save()
+                logger.debug("_action_moveseed(); destination saved... %s" %str(success))
+                success = seeds.save()
+            messages.extend(["Successfully Moved %s seed: %s"
+                % (args.seeds, str(success)), sourcekeys[0]])
+            return messages
+        elif len(sourcekeys):
+            messages = ["Too many seeds found to remove"]
+            messages.extend(sourcekeys)
+            return messages
+        messages.append("Failed to Move seed:")
+        messages.append(searchkey)
+        messages.append('\n')
+        messages.append("Source seeds found...")
+        messages.extend(sourcekeys or ["None\n"])
+        messages.append("Destination seeds found...")
+        messages.extend(destkeys or ["None\n"])
+        return messages
 
 
     def _action_listkey(self, args):


             reply	other threads:[~2012-12-10  4:57 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-10  4:56 Brian Dolbec [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-06-01 15:16 [gentoo-commits] proj/gentoo-keys:master commit in: gkeys/ Brian Dolbec
2015-08-09  3:44 Robin H. Johnson
2014-12-24 20:05 Brian Dolbec
2014-12-24 19:59 Brian Dolbec
2014-12-22 23:11 Brian Dolbec
2014-12-22 23:11 Brian Dolbec
2014-12-22 23:11 Brian Dolbec
2014-12-22 23:11 Brian Dolbec
2014-12-22 23:11 Brian Dolbec
2014-12-22 23:11 Brian Dolbec
2014-12-22 23:11 Brian Dolbec
2014-12-22 23:11 Brian Dolbec
2014-12-22 23:11 Brian Dolbec
2014-12-22 23:11 Brian Dolbec
2014-12-22 23:11 Brian Dolbec
2014-12-22 23:11 Brian Dolbec
2014-12-22 23:11 Brian Dolbec
2014-12-22 23:11 Brian Dolbec
2014-08-20  3:55 Brian Dolbec
2014-08-20  3:55 Brian Dolbec
2014-08-20  3:55 Brian Dolbec
2014-08-20  3:55 Brian Dolbec
2014-08-20  3:55 Brian Dolbec
2014-08-20  3:55 Brian Dolbec
2014-08-20  3:55 Brian Dolbec
2014-08-20  3:55 Brian Dolbec
2014-08-20  3:55 Brian Dolbec
2014-08-20  3:55 Brian Dolbec
2014-08-20  3:55 Brian Dolbec
2014-08-20  3:55 Brian Dolbec
2014-08-20  3:55 Brian Dolbec
2014-06-01 15:25 Brian Dolbec
2014-06-01 15:25 Brian Dolbec
2014-06-01 15:25 Brian Dolbec
2014-05-28  2:21 Brian Dolbec
2014-05-28  2:21 Brian Dolbec
2014-05-27 20:56 Brian Dolbec
2014-05-27 20:56 Brian Dolbec
2014-05-27 20:56 Brian Dolbec
2014-05-27 20:56 Brian Dolbec
2014-05-27 20:56 Brian Dolbec
2014-05-27 20:56 Brian Dolbec
2014-05-27 20:56 Brian Dolbec
2014-05-17 18:13 Brian Dolbec
2014-03-01 17:50 Pavlos Ratis
2014-03-01 17:50 Pavlos Ratis
2014-03-01 17:49 Pavlos Ratis
2014-03-01  0:07 Brian Dolbec
2014-02-28 23:56 Brian Dolbec
2014-02-28 20:21 Brian Dolbec
2013-11-17  7:39 Brian Dolbec
2013-11-17  7:39 Brian Dolbec
2013-11-17  7:39 Brian Dolbec
2013-11-17  7:39 Brian Dolbec
2013-11-17  7:39 Brian Dolbec
2013-11-15  9:16 Brian Dolbec
2013-07-16  0:50 Brian Dolbec
2013-07-16  0:50 Brian Dolbec
2013-07-16  0:50 Brian Dolbec
2013-07-16  0:50 Brian Dolbec
2013-07-16  0:50 Brian Dolbec
2013-07-06 19:02 Brian Dolbec
2013-07-06 19:02 Brian Dolbec
2013-06-23  7:13 Brian Dolbec
2013-06-23  7:13 Brian Dolbec
2013-06-23  7:13 Brian Dolbec
2013-06-23  7:13 Brian Dolbec
2013-06-23  7:13 Brian Dolbec
2013-06-23  7:13 Brian Dolbec
2012-12-10  4:56 Brian Dolbec
2012-12-10  3:26 Brian Dolbec
2012-12-10  3:26 Brian Dolbec
2012-12-10  3:26 Brian Dolbec
2012-12-10  3:26 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=1355115368.ba85abe6630b8735459506ef210b4361c819174c.dol-sen@gentoo \
    --to=brian.dolbec@gmail.com \
    --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