[OE-core] [meta-oe][PATCH v2] rpm: fix rpm path in nativesdk

Zhaolong Zhang zhangzl2013 at 126.com
Fri Sep 28 08:45:27 UTC 2018


Fix the incorrect path inside the nativesdk 'rpmdeps' wrapper:

In os.path.relpath(), it was assumed that all the WRAPPER_TOOLS are in {bindir},
and all the relative paths was calculated based on {bindir}.

However, the assumption was not true for 'rpmdeps' because it is in {libdir}/rpm/.
So the path in rpmdeps wrapper was incorrectly calculated to ..../usr/lib/lib/rpm.

To fix this, we can simply use $OECORE_NATIVE_SYSROOT as the base path, instead of
the complicated runtime path calculation.

The patch also fix the hard coded path in 'find-provides' and 'find-provides' for
nativesdk.

Signed-off-by: Zhaolong Zhang <zhangzl2013 at 126.com>
---

v1 --> v2:
  1. upgrade commit message.
  2. change ${libdir} to ${libdir_nativesdk}
  3. change ${datadir} to {prefix_nativesdk}/share

 meta/recipes-devtools/rpm/rpm_4.14.2.bb | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-devtools/rpm/rpm_4.14.2.bb b/meta/recipes-devtools/rpm/rpm_4.14.2.bb
index 46f8837..361e554 100644
--- a/meta/recipes-devtools/rpm/rpm_4.14.2.bb
+++ b/meta/recipes-devtools/rpm/rpm_4.14.2.bb
@@ -103,12 +103,15 @@ do_install_append_class-native() {
 do_install_append_class-nativesdk() {
         for tool in ${WRAPPER_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_CONFIGDIR=$OECORE_NATIVE_SYSROOT/${libdir_nativesdk}/rpm \
+                        RPM_ETCCONFIGDIR=$OECORE_NATIVE_SYSROOT/${base_prefix} \
+                        MAGIC=$OECORE_NATIVE_SYSROOT/${prefix_nativesdk}/share/misc/magic.mgc \
                         RPM_NO_CHROOT_FOR_SCRIPTS=1
         done
 
+        sed -i -e 's:\/usr\/lib\/rpm\/:$OECORE_NATIVE_SYSROOT\/usr\/lib\/rpm\/:' ${D}${libdir}/rpm/find-provides
+        sed -i -e 's:\/usr\/lib\/rpm\/:$OECORE_NATIVE_SYSROOT\/usr\/lib\/rpm\/:' ${D}${libdir}/rpm/find-requires
+
         rm -rf ${D}/var
 }
 
-- 
1.9.1




More information about the Openembedded-core mailing list