[2/2] signing-keys: Use GPG_PATH as keyring location if it is defined

Submitted by Konrad Scherer on Dec. 10, 2015, 4:44 p.m. | Patch ID: 109677

Details

Message ID 1449765882-15910-3-git-send-email-konrad.scherer@windriver.com
State New
Headers show

Commit Message

Konrad Scherer Dec. 10, 2015, 4:44 p.m.
From: Konrad Scherer <Konrad.Scherer@windriver.com>

While experimenting with signing rpms, I attempted to import the keys
into a temporary keyring and set GPG_PATH to the temporary keyring.
This fails because the gpg export call cannot find the requested key
in the default keyring.

Signed-off-by: Konrad Scherer <Konrad.Scherer@windriver.com>
---
 meta/recipes-core/meta/signing-keys.bb | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/meta/recipes-core/meta/signing-keys.bb b/meta/recipes-core/meta/signing-keys.bb
index c19a5fe..ecfcfd0 100644
--- a/meta/recipes-core/meta/signing-keys.bb
+++ b/meta/recipes-core/meta/signing-keys.bb
@@ -26,8 +26,11 @@  def export_gpg_pubkey(d, keyid, path):
     bb.utils.mkdirhier(os.path.dirname(path))
     gpg_bin = d.getVar('GPG_BIN', True) or \
               bb.utils.which(os.getenv('PATH'), "gpg")
-    cmd = '%s --batch --yes --export --armor -o %s %s' % \
-          (gpg_bin, path, keyid)
+    cmd = gpg_bin
+    if d.getVar('GPG_PATH', True):
+        cmd += " --homedir %s" % d.getVar('GPG_PATH', True)
+    cmd += ' --batch --yes --export --armor -o %s %s' % (path, keyid)
+
     status, output = oe.utils.getstatusoutput(cmd)
     if status:
         raise bb.build.FuncFailed('Failed to export gpg public key (%s): %s' %