mirror of
https://git.yoctoproject.org/poky
synced 2026-09-19 09:49:33 +02:00
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>
This commit is contained in:
@@ -5,7 +5,7 @@ UNINATIVE_TARBALL ?= "${BUILD_ARCH}-nativesdk-libc.tar.bz2"
|
|||||||
# Example checksums
|
# Example checksums
|
||||||
#UNINATIVE_CHECKSUM[i586] = "dead"
|
#UNINATIVE_CHECKSUM[i586] = "dead"
|
||||||
#UNINATIVE_CHECKSUM[x86_64] = "dead"
|
#UNINATIVE_CHECKSUM[x86_64] = "dead"
|
||||||
UNINATIVE_DLDIR ?= "${COREBASE}"
|
UNINATIVE_DLDIR ?= "${DL_DIR}/uninative/"
|
||||||
|
|
||||||
# https://wiki.debian.org/GCC5
|
# https://wiki.debian.org/GCC5
|
||||||
# We may see binaries built with gcc5 run or linked into gcc4 environment
|
# 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.
|
loader isn't already present.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
loader = d.getVar("UNINATIVE_LOADER", True)
|
chksum = d.getVarFlag("UNINATIVE_CHECKSUM", d.getVar("BUILD_ARCH", True), True)
|
||||||
if os.path.exists(loader):
|
if not chksum:
|
||||||
return
|
bb.fatal("Uninative selected but not configured correctly, please set UNINATIVE_CHECKSUM[%s]" % d.getVar("BUILD_ARCH", True))
|
||||||
|
|
||||||
|
loader = d.getVar("UNINATIVE_LOADER", True)
|
||||||
|
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:
|
try:
|
||||||
# Save and restore cwd as Fetch.download() does a chdir()
|
# Save and restore cwd as Fetch.download() does a chdir()
|
||||||
olddir = os.getcwd()
|
olddir = os.getcwd()
|
||||||
|
|
||||||
tarball = d.getVar("UNINATIVE_TARBALL", True)
|
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)
|
tarballpath = os.path.join(tarballdir, tarball)
|
||||||
|
|
||||||
if not os.path.exists(tarballpath):
|
if not os.path.exists(tarballpath):
|
||||||
|
bb.utils.mkdirhier(tarballdir)
|
||||||
if d.getVar("UNINATIVE_URL", True) == "unset":
|
if d.getVar("UNINATIVE_URL", True) == "unset":
|
||||||
bb.fatal("Uninative selected but not configured, please set UNINATIVE_URL")
|
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 = bb.data.createCopy(d)
|
||||||
localdata.setVar('FILESPATH', "")
|
localdata.setVar('FILESPATH', "")
|
||||||
localdata.setVar('DL_DIR', tarballdir)
|
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):
|
if localpath != tarballpath and os.path.exists(localpath) and not os.path.exists(tarballpath):
|
||||||
os.symlink(localpath, tarballpath)
|
os.symlink(localpath, tarballpath)
|
||||||
|
|
||||||
import subprocess
|
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)
|
||||||
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)
|
subprocess.check_call(cmd, shell=True)
|
||||||
|
|
||||||
|
with open(loaderchksum, "w") as f:
|
||||||
|
f.write(chksum)
|
||||||
|
|
||||||
enable_uninative(d)
|
enable_uninative(d)
|
||||||
|
|
||||||
except bb.fetch2.BBFetchException as exc:
|
except bb.fetch2.BBFetchException as exc:
|
||||||
|
|||||||
Reference in New Issue
Block a user