summaryrefslogtreecommitdiffstats
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:38 +0000
commit052349979951383258e2fda2b65d8d162bac35a0 (patch)
tree0e82973b6ecf17cc6658304b655b798a1a487165 /meta/classes/uninative.bbclass
parent73265d10da4be35cf4f8e5f5f7f040c5d7e6eda4 (diff)
downloadpoky-052349979951383258e2fda2b65d8d162bac35a0.tar.gz
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. (From OE-Core rev: f767f94295032792d84fd323bffee137a6467e01) 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"
5# Example checksums 5# Example checksums
6#UNINATIVE_CHECKSUM[i586] = "dead" 6#UNINATIVE_CHECKSUM[i586] = "dead"
7#UNINATIVE_CHECKSUM[x86_64] = "dead" 7#UNINATIVE_CHECKSUM[x86_64] = "dead"
8UNINATIVE_DLDIR ?= "${COREBASE}" 8UNINATIVE_DLDIR ?= "${DL_DIR}/uninative/"
9 9
10# https://wiki.debian.org/GCC5 10# https://wiki.debian.org/GCC5
11# We may see binaries built with gcc5 run or linked into gcc4 environment 11# We may see binaries built with gcc5 run or linked into gcc4 environment
@@ -25,27 +25,32 @@ python uninative_event_fetchloader() {
25 loader isn't already present. 25 loader isn't already present.
26 """ 26 """
27 27
28 chksum = d.getVarFlag("UNINATIVE_CHECKSUM", d.getVar("BUILD_ARCH", True), True)
29 if not chksum:
30 bb.fatal("Uninative selected but not configured correctly, please set UNINATIVE_CHECKSUM[%s]" % d.getVar("BUILD_ARCH", True))
31
28 loader = d.getVar("UNINATIVE_LOADER", True) 32 loader = d.getVar("UNINATIVE_LOADER", True)
29 if os.path.exists(loader): 33 loaderchksum = loader + ".chksum"
30 return 34 if os.path.exists(loader) and os.path.exists(loaderchksum):
35 with open(loaderchksum, "r") as f:
36 readchksum = f.read().strip()
37 if readchksum == chksum:
38 return
31 39
40 import subprocess
32 try: 41 try:
33 # Save and restore cwd as Fetch.download() does a chdir() 42 # Save and restore cwd as Fetch.download() does a chdir()
34 olddir = os.getcwd() 43 olddir = os.getcwd()
35 44
36 tarball = d.getVar("UNINATIVE_TARBALL", True) 45 tarball = d.getVar("UNINATIVE_TARBALL", True)
37 tarballdir = d.getVar("UNINATIVE_DLDIR", True) 46 tarballdir = os.path.join(d.getVar("UNINATIVE_DLDIR", True), chksum)
38 tarballpath = os.path.join(tarballdir, tarball) 47 tarballpath = os.path.join(tarballdir, tarball)
39 48
40 if not os.path.exists(tarballpath): 49 if not os.path.exists(tarballpath):
50 bb.utils.mkdirhier(tarballdir)
41 if d.getVar("UNINATIVE_URL", True) == "unset": 51 if d.getVar("UNINATIVE_URL", True) == "unset":
42 bb.fatal("Uninative selected but not configured, please set UNINATIVE_URL") 52 bb.fatal("Uninative selected but not configured, please set UNINATIVE_URL")
43 53
44 chksum = d.getVarFlag("UNINATIVE_CHECKSUM", d.getVar("BUILD_ARCH", True), True)
45 if not chksum:
46 bb.fatal("Uninative selected but not configured correctly, please set UNINATIVE_CHECKSUM[%s]" % d.getVar("BUILD_ARCH", True))
47
48
49 localdata = bb.data.createCopy(d) 54 localdata = bb.data.createCopy(d)
50 localdata.setVar('FILESPATH', "") 55 localdata.setVar('FILESPATH', "")
51 localdata.setVar('DL_DIR', tarballdir) 56 localdata.setVar('DL_DIR', tarballdir)
@@ -59,10 +64,12 @@ python uninative_event_fetchloader() {
59 if localpath != tarballpath and os.path.exists(localpath) and not os.path.exists(tarballpath): 64 if localpath != tarballpath and os.path.exists(localpath) and not os.path.exists(tarballpath):
60 os.symlink(localpath, tarballpath) 65 os.symlink(localpath, tarballpath)
61 66
62 import subprocess 67 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)
63 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")
64 subprocess.check_call(cmd, shell=True) 68 subprocess.check_call(cmd, shell=True)
65 69
70 with open(loaderchksum, "w") as f:
71 f.write(chksum)
72
66 enable_uninative(d) 73 enable_uninative(d)
67 74
68 except bb.fetch2.BBFetchException as exc: 75 except bb.fetch2.BBFetchException as exc: