Skip to contentSkip to conversation

uninative/mtools: Set GCONV_PATH centrally to ensure the correct value

PATCH New Richard Purdie 1 participant 1 message Mar 5, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 uninative/mtools: Set GCONV_PATH centrally to ensure the correct value

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.

meta/classes/uninative.bbclass +10 -5
index 7f242de..6abcbed 100644
@@ -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
meta/recipes-devtools/mtools/mtools_3.9.9.bb +0 -5
index 26d52a9..3423917 100644
@@ -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
-}
meta/recipes-devtools/mtools/mtools_4.0.18.bb +0 -5
index 479fd32..efde547 100644
@@ -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
-}