summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2018-09-19 13:44:40 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-12-06 16:26:52 (GMT)
commitfffac6b38a56f636e5a916696a2fbe7c6dfb70b2 (patch)
tree83cdb26b7b04dcb417bde58d0b4398856ff3aac0
parent77f078eebbd80d4aee69a02c256d14183886b144 (diff)
downloadpoky-fffac6b38a56f636e5a916696a2fbe7c6dfb70b2.tar.gz
gnupg: patch gnupg-native to allow path relocation
GnuPG hard-codes $bindir etc and uses them to find the helper binaries, such as gpg-agent. This breaks if gnupg-native is reused from sstate for a different build directory and GPG signing of packages is required. Patch in getenv() checks for gnupg-native when returning the hardcoded paths, and create a wrapper script which overrides GNUPG_BINDIR. There are more paths that can be overridden, but this one is sufficient to make GnuPG work. (From OE-Core rev: dfd69ff889ed78bf137116583d8ae351859ee203) (From OE-Core rev: e0cc225fc5bbc964f0f41ee0ca29e6b7b5ebef41) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-support/gnupg/gnupg/relocate.patch81
-rw-r--r--meta/recipes-support/gnupg/gnupg_2.2.9.bb7
2 files changed, 87 insertions, 1 deletions
diff --git a/meta/recipes-support/gnupg/gnupg/relocate.patch b/meta/recipes-support/gnupg/gnupg/relocate.patch
new file mode 100644
index 0000000..87ec409
--- /dev/null
+++ b/meta/recipes-support/gnupg/gnupg/relocate.patch
@@ -0,0 +1,81 @@
1Allow the environment to override where gnupg looks for its own files. Useful in native builds.
2
3Upstream-Status: Inappropriate [OE-specific]
4Signed-off-by: Ross Burton <ross.burton@intel.com>
5
6diff --git a/common/homedir.c b/common/homedir.c
7index e9e75d01e..19140aa0d 100644
8--- a/common/homedir.c
9+++ b/common/homedir.c
10@@ -760,7 +760,7 @@ gnupg_socketdir (void)
11 if (!name)
12 {
13 unsigned int dummy;
14- name = _gnupg_socketdir_internal (0, &dummy);
15+ name = getenv("GNUPG_SOCKETDIR") ?: _gnupg_socketdir_internal (0, &dummy);
16 }
17
18 return name;
19@@ -786,7 +786,7 @@ gnupg_sysconfdir (void)
20 }
21 return name;
22 #else /*!HAVE_W32_SYSTEM*/
23- return GNUPG_SYSCONFDIR;
24+ return getenv("GNUPG_SYSCONFDIR") ?: GNUPG_SYSCONFDIR;
25 #endif /*!HAVE_W32_SYSTEM*/
26 }
27
28@@ -815,7 +815,7 @@ gnupg_bindir (void)
29 else
30 return rdir;
31 #else /*!HAVE_W32_SYSTEM*/
32- return GNUPG_BINDIR;
33+ return getenv("GNUPG_BINDIR") ?: GNUPG_BINDIR;
34 #endif /*!HAVE_W32_SYSTEM*/
35 }
36
37@@ -828,7 +828,7 @@ gnupg_libexecdir (void)
38 #ifdef HAVE_W32_SYSTEM
39 return gnupg_bindir ();
40 #else /*!HAVE_W32_SYSTEM*/
41- return GNUPG_LIBEXECDIR;
42+ return getenv("GNUPG_LIBEXECDIR") ?: GNUPG_LIBEXECDIR;
43 #endif /*!HAVE_W32_SYSTEM*/
44 }
45
46@@ -842,7 +842,7 @@ gnupg_libdir (void)
47 name = xstrconcat (w32_rootdir (), DIRSEP_S "lib" DIRSEP_S "gnupg", NULL);
48 return name;
49 #else /*!HAVE_W32_SYSTEM*/
50- return GNUPG_LIBDIR;
51+ return getenv("GNUPG_LIBDIR") ?: GNUPG_LIBDIR;
52 #endif /*!HAVE_W32_SYSTEM*/
53 }
54
55@@ -856,7 +856,7 @@ gnupg_datadir (void)
56 name = xstrconcat (w32_rootdir (), DIRSEP_S "share" DIRSEP_S "gnupg", NULL);
57 return name;
58 #else /*!HAVE_W32_SYSTEM*/
59- return GNUPG_DATADIR;
60+ return getenv("GNUPG_DATADIR") ?: GNUPG_DATADIR;
61 #endif /*!HAVE_W32_SYSTEM*/
62 }
63
64@@ -872,7 +872,7 @@ gnupg_localedir (void)
65 NULL);
66 return name;
67 #else /*!HAVE_W32_SYSTEM*/
68- return LOCALEDIR;
69+ return getenv("LOCALEDIR") ?: LOCALEDIR;
70 #endif /*!HAVE_W32_SYSTEM*/
71 }
72
73@@ -940,7 +940,7 @@ gnupg_cachedir (void)
74 }
75 return dir;
76 #else /*!HAVE_W32_SYSTEM*/
77- return GNUPG_LOCALSTATEDIR "/cache/" PACKAGE_NAME;
78+ return getenv("GNUPG_LOCALSTATEDIR") ?: GNUPG_LOCALSTATEDIR "/cache/" PACKAGE_NAME;
79 #endif /*!HAVE_W32_SYSTEM*/
80 }
81
diff --git a/meta/recipes-support/gnupg/gnupg_2.2.9.bb b/meta/recipes-support/gnupg/gnupg_2.2.9.bb
index 4f815df..b7d23b8 100644
--- a/meta/recipes-support/gnupg/gnupg_2.2.9.bb
+++ b/meta/recipes-support/gnupg/gnupg_2.2.9.bb
@@ -15,7 +15,8 @@ SRC_URI = "${GNUPG_MIRROR}/${BPN}/${BPN}-${PV}.tar.bz2 \
15 file://0003-dirmngr-uses-libgpg-error.patch \ 15 file://0003-dirmngr-uses-libgpg-error.patch \
16 file://0004-autogen.sh-fix-find-version-for-beta-checking.patch \ 16 file://0004-autogen.sh-fix-find-version-for-beta-checking.patch \
17 " 17 "
18SRC_URI_append_class-native = " file://0001-configure.ac-use-a-custom-value-for-the-location-of-.patch" 18SRC_URI_append_class-native = " file://0001-configure.ac-use-a-custom-value-for-the-location-of-.patch \
19 file://relocate.patch"
19 20
20 21
21SRC_URI[md5sum] = "52c895a81f514a65e08923736c38654a" 22SRC_URI[md5sum] = "52c895a81f514a65e08923736c38654a"
@@ -43,6 +44,10 @@ do_install_append() {
43 ln -sf gpgv2 ${D}${bindir}/gpgv 44 ln -sf gpgv2 ${D}${bindir}/gpgv
44} 45}
45 46
47do_install_append_class-native() {
48 create_wrapper ${D}${bindir}/gpg2 GNUPG_BINDIR=${STAGING_BINDIR_NATIVE}
49}
50
46PACKAGECONFIG ??= "gnutls" 51PACKAGECONFIG ??= "gnutls"
47PACKAGECONFIG[gnutls] = "--enable-gnutls, --disable-gnutls, gnutls" 52PACKAGECONFIG[gnutls] = "--enable-gnutls, --disable-gnutls, gnutls"
48PACKAGECONFIG[sqlite3] = "--enable-sqlite, --disable-sqlite, sqlite3" 53PACKAGECONFIG[sqlite3] = "--enable-sqlite, --disable-sqlite, sqlite3"