[oe-commits] [openembedded-core] 52/54: uninative: Add checksum support

git at git.openembedded.org git at git.openembedded.org
Mon Mar 7 11:57:19 UTC 2016


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

commit 43dbb791c837c5d5af306c95db3fa8fc4a45424a
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Sun Mar 6 08:47:09 2016 +0000

    uninative: Add checksum support
    
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/classes/uninative.bbclass | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/meta/classes/uninative.bbclass b/meta/classes/uninative.bbclass
index 9561a79..3fc8b12 100644
--- a/meta/classes/uninative.bbclass
+++ b/meta/classes/uninative.bbclass
@@ -5,7 +5,7 @@ UNINATIVE_TARBALL ?= "${BUILD_ARCH}-nativesdk-libc.tar.bz2"
 # Example checksums
 #UNINATIVE_CHECKSUM[i586] = "dead"
 #UNINATIVE_CHECKSUM[x86_64] = "dead"
-UNINATIVE_DLDIR ?= "${DL_DIR}"
+UNINATIVE_DLDIR ?= "${DL_DIR}/uninative/"
 
 # https://wiki.debian.org/GCC5
 # We may see binaries built with gcc5 run or linked into gcc4 environment
@@ -25,27 +25,32 @@ python uninative_event_fetchloader() {
     loader isn't already present.
     """
 
+    chksum = d.getVarFlag("UNINATIVE_CHECKSUM", d.getVar("BUILD_ARCH", True), True)
+    if not chksum:
+        bb.fatal("Uninative selected but not configured correctly, please set UNINATIVE_CHECKSUM[%s]" % d.getVar("BUILD_ARCH", True))
+
     loader = d.getVar("UNINATIVE_LOADER", True)
-    if os.path.exists(loader):
-        return
+    loaderchksum = loader + ".chksum"
+    if os.path.exists(loader) and os.path.exists(loaderchksum):
+        with open(loaderchksum, "r") as f:
+            readchksum = f.read().strip()
+        if readchksum == chksum:
+            return
 
+    import subprocess
     try:
         # Save and restore cwd as Fetch.download() does a chdir()
         olddir = os.getcwd()
 
         tarball = d.getVar("UNINATIVE_TARBALL", True)
-        tarballdir = d.getVar("UNINATIVE_DLDIR", True)
+        tarballdir = os.path.join(d.getVar("UNINATIVE_DLDIR", True), chksum)
         tarballpath = os.path.join(tarballdir, tarball)
 
         if not os.path.exists(tarballpath):
+            bb.utils.mkdirhier(tarballdir)
             if d.getVar("UNINATIVE_URL", True) == "unset":
                 bb.fatal("Uninative selected but not configured, please set UNINATIVE_URL")
 
-            chksum = d.getVarFlag("UNINATIVE_CHECKSUM", d.getVar("BUILD_ARCH", True), True)
-            if not chksum:
-                bb.fatal("Uninative selected but not configured correctly, please set UNINATIVE_CHECKSUM[%s]" % d.getVar("BUILD_ARCH", True))
-
-
             localdata = bb.data.createCopy(d)
             localdata.setVar('FILESPATH', "")
             localdata.setVar('DL_DIR', tarballdir)
@@ -59,10 +64,12 @@ python uninative_event_fetchloader() {
             if localpath != tarballpath and os.path.exists(localpath) and not os.path.exists(tarballpath):
                     os.symlink(localpath, tarballpath)
 
-        import subprocess
-        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")
+        cmd = d.expand("mkdir -p ${STAGING_DIR}-uninative; cd ${STAGING_DIR}-uninative; tar -xjf ${UNINATIVE_DLDIR}/%s/${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" % chksum)
         subprocess.check_call(cmd, shell=True)
 
+        with open(loaderchksum, "w") as f:
+            f.write(chksum)
+
         enable_uninative(d)
 
     except bb.fetch2.BBFetchException as exc:

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


More information about the Openembedded-commits mailing list