[OE-core] [PATCH] uninative/mtools: Set GCONV_PATH centrally to ensure the correct value

Richard Purdie richard.purdie at linuxfoundation.org
Sat Mar 5 09:40:04 UTC 2016


The existing GCONV_PATH set in the mcopy wrapper doens't work with the updated 
uninative directory layout. It also means that it might not work correctly in the
native case when uninative is not in use.

Tweak uninative to set GCONV_PATH into the environment for everything to
avoid these problems. Refactoring the code in uninative into a function 
is beneficial at this point.

Based on a patch from Randy Witt.

Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

diff --git a/meta/classes/uninative.bbclass b/meta/classes/uninative.bbclass
index 7f242de..6abcbed 100644
--- a/meta/classes/uninative.bbclass
+++ b/meta/classes/uninative.bbclass
@@ -57,9 +57,7 @@ python uninative_event_fetchloader() {
         cmd = d.expand("mkdir -p ${STAGING_DIR}-uninative; cd ${STAGING_DIR}-uninative; tar -xjf ${UNINATIVE_DLDIR}/${UNINATIVE_TARBALL}; ${STAGING_DIR}-uninative/relocate_sdk.py ${STAGING_DIR}-uninative/${BUILD_ARCH}-linux ${UNINATIVE_LOADER} ${UNINATIVE_LOADER} ${STAGING_DIR}-uninative/${BUILD_ARCH}-linux/${bindir_native}/patchelf-uninative")
         subprocess.check_call(cmd, shell=True)
 
-        d.setVar("NATIVELSBSTRING", "universal")
-        d.appendVar("SSTATEPOSTUNPACKFUNCS", " uninative_changeinterp")
-        d.prependVar("PATH", "${STAGING_DIR}-uninative/${BUILD_ARCH}-linux${bindir_native}:")
+        enable_uninative(d)
 
     except bb.fetch2.BBFetchException as exc:
         bb.warn("Disabling uninative as unable to fetch uninative tarball: %s" % str(exc))
@@ -76,14 +74,21 @@ python uninative_event_enable() {
     This event handler is called in the workers and is responsible for setting
     up uninative if a loader is found.
     """
+    enable_uninative(d)
+}
 
+def enable_uninative(d):
     loader = d.getVar("UNINATIVE_LOADER", True)
     if os.path.exists(loader):
         bb.debug(2, "Enabling uninative")
         d.setVar("NATIVELSBSTRING", "universal")
+
+        uninative_dir = "${STAGING_DIR}-uninative/${BUILD_ARCH}-linux"
         d.appendVar("SSTATEPOSTUNPACKFUNCS", " uninative_changeinterp")
-        d.prependVar("PATH", "${STAGING_DIR}-uninative/${BUILD_ARCH}-linux${bindir_native}:")
-}
+        d.prependVar("PATH", "%s${bindir_native}:" % uninative_dir)
+        # We need this so mcopy (mtools) can find codepages correctly for example
+        d.setVar("GCONV_PATH", "%s${libdir_native}/gconv" % uninative_dir)
+        d.setVarFlag("GCONV_PATH", "export", "1")
 
 python uninative_changeinterp () {
     import subprocess
diff --git a/meta/recipes-devtools/mtools/mtools_3.9.9.bb b/meta/recipes-devtools/mtools/mtools_3.9.9.bb
index 26d52a9..3423917 100644
--- a/meta/recipes-devtools/mtools/mtools_3.9.9.bb
+++ b/meta/recipes-devtools/mtools/mtools_3.9.9.bb
@@ -51,8 +51,3 @@ do_install_prepend () {
     mkdir -p ${D}/${bindir}
     mkdir -p ${D}/${datadir}
 }
-
-do_install_append_class-native () {
-    create_wrapper ${D}${bindir}/mcopy \
-        GCONV_PATH=${libdir}/gconv
-}
diff --git a/meta/recipes-devtools/mtools/mtools_4.0.18.bb b/meta/recipes-devtools/mtools/mtools_4.0.18.bb
index 479fd32..efde547 100644
--- a/meta/recipes-devtools/mtools/mtools_4.0.18.bb
+++ b/meta/recipes-devtools/mtools/mtools_4.0.18.bb
@@ -48,8 +48,3 @@ do_install_prepend () {
     mkdir -p ${D}/${bindir}
     mkdir -p ${D}/${datadir}
 }
-
-do_install_append_class-native () {
-    create_wrapper ${D}${bindir}/mcopy \
-        GCONV_PATH=${libdir}/gconv
-}





More information about the Openembedded-core mailing list