summaryrefslogtreecommitdiff
path: root/meta/classes/uninative.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2016-03-07 12:02:51 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-03-07 12:41:09 +0000
commitf767f94295032792d84fd323bffee137a6467e01 (patch)
treed543ba8fa0ed2b077e5d480606b318fd82e1b993 /meta/classes/uninative.bbclass
parent1a6b39ccd55e6b26f9eb4e05089b8b97396d53d5 (diff)
downloadopenembedded-core-f767f94295032792d84fd323bffee137a6467e01.tar.gz
openembedded-core-f767f94295032792d84fd323bffee137a6467e01.tar.bz2
openembedded-core-f767f94295032792d84fd323bffee137a6467e01.zip
uninative: Add checksum support
We need to be able to update uninative if the version changes. To do this, stash a checksum of the installed uninative tarball into a file. If this changes, we update uninative. For cleaner download messages, we place the tarballs into directories based on the checksum. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/uninative.bbclass')
-rw-r--r--meta/classes/uninative.bbclass29
1 files changed, 18 insertions, 11 deletions
diff --git a/meta/classes/uninative.bbclass b/meta/classes/uninative.bbclass
index 01fcbc10ca..458acb32b4 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 ?= "${COREBASE}"
+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: