From: "Brian Dolbec" <dolsen@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoo-keys:gsoc-2016 commit in: gkeys-gen/gkeygen/
Date: Sat, 24 Dec 2016 09:13:16 +0000 (UTC) [thread overview]
Message-ID: <1482555255.f8e1697586597bf6d2856d4eafd597754c46a730.dolsen@gentoo> (raw)
commit: f8e1697586597bf6d2856d4eafd597754c46a730
Author: aeroniero33 <justthisthing <AT> gmail <DOT> com>
AuthorDate: Fri Jun 17 13:56:24 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Dec 24 04:54:15 2016 +0000
URL: https://gitweb.gentoo.org/proj/gentoo-keys.git/commit/?id=f8e16975
Made the default GPG config file overridable
<rebase edit> Remove trailing whitespace </edit Brian Dolbec>
gkeys-gen/gkeygen/actions.py | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/gkeys-gen/gkeygen/actions.py b/gkeys-gen/gkeygen/actions.py
index aaedcd1..403c779 100644
--- a/gkeys-gen/gkeygen/actions.py
+++ b/gkeys-gen/gkeygen/actions.py
@@ -127,6 +127,21 @@ class Actions(object):
self.output = output
self.logger = logger
+ def configure_config_file(self,args, gpghome):
+ '''Creates the config file'''
+ newgpgconfpath = os.path.join(gpghome, 'gpg.conf')
+ defaultpath = '/usr/share/gnupg/gpg-conf.skel'
+ file_exists = False
+ while not file_exists:
+ skelconfpath = py_input("Path of default gpg configuration file to use (default: %s) " %defaultpath)
+ if len(skelconfpath) <= 0:
+ skelconfpath = defaultpath
+ file_exists = os.path.exists(skelconfpath)
+ shutil.copy(skelconfpath, newgpgconfpath)
+ with open(newgpgconfpath, 'a') as conf:
+ for line in urlopen(self.config.get_key('gpg-urls', args.spec)):
+ conf.write(_unicode(line.decode('utf-8')))
+
def genkey(self, args):
'''Generate a gpg key using a spec file'''
@@ -158,12 +173,7 @@ class Actions(object):
self.output(["\n* Creating gpg folder at %s" % gpghome_full_path])
ensure_dirs(gpghome)
# Copy default gpg-conf.skel and append glep63 requirements
- self.output(["* Creating gpg.conf file at %s" % gpghome_full_path])
- newgpgconfpath = os.path.join(gpghome, 'gpg.conf')
- shutil.copy('/usr/share/gnupg/gpg-conf.skel', newgpgconfpath)
- with open(newgpgconfpath, 'a') as conf:
- for line in urlopen(self.config.get_key('gpg-urls', args.spec)):
- conf.write(_unicode(line.decode('utf-8')))
+ self.configure_config_file(args, gpghome)
# Key generation
ctx = gpgme.Context()
self.logger.info("MAIN: _action_genkey: Generating GPG key...")
next reply other threads:[~2016-12-24 9:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-24 9:13 Brian Dolbec [this message]
-- strict thread matches above, loose matches on Subject: below --
2016-12-24 9:41 [gentoo-commits] proj/gentoo-keys:gsoc-2016 commit in: gkeys-gen/gkeygen/ Brian Dolbec
2016-12-23 8:37 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=1482555255.f8e1697586597bf6d2856d4eafd597754c46a730.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