Skip to contentSkip to conversation

oeqa/selftest/runtime_test: Ensure we build/use gnupg-native

PATCH In review Richard Purdie 2 participants 3 messages Sep 13, 2018 – Sep 17, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 oeqa/selftest/runtime_test: Ensure we build/use gnupg-native

Without this, we see errors if gpg is missing from the host system for "oe-selftest -r runtime_test.TestImage.test_testimage_dnf".

---
 meta/lib/oeqa/selftest/cases/runtime_test.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
meta/lib/oeqa/selftest/cases/runtime_test.py +3 -1
index abd0723146f..906e460d4f8 100644
@@ -149,10 +149,12 @@ class TestImage(OESelftestTestCase):
         features += 'EXTRA_IMAGE_FEATURES += "package-management"\n'
         features += 'PACKAGE_CLASSES = "package_rpm"\n'
 
+        bitbake('gnupg-native -c addto_recipe_sysroot')
+
         # Enable package feed signing
         self.gpg_home = tempfile.mkdtemp(prefix="oeqa-feed-sign-")
         signing_key_dir = os.path.join(self.testlayer_path, 'files', 'signing')
-        runCmd('gpg --batch --homedir %s --import %s' % (self.gpg_home, os.path.join(signing_key_dir, 'key.secret')))
+        runCmd('gpg --batch --homedir %s --import %s' % (self.gpg_home, os.path.join(signing_key_dir, 'key.secret')), native_sysroot=get_bb_var("RECIPE_SYSROOT_NATIVE", "gnupg-native"))
         features += 'INHERIT += "sign_package_feed"\n'
         features += 'PACKAGE_FEED_GPG_NAME = "testuser"\n'
         features += 'PACKAGE_FEED_GPG_PASSPHRASE_FILE = "%s"\n' % os.path.join(signing_key_dir, 'key.passphrase')
Signature · 1 line
2.17.1
#1 lore raw

Doesn't quite work:

2018-09-14 23:53:16,527 - oe-selftest - INFO - 7: 13/14 281/332
(10.67s) (runtime_test.TestImage.test_testimage_dnf)
2018-09-14 23:53:16,527 - oe-selftest - INFO -

