some more tweaks

This commit is contained in:
brent s. 2017-04-11 09:06:19 -04:00
parent e3236eb0d6
commit 6ff5a96d76
2 changed files with 5 additions and 4 deletions

View File

@ -19,7 +19,7 @@ def genGPG(conf):
distkey = conf['src'][a]['gpgkey'] distkey = conf['src'][a]['gpgkey']
if keysrv and (keysrv not in gpgkeyserver): if keysrv and (keysrv not in gpgkeyserver):
gpgkeyserver.append(keysrv) gpgkeyserver.append(keysrv)
if distkey not in distkeys: if distkey and(distkey not in distkeys):
distkeys.append(distkey) distkeys.append(distkey)
templates_dir = '{0}/extra/templates'.format(build['basedir']) templates_dir = '{0}/extra/templates'.format(build['basedir'])
mykey = False mykey = False
@ -35,6 +35,7 @@ def genGPG(conf):
if gpghome == '': if gpghome == '':
# We'll generate a key if we can't find one here. # We'll generate a key if we can't find one here.
gpghome = build['dlpath'] + '/.gnupg' gpghome = build['dlpath'] + '/.gnupg'
killStaleAgent(conf)
os.environ['GNUPGHOME'] = gpghome os.environ['GNUPGHOME'] = gpghome
gpg = gpgme.Context() gpg = gpgme.Context()
# do we need to add a keyserver? # do we need to add a keyserver?
@ -116,13 +117,13 @@ def killStaleAgent(conf):
# Kill off any stale GPG agents running. # Kill off any stale GPG agents running.
# Probably not even needed, but good to have. # Probably not even needed, but good to have.
chrootdir = conf['build']['chrootdir'] chrootdir = conf['build']['chrootdir']
dlpath = conf['build']['dlpath'] gpgpath = conf['gpg']['mygpghome']
procs = psutil.process_iter() procs = psutil.process_iter()
plst = [] plst = []
for p in procs: for p in procs:
if (p.name() in ('gpg-agent', 'dirmngr') and p.uids()[0] == os.getuid()): if (p.name() in ('gpg-agent', 'dirmngr') and p.uids()[0] == os.getuid()):
pd = psutil.Process(p.pid).as_dict() pd = psutil.Process(p.pid).as_dict()
for d in (chrootdir, dlpath): for d in (chrootdir, gpgpath):
if pd['cwd'].startswith('{0}'.format(d)): if pd['cwd'].startswith('{0}'.format(d)):
plst.append(p.pid) plst.append(p.pid)
if len(plst) >= 1: if len(plst) >= 1:

View File

@ -67,7 +67,7 @@ i_am_a_racecar = yes


[gpg] [gpg]
mygpgkey = mygpgkey =
mygpghome = mygpghome = ${build:dlpath}/.gnupg


[sync] [sync]
http = no http = no