| Summary: | gpgconf has incorrect paths when installing in host toolchain | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Build System, Metadata & Runtime] OE-Core | Reporter: | Gatis Paeglis <gatis.paeglis> | ||||||
| Component: | core | Assignee: | Jussi Kukkonen <jku> | ||||||
| Status: | VERIFIED NOTABUG | QA Contact: | Bogdan Alexandru Voiculescu <bogdanx.a.voiculescu> | ||||||
| Severity: | normal | ||||||||
| Priority: | Medium | CC: | bogdanx.a.voiculescu, meta.mr.watcher, meta.watcher | ||||||
| Version: | unspecified | ||||||||
| Target Milestone: | 2.1 | ||||||||
| Hardware: | x86 | ||||||||
| OS: | Multiple | ||||||||
| Whiteboard: | |||||||||
| OS type for building Yocto: | --- | Type of Regression: | --- | ||||||
| Verified: | Documentation change: | No (bug/feature does not impact docs) | |||||||
| Attachments: |
|
||||||||
After looking some more at this I see that there is no way to change the prefix at runtime, it is defined at build time. As I was told, other recipes have solved similar issues with patching the original library to add envvars and then use "create_wrapper pattern" from recipes. Created attachment 2849 [details]
gnupg recipe bbappend
Created attachment 2850 [details]
gnupg library patch
This is not complete. There are few other places in gnupg src that uses GNUPG_ defines, but this patch covers my use cases.
And here is the relevant discussion from gnupg-devel mailing list: http://lists.gnupg.org/pipermail/gnupg-devel/2015-November/030547.html It is not very useful, since I did not manage to convince them that there is an issue. Can you submit the patches to the mailing list (openembedded-core@) for review? We don't do patch review in bugzilla. Thanks! I don't do patches on mailing lists :) But if seriously, then the patch for gnupg library is not complete and probably should be handled in cleaner way and ideally would be done by upstream project (gnupg). It works for me, so I attached it here for convenience if others experience the same issue or somebody wants to fix this properly. I do not have time for that unfortunately. Also I would like to see yocto project switching from ML to something more modern, like https://en.wikipedia.org/wiki/Gerrit_%28software%29 Just a note: this patch was tested with gnupg_2.0.26 and wont work with gnupg_2.1.1 for example. Also in my patch I export this adjusted env only before calling gpgconf, but the same env is probably needed also for other gpg binaries. I might be missing something... can you explain why gpgconf needs to be able to run in sysroot? gpgconf as I've understood it is a tool for modifying user configuration in place in ~/.gnupg: this doesn't sound like a toolchain tool to me. Can you generate the configuration once and install that in a recipe (possibly with some sed-replacements in the recipe if needed)? > I might be missing something... can you explain why gpgconf needs to be able > to run in sysroot? gpgconf as I've understood it is a tool for modifying user > configuration in place in ~/.gnupg: this doesn't sound like a toolchain tool > to me.
My current situation is that I want to provide customers a binary executable of "something" that does not come as installable *.deb package on Ubuntu. It could be challenging for some to build this "something" natively on Ubuntu, so I want to provide it in my toolchain for convenience. This "something" depends on GNUPG (and gpgme) and that is the reason why I have been trying to make it work from a toolchain.
Looking at the source code in gpgme library (gpgme/src/dirinfo.c::get_gpgconf_item) I see that it uses the gpgconf to find the gpg binary, but failing to find gpg in that path results in:
error: Unable to lookup key ID MY_KEY_ID: GPGME: Invalid crypto engine
So this is what gpgconf seems to be used for in addition to other things.
I was thinking since GNUPG is a runtime dependency, maybe there is a way to force "something" from toolchain to uses the GNUGP from the system instead?
Seems like nobody has ever tried this setup and also I droped GNUPG from my toolchain. This task can be closed as out-of-scope. I agree that it's kind of out-of-scope, marking NOTABUG. If you need advice on how to get a tool in sysroot to use host gnupg, you could try the mailing list: I'm guessing it's possible but can't think of suggestions right now. out of scope. |
Steps to reproduce: 1) Add BBCLASSEXTEND = "native nativesdk" to the gnupg recipe. 2) Build toolchain for host. 3) Install the toolchain in custom prefix (MY_PREFIX). 4) Run ${MY_PREFIX}/sysroots/x86_64-pokysdk-linux/usr/bin/gpgconf Where on my setup it prints: gpg:GPG for OpenPGP:/opt/b2qt/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/gpg2 gpg-agent:GPG Agent:/opt/b2qt/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/gpg-agent scdaemon:Smartcard Daemon:/opt/b2qt/1.7/sysroots/x86_64-pokysdk-linux/usr/lib/gnupg/scdaemon gpgsm:GPG for S/MIME:/opt/b2qt/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/gpgsm dirmngr:Directory Manager:/opt/b2qt/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/dirmngr But the expected output would be: gpg:GPG for OpenPGP:${MY_PREFIX}/sysroots/x86_64-pokysdk-linux/usr/bin/gpg2 gpg-agent:GPG Agent:${MY_PREFIX}/sysroots/x86_64-pokysdk-linux/usr/bin/gpg-agent scdaemon:Smartcard Daemon:${MY_PREFIX}/sysroots/x86_64-pokysdk-linux/usr/lib/gnupg/scdaemon gpgsm:GPG for S/MIME:${MY_PREFIX}sysroots/x86_64-pokysdk-linux/usr/bin/gpgsm dirmngr:Directory Manager:${MY_PREFIX}/sysroots/x86_64-pokysdk-linux/usr/bin/dirmngr Looking at the source code in gpgme library (gpgme/src/dirinfo.c::get_gpgconf_item) I see that it uses the gpgconf to find the gpg binary, but failing to find gpg in that path results in: error: Unable to lookup key ID MY_KEY_ID: GPGME: Invalid crypto engine Possibly recipe should add /etc/gnupg/gpgconf.conf as described in http://manpages.ubuntu.com/manpages/hardy/man1/gpgconf.1.html Or run: gpgconf --change-options when installing the toolchain.