testtools.testresult.real._StringException: Traceback (most recent
call last):
File "/home/pokybuild/yocto-worker/nightly-oe-selftest/build/meta/lib/oeqa/core/decorator/__init__.py",
line 32, in wrapped_f
return func(*args, **kwargs)
File "/home/pokybuild/yocto-worker/nightly-oe-selftest/build/meta/lib/oeqa/selftest/cases/runtime_test.py",
line 157, in test_testimage_dnf
runCmd('gpg --batch --homedir %s --import %s' % (self.gpg_home,
os.path.join(signing_key_dir, 'key.secret')),
native_sysroot=get_bb_var("RECIPE_SYSROOT_NATIVE", "gnupg-native"))
File "/home/pokybuild/yocto-worker/nightly-oe-selftest/build/meta/lib/oeqa/utils/commands.py",
line 191, in runCmd
raise AssertionError("Command '%s' returned non-zero exit status
%d:\n%s" % (command, result.status, exc_output))
AssertionError: Command 'gpg --batch --homedir
/tmp/oeqa-feed-sign-gqt86zv_ --import /home/pokybuild/yocto-worker/nightly-oe-selftest/build/build-st-50002/meta-selftest/files/signing/key.secret'
returned non-zero exit status 2:
gpg: keybox '/tmp/oeqa-feed-sign-gqt86zv_/pubring.kbx' created
gpg: /tmp/oeqa-feed-sign-gqt86zv_/trustdb.gpg: trustdb created
gpg: key 7B31316B5D64AD52: public key "testuser (nocomment)
<[email protected]>" imported
gpg: failed to start agent '/home/pokybuild/yocto-worker/nightly-oe-selftest/build/build-st-104600/tmp/work/x86_64-linux/gnupg-native/2.2.9-r0/recipe-sysroot-native/usr/bin/gpg-agent':
No such file or directory
gpg: can't connect to the agent: No such file or directory
gpg: error getting the KEK: No agent running
gpg: Total number processed: 1
gpg: imported: 1
gpg: secret keys read: 1

Ross

Quoted 35 lines · On Thu, 13 Sep 2018 at 14:16, <[email protected]…

Without this, we see errors if gpg is missing from the host system for "oe-selftest -r runtime_test.TestImage.test_testimage_dnf".

---
 meta/lib/oeqa/selftest/cases/runtime_test.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
meta/lib/oeqa/selftest/cases/runtime_test.py +3 -2
index abd0723146f..906e460d4f8 100644
@@ -149,10 +149,12 @@ class TestImage(OESelftestTestCase):
         features += 'EXTRA_IMAGE_FEATURES += "package-management"\n'
         features += 'PACKAGE_CLASSES = "package_rpm"\n'
 
+        bitbake('gnupg-native -c addto_recipe_sysroot')
+
         # Enable package feed signing
         self.gpg_home = tempfile.mkdtemp(prefix="oeqa-feed-sign-")
         signing_key_dir = os.path.join(self.testlayer_path, 'files', 'signing')
-        runCmd('gpg --batch --homedir %s --import %s' % (self.gpg_home, os.path.join(signing_key_dir, 'key.secret')))
+        runCmd('gpg --batch --homedir %s --import %s' % (self.gpg_home, os.path.join(signing_key_dir, 'key.secret')), native_sysroot=get_bb_var("RECIPE_SYSROOT_NATIVE", "gnupg-native"))
         features += 'INHERIT += "sign_package_feed"\n'
         features += 'PACKAGE_FEED_GPG_NAME = "testuser"\n'
         features += 'PACKAGE_FEED_GPG_PASSPHRASE_FILE = "%s"\n' % os.path.join(signing_key_dir, 'key.passphrase')
--

2.17.1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#2 lore raw
Quoted 33 lines · Ross

Doesn't quite work:

2018-09-14 23:53:16,527 - oe-selftest - INFO - 7: 13/14 281/332
(10.67s) (runtime_test.TestImage.test_testimage_dnf)
2018-09-14 23:53:16,527 - oe-selftest - INFO -

testtools.testresult.real._StringException: Traceback (most recent call last):
File "/home/pokybuild/yocto-worker/nightly-oe- selftest/build/meta/lib/oeqa/core/decorator/__init__.py", line 32, in wrapped_f
return func(*args, **kwargs)
File "/home/pokybuild/yocto-worker/nightly-oe- selftest/build/meta/lib/oeqa/selftest/cases/runtime_test.py", line 157, in test_testimage_dnf
runCmd('gpg --batch --homedir %s --import %s' % (self.gpg_home, os.path.join(signing_key_dir, 'key.secret')), native_sysroot=get_bb_var("RECIPE_SYSROOT_NATIVE", "gnupg-native")) File "/home/pokybuild/yocto-worker/nightly-oe- selftest/build/meta/lib/oeqa/utils/commands.py",
line 191, in runCmd
raise AssertionError("Command '%s' returned non-zero exit status %d:\n%s" % (command, result.status, exc_output))
AssertionError: Command 'gpg --batch --homedir /tmp/oeqa-feed-sign-gqt86zv_ --import /home/pokybuild/yocto-worker/nightly-oe-selftest/build/build-st- 50002/meta-selftest/files/signing/key.secret'
returned non-zero exit status 2:
gpg: keybox '/tmp/oeqa-feed-sign-gqt86zv_/pubring.kbx' created
gpg: /tmp/oeqa-feed-sign-gqt86zv_/trustdb.gpg: trustdb created
gpg: key 7B31316B5D64AD52: public key "testuser (nocomment) <[email protected]>" imported
gpg: failed to start agent '/home/pokybuild/yocto-worker/nightly-oe-selftest/build/build-st-

Quoted 8 lines

104600/tmp/work/x86_64-linux/gnupg-native/2.2.9-r0/recipe-sysroot- native/usr/bin/gpg-agent':
No such file or directory
gpg: can't connect to the agent: No such file or directory
gpg: error getting the KEK: No agent running
gpg: Total number processed: 1
gpg: imported: 1
gpg: secret keys read: 1

A quick poke at this on a plane confirmed its an sstate relocation issue. gnupg-native does not relocate safely. common/homedir.c has gnupg_bindir() which isn't configurable and hardcodes the binary locations. There are other functions in there which probably have the same issue. Options:

a) Revert my selftest fix and require gpg on the machine running the selftests (opens us up to gpg version issues). Clearly not all YP autobuilder workers have it.
b) Patch gnupg to relocate properly

Cheers,

Richard