summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOvidiu Panait <ovidiu.panait@windriver.com>2020-03-02 20:44:50 +0200
committerJia Zhang <zhang.jia@linux.alibaba.com>2020-03-03 22:47:06 +0800
commit8f9f83a40a094808dc2bd1155c4b984ee3affe7e (patch)
tree81409369a64b1b7701a6123dbf708645bc91c9cc
parentd496407fc10fb87259d145968706b79ab19490a7 (diff)
downloadmeta-secure-core-8f9f83a40a094808dc2bd1155c4b984ee3affe7e.tar.gz
fixup! sign_rpm_ext: Use socket redirection to avoid GPG_PATH length limitation
If GPG_PATH is already created by signing-keys do_get_public_keys task, subsequent executions of do_package_write_rpm will fail with "Filename too long" errors (this only affects builds using GPG paths larger than 80 characters). Fix this race condition by making sure that the redirection files are always present in the gpg homedir even if the directory already exists when the first package_write_rpm task executes. Also, make sure this new approach does not affect GPG_PATHs smaller than 80 chars. Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
-rw-r--r--meta-signing-key/classes/user-key-store.bbclass15
1 files changed, 9 insertions, 6 deletions
diff --git a/meta-signing-key/classes/user-key-store.bbclass b/meta-signing-key/classes/user-key-store.bbclass
index 313f340..55876d0 100644
--- a/meta-signing-key/classes/user-key-store.bbclass
+++ b/meta-signing-key/classes/user-key-store.bbclass
@@ -482,13 +482,16 @@ def check_gpg_key(basekeyname, keydirfunc, d):
482 f.write('auto-expand-secmem\n') 482 f.write('auto-expand-secmem\n')
483 f.close() 483 f.close()
484 484
485 if len(gpg_path) > 80:
485 bn = d.getVar('BUILDNAME', True) 486 bn = d.getVar('BUILDNAME', True)
486 socklist = ["yocto-native", "browser", "ssh", "extra"] 487 suffixlist = ["yocto-native", "browser", "ssh", "extra"]
487 for sock in socklist: 488 for suffix in suffixlist:
488 f = open(os.path.join(gpg_path, 'S.gpg-agent.' + sock), 'w') 489 socket = os.path.join(gpg_path, 'S.gpg-agent.' + suffix)
489 f.write('%Assuan%\n') 490 if not os.path.exists(socket):
490 f.write('socket=/tmp/S.gpg-agent.%s-%s\n' % (sock, bn)) 491 f = open(socket, 'w')
491 f.close() 492 f.write('%Assuan%\n')
493 f.write('socket=/tmp/S.gpg-agent.%s-%s\n' % (suffix, bn))
494 f.close()
492 495
493 gpg_bin = d.getVar('GPG_BIN', True) or \ 496 gpg_bin = d.getVar('GPG_BIN', True) or \
494 bb.utils.which(os.getenv('PATH'), 'gpg') 497 bb.utils.which(os.getenv('PATH'), 'gpg')