Gentoo Archives: gentoo-commits

From: Brian Dolbec <dolsen@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/gentoo-keys:master commit in: gkeys/gkeys/
Date: Sun, 31 May 2015 05:03:32
Message-Id: 1433027930.ffe53b207532d165f3e6019e10ee27f23e0b3e84.dolsen@gentoo
1 commit: ffe53b207532d165f3e6019e10ee27f23e0b3e84
2 Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
3 AuthorDate: Wed Mar 18 23:18:13 2015 +0000
4 Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
5 CommitDate: Sat May 30 23:18:50 2015 +0000
6 URL: https://gitweb.gentoo.org/proj/gentoo-keys.git/commit/?id=ffe53b20
7
8 gkeys: Remove gpgsearch option from list-key action
9
10 The default action for list-key is to now list all keys found in the keydir.
11 Regardless if they are in the db's seed file for that keydir.
12
13 gkeys/gkeys/action_map.py | 2 +-
14 gkeys/gkeys/actions.py | 48 ++++++++++-------------------------------------
15 2 files changed, 11 insertions(+), 39 deletions(-)
16
17 diff --git a/gkeys/gkeys/action_map.py b/gkeys/gkeys/action_map.py
18 index d547ab3..3b1b9d0 100644
19 --- a/gkeys/gkeys/action_map.py
20 +++ b/gkeys/gkeys/action_map.py
21 @@ -157,7 +157,7 @@ Found:
22 ('list-key', {
23 'func': 'listkey',
24 'options': ['category', 'nick', 'name', 'fingerprint', 'keyid', 'keys',
25 - 'keydir', 'keyring', 'gpgsearch'],
26 + 'keydir', 'keyring'],
27 'desc': '''Pretty-print the selected gpg key''',
28 'long_desc': '''Pretty-print the selected gpg key''',
29 'example': '''gkeys list-key -C gentoo -n gkeys
30
31 diff --git a/gkeys/gkeys/actions.py b/gkeys/gkeys/actions.py
32 index efab4fa..edbea0d 100644
33 --- a/gkeys/gkeys/actions.py
34 +++ b/gkeys/gkeys/actions.py
35 @@ -206,45 +206,17 @@ class Actions(object):
36 results = {}
37 success = []
38 messages = []
39 - if args.gpgsearch:
40 - keyresults = seeds.seeds
41 - # pick any key
42 - key = keyresults[sorted(keyresults)[0]]
43 - result = self.gpg.list_keys(key.keydir, args.gpgsearch)
44 - # now split the results and reverse lookup the gkey
45 - lines = result.output.split('\n')
46 - while lines:
47 - # determine the end of the first key listing
48 - index = lines.index('')
49 - keyinfo = lines[:index]
50 - # trim off the first keys info
51 - lines = lines[index + 1:]
52 - # make sure it is a key listing
53 - if len(keyinfo) < 2:
54 - break
55 - # get the fingerprint from the line
56 - fpr = keyinfo[1].split('= ')[1]
57 - # search for the matching gkey
58 - kwargs = {'keydir': args.keydir, 'fingerprint': [fpr]}
59 - keyresults = seeds.list(**kwargs)
60 - # list the results
61 - for key in sorted(keyresults):
62 - ls, lr = self._list_it(key, '\n'.join(keyinfo))
63 - success.append(ls)
64 - results[key.name] = lr
65 + kwargs = handler.build_gkeydict(args)
66 + keyresults = seeds.list(**kwargs)
67 + for key in sorted(keyresults):
68 + if args.fingerprint:
69 + result = self.gpg.list_keys(key.keydir, kwargs['fingerprint'])
70 + else:
71 + result = self.gpg.list_keys(key.keydir)
72 + ls, lr = self._list_it(key, result.output)
73 + success.append(ls)
74 + results[key.name] = lr
75 messages = ["Done."]
76 - else:
77 - kwargs = handler.build_gkeydict(args)
78 - keyresults = seeds.list(**kwargs)
79 - for key in sorted(keyresults):
80 - if args.fingerprint:
81 - result = self.gpg.list_keys(key.keydir, kwargs['fingerprint'])
82 - else:
83 - result = self.gpg.list_keys(key.keydir)
84 - ls, lr = self._list_it(key, result.output)
85 - success.append(ls)
86 - results[key.name] = lr
87 - messages = ["Done."]
88
89 if not messages:
90 messages = ['No results found meeting criteria', "Did you specify -n foo or -n '*'"]