[oe-commits] [openembedded-core] 39/42: Revert "uninative.bbclass: if the loader can't be found disable instead of failing"

git at git.openembedded.org git at git.openembedded.org
Tue Mar 1 08:40:21 UTC 2016


rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 5ee762875c9979bdcf82b1b252e65b4dbea0d3e7
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Tue Mar 1 08:33:34 2016 +0000

    Revert "uninative.bbclass: if the loader can't be found disable instead of failing"
    
    This reverts commit 55ae56687a39287328ee8b8bd5496f164f617c6b.
    
    This breaks eSDK and we don't have a good way to fix it right now.
---
 meta/classes/uninative.bbclass | 64 +++++++++++++++++-------------------------
 1 file changed, 26 insertions(+), 38 deletions(-)

diff --git a/meta/classes/uninative.bbclass b/meta/classes/uninative.bbclass
index 9a57170..270c1b0 100644
--- a/meta/classes/uninative.bbclass
+++ b/meta/classes/uninative.bbclass
@@ -1,3 +1,5 @@
+NATIVELSBSTRING = "universal"
+
 UNINATIVE_LOADER ?= "${STAGING_DIR}-uninative/${BUILD_ARCH}-linux/lib/${@bb.utils.contains('BUILD_ARCH', 'x86_64', 'ld-linux-x86-64.so.2', 'ld-linux.so.2', d)}"
 
 UNINATIVE_URL ?= "unset"
@@ -11,16 +13,19 @@ addhandler uninative_eventhandler
 uninative_eventhandler[eventmask] = "bb.event.BuildStarted"
 
 python uninative_eventhandler() {
-    enabled = True
-
-    loader = d.getVar("UNINATIVE_LOADER", True)
+    loader = e.data.getVar("UNINATIVE_LOADER", True)
     tarball = d.getVar("UNINATIVE_TARBALL", True)
     tarballdir = d.getVar("UNINATIVE_DLDIR", True)
     tarballpath = os.path.join(tarballdir, tarball)
 
     if not os.path.exists(loader):
-        # If the tarball doesn't exist, try to fetch it.
+        import subprocess
+
+        olddir = os.getcwd()
         if not os.path.exists(tarballpath):
+            # Copy the data object and override DL_DIR and SRC_URI
+            localdata = bb.data.createCopy(d)
+
             if d.getVar("UNINATIVE_URL", True) == "unset":
                 bb.fatal("Uninative selected but not configured, please set UNINATIVE_URL")
 
@@ -28,48 +33,31 @@ python uninative_eventhandler() {
             if not chksum:
                 bb.fatal("Uninative selected but not configured correctly, please set UNINATIVE_CHECKSUM[%s]" % d.getVar("BUILD_ARCH", True))
 
+            srcuri = d.expand("${UNINATIVE_URL}${UNINATIVE_TARBALL};md5sum=%s" % chksum)
+            localdata.setVar('FILESPATH', tarballdir)
+            localdata.setVar('DL_DIR', tarballdir)
+            bb.note("Fetching uninative binary shim from %s" % srcuri)
+            fetcher = bb.fetch2.Fetch([srcuri], localdata, cache=False)
             try:
-                # Save and restore cwd as Fetch.download() does a chdir()
-                olddir = os.getcwd()
-
-                localdata = bb.data.createCopy(d)
-                localdata.setVar('FILESPATH', "")
-                localdata.setVar('DL_DIR', tarballdir)
-
-                srcuri = d.expand("${UNINATIVE_URL}${UNINATIVE_TARBALL};md5sum=%s" % chksum)
-                bb.note("Fetching uninative binary shim from %s" % srcuri)
-
-                fetcher = bb.fetch2.Fetch([srcuri], localdata, cache=False)
                 fetcher.download()
                 localpath = fetcher.localpath(srcuri)
                 if localpath != tarballpath and os.path.exists(localpath) and not os.path.exists(tarballpath):
                     os.symlink(localpath, tarballpath)
             except Exception as exc:
-                bb.warn("Unable to download uninative tarball: %s" % str(exc))
-                enabled = False
-            finally:
-                os.chdir(olddir)
-
-        # If we're still enabled then the fetch didn't fail, so unpack the tarball
-        if enabled:
-            import subprocess
-            try:
-                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)
-            except subprocess.CalledProcessError as exc:
-                bb.warn("Unable to install uninative tarball: %s" % str(exc))
-                enabled = False
-
-    if enabled:
-        bb.debug(2, "Enabling uninative")
-        d.setVar("NATIVELSBSTRING", "universal")
-        d.appendVar("SSTATEPOSTUNPACKFUNCS", " uninative_changeinterp")
-        d.prependVar("PATH", "${STAGING_DIR}-uninative/${BUILD_ARCH}-linux${bindir_native}:")
-    else:
-        bb.warn("Uninative selected but the loader isn't present and can't be downloaded.  Disabling uninative.\n"
-                "To build your own uninative loader, please bitbake uninative-tarball and set UNINATIVE_TARBALL appropriately.")
+                bb.fatal("Unable to download uninative tarball: %s" % str(exc))
+
+        cmd = e.data.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")
+        try:
+            subprocess.check_call(cmd, shell=True)
+        except subprocess.CalledProcessError as exc:
+            bb.fatal("Unable to install uninative tarball: %s" % str(exc))
+        os.chdir(olddir)
 }
 
+SSTATEPOSTUNPACKFUNCS_append = " uninative_changeinterp"
+
+PATH_prepend = "${STAGING_DIR}-uninative/${BUILD_ARCH}-linux${bindir_native}:"
+
 python uninative_changeinterp () {
     import subprocess
     import stat

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list