When installing the SDK to a non-default path, running "rpm --showrc" from the
sdk will produce the following error:
error: Unable to open 
/opt/poky/2.4+snapshot/sysroots/x86_64-pokysdk-linux/usr/lib/rpm/rpmrc for 
reading: No such file or directory. 

Fix this by adding wrappers that dynamically export the RPM_CONFIGDIR,
RPM_ETCCONFIGDIR and MAGIC environment variables, pointing to the proper
sdk locations.

Signed-off-by: Ovidiu Panait <ovidiu.pan...@windriver.com>
---
 meta/recipes-devtools/rpm/rpm_4.14.1.bb | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/meta/recipes-devtools/rpm/rpm_4.14.1.bb 
b/meta/recipes-devtools/rpm/rpm_4.14.1.bb
index 7b8ea46a75..daaf4637a3 100644
--- a/meta/recipes-devtools/rpm/rpm_4.14.1.bb
+++ b/meta/recipes-devtools/rpm/rpm_4.14.1.bb
@@ -65,6 +65,7 @@ EXTRA_OECONF_append_libc-musl = " --disable-nls"
 #
 # Also disable plugins, so that rpm doesn't attempt to inhibit shutdown via 
session dbus
 EXTRA_OECONF_append_class-native = " --sysconfdir=/etc --localstatedir=/var 
--disable-plugins"
+EXTRA_OECONF_append_class-nativesdk = " --sysconfdir=/etc --localstatedir=/var 
--disable-plugins"
 
 BBCLASSEXTEND = "native nativesdk"
 
@@ -96,6 +97,31 @@ do_install_append_class-native() {
         done
 }
 
+do_install_append_class-nativesdk() {
+        tools="\
+                ${bindir}/rpm \
+                ${bindir}/rpm2archive \
+                ${bindir}/rpm2cpio \
+                ${bindir}/rpmbuild \
+                ${bindir}/rpmdb \
+                ${bindir}/rpmgraph \
+                ${bindir}/rpmkeys \
+                ${bindir}/rpmsign \
+                ${bindir}/rpmspec \
+                ${libdir}/rpm/rpmdeps \
+        "
+
+        for tool in $tools; do
+                create_wrapper ${D}$tool \
+                        RPM_CONFIGDIR='`dirname 
$''realpath`'/${@os.path.relpath(d.getVar('libdir', True), d.getVar('bindir', 
True))}/rpm \
+                        RPM_ETCCONFIGDIR='$'{RPM_ETCCONFIGDIR-'`dirname 
$''realpath`'/${@os.path.relpath(d.getVar('sysconfdir', True), 
d.getVar('bindir', True))}/..} \
+                        MAGIC='`dirname 
$''realpath`'/${@os.path.relpath(d.getVar('datadir', True), d.getVar('bindir', 
True))}/misc/magic.mgc \
+                        RPM_NO_CHROOT_FOR_SCRIPTS=1
+        done
+
+        rm -rf ${D}/var
+}
+
 # Rpm's make install creates var/tmp which clashes with base-files packaging
 do_install_append_class-target() {
     rm -rf ${D}/var
-- 
2.16.2

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Reply via email to