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

Konrad Scherer konrad.scherer at windriver.com
Thu Dec 10 16:44:42 UTC 2015


From: Konrad Scherer <Konrad.Scherer at 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 at windriver.com>
---
 meta/recipes-core/meta/signing-keys.bb | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

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' %
-- 
2.6.3




More information about the Openembedded-core mailing list