2011-01-25 12:22:21 +00:00
SSTATE_VERSION = "2"
2010-08-04 10:34:18 +00:00
2011-04-07 06:53:44 +00:00
SSTATE_MANIFESTS ?= "${TMPDIR}/sstate-control"
2011-01-18 08:18:42 +00:00
SSTATE_MANFILEBASE = "${SSTATE_MANIFESTS}/manifest-${SSTATE_MANMACH}-"
2010-11-02 13:18:07 +00:00
SSTATE_MANFILEPREFIX = "${SSTATE_MANFILEBASE}${PN}"
2010-08-04 10:34:18 +00:00
2011-06-22 15:10:16 +00:00
SSTATE_PKGARCH = "${PACKAGE_ARCH}"
SSTATE_PKGSPEC = "sstate-${PN}-${PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}-${PV}-${PR}-${SSTATE_PKGARCH}-${SSTATE_VERSION}-"
2010-11-22 16:05:10 +00:00
SSTATE_PKGNAME = "${SSTATE_PKGSPEC}${BB_TASKHASH}"
2010-09-29 10:19:22 +00:00
SSTATE_PKG = "${SSTATE_DIR}/${SSTATE_PKGNAME}"
2010-08-04 10:34:18 +00:00
2010-09-29 09:57:16 +00:00
SSTATE_SCAN_CMD ?= "find ${SSTATE_BUILDDIR} \( -name "*.la" -o -name "*-config" \) -type f"
2010-08-04 10:34:18 +00:00
2010-10-05 21:21:34 +00:00
BB_HASHFILENAME = "${SSTATE_PKGNAME}"
2011-01-18 08:18:42 +00:00
SSTATE_MANMACH ?= "${SSTATE_PKGARCH}"
2011-02-23 02:32:45 +00:00
SSTATEPOSTINSTFUNCS ?= ""
2010-08-04 10:34:18 +00:00
python () {
if bb.data.inherits_class('native', d):
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
bb.data.setVar('SSTATE_PKGARCH', d.getVar('BUILD_ARCH'), d)
2011-01-18 08:18:42 +00:00
elif bb.data.inherits_class('cross', d):
2011-07-11 13:44:04 +00:00
bb.data.setVar('SSTATE_PKGARCH', bb.data.expand("${BUILD_ARCH}_${TUNE_PKGARCH}", d), d)
2011-01-18 08:18:42 +00:00
bb.data.setVar('SSTATE_MANMACH', bb.data.expand("${BUILD_ARCH}_${MACHINE}", d), d)
elif bb.data.inherits_class('crosssdk', d):
2011-07-11 13:44:04 +00:00
bb.data.setVar('SSTATE_PKGARCH', bb.data.expand("${BUILD_ARCH}_${PACKAGE_ARCH}", d), d)
2010-08-04 10:34:18 +00:00
elif bb.data.inherits_class('nativesdk', d):
2010-09-29 09:57:16 +00:00
bb.data.setVar('SSTATE_PKGARCH', bb.data.expand("${SDK_ARCH}", d), d)
2010-08-04 10:34:18 +00:00
elif bb.data.inherits_class('cross-canadian', d):
2011-07-11 13:44:04 +00:00
bb.data.setVar('SSTATE_PKGARCH', bb.data.expand("${SDK_ARCH}_${PACKAGE_ARCH}", d), d)
2011-01-18 08:18:42 +00:00
else:
bb.data.setVar('SSTATE_MANMACH', bb.data.expand("${MACHINE}", d), d)
2010-08-04 10:34:18 +00:00
# These classes encode staging paths into their scripts data so can only be
# reused if we manipulate the paths
if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross', d) or bb.data.inherits_class('sdk', d) or bb.data.inherits_class('crosssdk', d):
2010-09-29 09:57:16 +00:00
scan_cmd = "grep -Irl ${STAGING_DIR} ${SSTATE_BUILDDIR}"
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
d.setVar('SSTATE_SCAN_CMD', scan_cmd)
2010-08-04 10:34:18 +00:00
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
unique_tasks = set((d.getVar('SSTATETASKS', True) or "").split())
2011-04-07 09:38:17 +00:00
d.setVar('SSTATETASKS', " ".join(unique_tasks))
2011-01-19 11:48:55 +00:00
namemap = []
2011-04-07 09:38:17 +00:00
for task in unique_tasks:
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
namemap.append(d.getVarFlag(task, 'sstate-name'))
funcs = d.getVarFlag(task, 'prefuncs') or ""
2010-08-04 10:34:18 +00:00
funcs = "sstate_task_prefunc " + funcs
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
d.setVarFlag(task, 'prefuncs', funcs)
funcs = d.getVarFlag(task, 'postfuncs') or ""
2010-09-07 14:13:02 +00:00
funcs = funcs + " sstate_task_postfunc"
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
d.setVarFlag(task, 'postfuncs', funcs)
2011-01-19 11:48:55 +00:00
d.setVar('SSTATETASKNAMES', " ".join(namemap))
2010-08-04 10:34:18 +00:00
}
2011-01-27 20:57:54 +00:00
def sstate_init(name, task, d):
2010-08-04 10:34:18 +00:00
ss = {}
2011-01-27 20:57:54 +00:00
ss['task'] = task
2010-08-04 10:34:18 +00:00
ss['name'] = name
ss['dirs'] = []
ss['plaindirs'] = []
ss['lockfiles'] = []
2011-03-29 10:57:37 +00:00
ss['lockfiles-shared'] = []
2010-08-04 10:34:18 +00:00
return ss
2010-10-22 09:22:34 +00:00
def sstate_state_fromvars(d, task = None):
if task is None:
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
task = d.getVar('BB_CURRENTTASK', True)
2010-10-22 09:22:34 +00:00
if not task:
bb.fatal("sstate code running without task context?!")
task = task.replace("_setscene", "")
2010-08-04 10:34:18 +00:00
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
name = bb.data.expand(d.getVarFlag("do_" + task, 'sstate-name'), d)
inputs = (bb.data.expand(d.getVarFlag("do_" + task, 'sstate-inputdirs') or "", d)).split()
outputs = (bb.data.expand(d.getVarFlag("do_" + task, 'sstate-outputdirs') or "", d)).split()
plaindirs = (bb.data.expand(d.getVarFlag("do_" + task, 'sstate-plaindirs') or "", d)).split()
lockfiles = (bb.data.expand(d.getVarFlag("do_" + task, 'sstate-lockfile') or "", d)).split()
lockfilesshared = (bb.data.expand(d.getVarFlag("do_" + task, 'sstate-lockfile-shared') or "", d)).split()
interceptfuncs = (bb.data.expand(d.getVarFlag("do_" + task, 'sstate-interceptfuncs') or "", d)).split()
2010-08-04 10:34:18 +00:00
if not name or len(inputs) != len(outputs):
bb.fatal("sstate variables not setup correctly?!")
2011-01-27 20:57:54 +00:00
ss = sstate_init(name, task, d)
2010-08-04 10:34:18 +00:00
for i in range(len(inputs)):
sstate_add(ss, inputs[i], outputs[i], d)
ss['lockfiles'] = lockfiles
2011-03-29 10:57:37 +00:00
ss['lockfiles-shared'] = lockfilesshared
2010-08-04 10:34:18 +00:00
ss['plaindirs'] = plaindirs
2010-09-03 17:22:20 +00:00
ss['interceptfuncs'] = interceptfuncs
2010-08-04 10:34:18 +00:00
return ss
def sstate_add(ss, source, dest, d):
srcbase = os.path.basename(source)
ss['dirs'].append([srcbase, source, dest])
return ss
def sstate_install(ss, d):
import oe.path
sharedfiles = []
shareddirs = []
2010-09-29 09:57:16 +00:00
bb.mkdirhier(bb.data.expand("${SSTATE_MANIFESTS}", d))
manifest = bb.data.expand("${SSTATE_MANFILEPREFIX}.%s" % ss['name'], d)
2010-08-04 10:34:18 +00:00
if os.access(manifest, os.R_OK):
bb.fatal("Package already staged (%s)?!" % manifest)
locks = []
2011-03-29 10:57:37 +00:00
for lock in ss['lockfiles-shared']:
locks.append(bb.utils.lockfile(lock, True))
2010-08-04 10:34:18 +00:00
for lock in ss['lockfiles']:
locks.append(bb.utils.lockfile(lock))
for state in ss['dirs']:
oe.path.copytree(state[1], state[2])
for walkroot, dirs, files in os.walk(state[1]):
2011-09-23 17:44:34 +00:00
bb.debug(2, "Staging files from %s to %s" % (state[1], state[2]))
2010-08-04 10:34:18 +00:00
for file in files:
srcpath = os.path.join(walkroot, file)
dstpath = srcpath.replace(state[1], state[2])
2011-09-23 17:44:34 +00:00
#bb.debug(2, "Staging %s to %s" % (srcpath, dstpath))
2010-08-04 10:34:18 +00:00
sharedfiles.append(dstpath)
for dir in dirs:
2010-08-30 08:13:49 +00:00
srcdir = os.path.join(walkroot, dir)
dstdir = srcdir.replace(state[1], state[2])
2011-09-23 17:44:34 +00:00
#bb.debug(2, "Staging %s to %s" % (srcdir, dstdir))
2010-08-30 08:13:49 +00:00
if not dstdir.endswith("/"):
dstdir = dstdir + "/"
shareddirs.append(dstdir)
2010-08-04 10:34:18 +00:00
f = open(manifest, "w")
for file in sharedfiles:
f.write(file + "\n")
# We want to ensure that directories appear at the end of the manifest
# so that when we test to see if they should be deleted any contents
# added by the task will have been removed first.
2010-09-29 11:10:57 +00:00
dirs = sorted(shareddirs, key=len)
# Must remove children first, which will have a longer path than the parent
for di in reversed(dirs):
f.write(di + "\n")
2010-08-04 10:34:18 +00:00
f.close()
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
for postinst in (d.getVar('SSTATEPOSTINSTFUNCS', True) or '').split():
2011-02-23 02:32:45 +00:00
bb.build.exec_func(postinst, d)
2010-08-04 10:34:18 +00:00
for lock in locks:
bb.utils.unlockfile(lock)
def sstate_installpkg(ss, d):
import oe.path
2011-03-28 23:20:31 +00:00
def prepdir(dir):
# remove dir if it exists, ensure any parent directories do exist
if os.path.exists(dir):
oe.path.remove(dir)
bb.mkdirhier(dir)
oe.path.remove(dir)
2010-09-29 10:02:07 +00:00
sstateinst = bb.data.expand("${WORKDIR}/sstate-install-%s/" % ss['name'], d)
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
sstatepkg = d.getVar('SSTATE_PKG', True) + '_' + ss['name'] + ".tgz"
2010-08-04 10:34:18 +00:00
2010-09-29 10:02:07 +00:00
if not os.path.exists(sstatepkg):
pstaging_fetch(sstatepkg, d)
2010-08-04 10:34:18 +00:00
2010-09-29 10:02:07 +00:00
if not os.path.isfile(sstatepkg):
bb.note("Staging package %s does not exist" % sstatepkg)
2010-08-04 10:34:18 +00:00
return False
sstate_clean(ss, d)
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
d.setVar('SSTATE_INSTDIR', sstateinst)
d.setVar('SSTATE_PKG', sstatepkg)
2010-08-04 10:34:18 +00:00
bb.build.exec_func('sstate_unpack_package', d)
# Fixup hardcoded paths
2010-09-29 10:02:07 +00:00
fixmefn = sstateinst + "fixmepath"
2010-08-04 10:34:18 +00:00
if os.path.isfile(fixmefn):
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
staging = d.getVar('STAGING_DIR', True)
staging_target = d.getVar('STAGING_DIR_TARGET', True)
staging_host = d.getVar('STAGING_DIR_HOST', True)
2010-08-04 10:34:18 +00:00
fixmefd = open(fixmefn, "r")
fixmefiles = fixmefd.readlines()
fixmefd.close()
for file in fixmefiles:
2011-01-18 08:18:42 +00:00
os.system("sed -i -e s:FIXMESTAGINGDIRTARGET:%s:g %s" % (staging_target, sstateinst + file))
os.system("sed -i -e s:FIXMESTAGINGDIRHOST:%s:g %s" % (staging_host, sstateinst + file))
2010-09-29 10:02:07 +00:00
os.system("sed -i -e s:FIXMESTAGINGDIR:%s:g %s" % (staging, sstateinst + file))
2011-09-07 17:34:47 +00:00
# Need to remove this or we'd copy it into the target directory and may
# conflict with another writer
os.remove(fixmefn)
2010-08-04 10:34:18 +00:00
for state in ss['dirs']:
2011-03-28 23:20:31 +00:00
prepdir(state[1])
os.rename(sstateinst + state[0], state[1])
2010-08-04 10:34:18 +00:00
sstate_install(ss, d)
for plain in ss['plaindirs']:
2010-10-22 11:51:35 +00:00
workdir = d.getVar('WORKDIR', True)
src = sstateinst + "/" + plain.replace(workdir, '')
dest = plain
bb.mkdirhier(src)
2011-03-28 23:20:31 +00:00
prepdir(dest)
os.rename(src, dest)
2010-08-04 10:34:18 +00:00
return True
2010-10-22 09:22:34 +00:00
def sstate_clean_cachefile(ss, d):
2010-11-22 16:05:10 +00:00
import oe.path
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
sstatepkgdir = d.getVar('SSTATE_DIR', True)
sstatepkgfile = sstatepkgdir + '/' + d.getVar('SSTATE_PKGSPEC', True) + "*_" + ss['name'] + ".tgz*"
2010-11-22 16:05:10 +00:00
bb.note("Removing %s" % sstatepkgfile)
oe.path.remove(sstatepkgfile)
2010-10-22 09:22:34 +00:00
def sstate_clean_cachefiles(d):
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
for task in (d.getVar('SSTATETASKS', True) or "").split():
2010-10-22 09:22:34 +00:00
ss = sstate_state_fromvars(d, task[3:])
sstate_clean_cachefile(ss, d)
2010-08-04 10:34:18 +00:00
def sstate_clean_manifest(manifest, d):
import oe.path
mfile = open(manifest)
entries = mfile.readlines()
mfile.close()
for entry in entries:
entry = entry.strip()
2010-08-30 08:13:49 +00:00
bb.debug(2, "Removing manifest: %s" % entry)
2010-10-01 13:07:18 +00:00
# We can race against another package populating directories as we're removing them
# so we ignore errors here.
try:
if entry.endswith("/"):
if os.path.islink(entry[:-1]):
os.remove(entry[:-1])
elif os.path.exists(entry) and len(os.listdir(entry)) == 0:
os.rmdir(entry[:-1])
else:
oe.path.remove(entry)
except OSError:
pass
2010-08-04 10:34:18 +00:00
oe.path.remove(manifest)
def sstate_clean(ss, d):
2011-01-27 20:57:54 +00:00
import oe.path
2010-08-04 10:34:18 +00:00
2010-09-29 09:57:16 +00:00
manifest = bb.data.expand("${SSTATE_MANFILEPREFIX}.%s" % ss['name'], d)
2010-08-04 10:34:18 +00:00
2011-02-28 13:29:15 +00:00
if os.path.exists(manifest):
locks = []
2011-03-29 10:57:37 +00:00
for lock in ss['lockfiles-shared']:
2011-06-09 14:05:02 +00:00
locks.append(bb.utils.lockfile(lock))
2011-02-28 13:29:15 +00:00
for lock in ss['lockfiles']:
locks.append(bb.utils.lockfile(lock))
2011-01-27 20:52:33 +00:00
2011-02-28 13:29:15 +00:00
sstate_clean_manifest(manifest, d)
2010-08-04 10:34:18 +00:00
2011-02-28 13:29:15 +00:00
for lock in locks:
bb.utils.unlockfile(lock)
2010-08-04 10:34:18 +00:00
2011-02-28 13:16:41 +00:00
stfile = d.getVar("STAMP", True) + ".do_" + ss['task']
2011-10-06 22:11:18 +00:00
extrainf = d.getVarFlag("do_" + ss['task'], 'stamp-extra-info')
2011-02-28 13:16:41 +00:00
oe.path.remove(stfile)
2011-03-19 01:16:05 +00:00
oe.path.remove(stfile + "_setscene")
2011-10-06 22:11:18 +00:00
if extrainf:
oe.path.remove(stfile + ".*" + extrainf)
oe.path.remove(stfile + "_setscene" + ".*" + extrainf)
else:
oe.path.remove(stfile + ".*")
oe.path.remove(stfile + "_setscene" + ".*")
2011-01-27 20:57:54 +00:00
2010-08-27 11:33:58 +00:00
CLEANFUNCS += "sstate_cleanall"
2010-08-27 11:29:01 +00:00
2010-08-04 10:34:18 +00:00
python sstate_cleanall() {
import fnmatch
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
bb.note("Removing shared state for package %s" % d.getVar('PN', True))
2010-08-04 10:34:18 +00:00
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
manifest_dir = d.getVar('SSTATE_MANIFESTS', True)
manifest_prefix = d.getVar("SSTATE_MANFILEPREFIX", True)
2010-08-30 06:27:24 +00:00
manifest_pattern = os.path.basename(manifest_prefix) + ".*"
2010-08-04 10:34:18 +00:00
2010-08-27 11:33:58 +00:00
if not os.path.exists(manifest_dir):
return
2010-08-04 10:34:18 +00:00
for manifest in (os.listdir(manifest_dir)):
if fnmatch.fnmatch(manifest, manifest_pattern):
2011-01-19 11:48:55 +00:00
name = manifest.replace(manifest_pattern[:-1], "")
namemap = d.getVar('SSTATETASKNAMES', True).split()
tasks = d.getVar('SSTATETASKS', True).split()
2011-06-29 01:34:19 +00:00
if name not in namemap:
continue
2011-01-19 11:48:55 +00:00
taskname = tasks[namemap.index(name)]
shared_state = sstate_state_fromvars(d, taskname[3:])
sstate_clean(shared_state, d)
2010-08-04 10:34:18 +00:00
}
2011-01-18 08:18:42 +00:00
def sstate_hardcode_path(d):
# Need to remove hardcoded paths and fix these when we install the
# staging packages.
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
sstate_scan_cmd = d.getVar('SSTATE_SCAN_CMD', True)
2011-01-18 08:18:42 +00:00
p = os.popen("%s" % sstate_scan_cmd)
file_list = p.read()
if file_list == "":
p.close()
return
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
staging = d.getVar('STAGING_DIR', True)
staging_target = d.getVar('STAGING_DIR_TARGET', True)
staging_host = d.getVar('STAGING_DIR_HOST', True)
sstate_builddir = d.getVar('SSTATE_BUILDDIR', True)
2011-01-18 08:18:42 +00:00
for i in file_list.split('\n'):
2011-01-27 23:26:10 +00:00
if not i:
2011-01-27 22:34:52 +00:00
continue
2011-01-18 08:18:42 +00:00
if bb.data.inherits_class('native', d) or bb.data.inherits_class('nativesdk', d) or bb.data.inherits_class('crosssdk', d) or bb.data.inherits_class('cross-canadian', d):
cmd = "sed -i -e s:%s:FIXMESTAGINGDIR:g %s" % (staging, i)
elif bb.data.inherits_class('cross', d):
cmd = "sed -i -e s:%s:FIXMESTAGINGDIRTARGET:g %s \
sed -i -e s:%s:FIXMESTAGINGDIR:g %s" % (staging_target, i, staging, i)
else:
cmd = "sed -i -e s:%s:FIXMESTAGINGDIRHOST:g %s" % (staging_host, i)
os.system(cmd)
os.system("echo %s | sed -e 's:%s::' >> %sfixmepath" % (i, sstate_builddir, sstate_builddir))
p.close()
2010-08-04 10:34:18 +00:00
def sstate_package(ss, d):
import oe.path
2011-03-18 23:04:26 +00:00
def make_relative_symlink(path, outputpath, d):
# Replace out absolute TMPDIR paths in symlinks with relative ones
if not os.path.islink(path):
return
link = os.readlink(path)
if not os.path.isabs(link):
return
if not link.startswith(tmpdir):
return
depth = link.rpartition(tmpdir)[2].count('/')
base = link.partition(tmpdir)[2].strip()
while depth > 1:
base = "../" + base
depth -= 1
bb.debug(2, "Replacing absolute path %s with relative path %s" % (link, base))
os.remove(path)
os.symlink(base, path)
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
tmpdir = d.getVar('TMPDIR', True)
2011-03-18 23:04:26 +00:00
2010-09-29 10:02:07 +00:00
sstatebuild = bb.data.expand("${WORKDIR}/sstate-build-%s/" % ss['name'], d)
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
sstatepkg = d.getVar('SSTATE_PKG', True) + '_'+ ss['name'] + ".tgz"
2010-09-29 10:02:07 +00:00
bb.mkdirhier(sstatebuild)
bb.mkdirhier(os.path.dirname(sstatepkg))
2010-08-04 10:34:18 +00:00
for state in ss['dirs']:
srcbase = state[0].rstrip("/").rsplit('/', 1)[0]
for walkroot, dirs, files in os.walk(state[1]):
for file in files:
srcpath = os.path.join(walkroot, file)
2010-09-29 10:02:07 +00:00
dstpath = srcpath.replace(state[1], sstatebuild + state[0])
2011-03-18 23:04:26 +00:00
make_relative_symlink(srcpath, dstpath, d)
for dir in dirs:
srcpath = os.path.join(walkroot, dir)
dstpath = srcpath.replace(state[1], sstatebuild + state[0])
make_relative_symlink(srcpath, dstpath, d)
2011-09-23 17:44:34 +00:00
bb.debug(2, "Preparing tree %s for packaging at %s" % (state[1], sstatebuild + state[0]))
2011-03-18 23:04:26 +00:00
oe.path.copytree(state[1], sstatebuild + state[0])
2010-08-04 10:34:18 +00:00
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
workdir = d.getVar('WORKDIR', True)
2010-08-04 10:34:18 +00:00
for plain in ss['plaindirs']:
2010-09-29 10:02:07 +00:00
pdir = plain.replace(workdir, sstatebuild)
2010-08-04 10:34:18 +00:00
bb.mkdirhier(plain)
bb.mkdirhier(pdir)
oe.path.copytree(plain, pdir)
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
d.setVar('SSTATE_BUILDDIR', sstatebuild)
d.setVar('SSTATE_PKG', sstatepkg)
2011-01-18 08:18:42 +00:00
sstate_hardcode_path(d)
2010-08-04 10:34:18 +00:00
bb.build.exec_func('sstate_create_package', d)
2010-09-13 14:41:07 +00:00
2010-09-29 10:02:07 +00:00
bb.siggen.dump_this_task(sstatepkg + ".siginfo", d)
2010-08-04 10:34:18 +00:00
return
2010-09-29 10:02:07 +00:00
def pstaging_fetch(sstatepkg, d):
2011-02-11 13:55:07 +00:00
import bb.fetch2
2010-10-07 14:42:56 +00:00
2011-02-04 13:20:28 +00:00
# Only try and fetch if the user has configured a mirror
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
mirrors = d.getVar('SSTATE_MIRRORS', True)
2011-02-04 13:20:28 +00:00
if not mirrors:
return
2010-10-07 14:42:56 +00:00
2011-02-04 13:20:28 +00:00
# Copy the data object and override DL_DIR and SRC_URI
localdata = bb.data.createCopy(d)
bb.data.update_data(localdata)
2010-10-22 13:27:44 +00:00
2011-02-04 13:20:28 +00:00
dldir = bb.data.expand("${SSTATE_DIR}", localdata)
srcuri = "file://" + os.path.basename(sstatepkg)
2010-10-22 13:27:44 +00:00
2011-02-04 13:20:28 +00:00
bb.mkdirhier(dldir)
2010-08-04 10:34:18 +00:00
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
localdata.setVar('DL_DIR', dldir)
localdata.setVar('PREMIRRORS', mirrors)
localdata.setVar('SRC_URI', srcuri)
2011-02-04 13:20:28 +00:00
# Try a fetch from the sstate mirror, if it fails just return and
# we will build the package
try:
2011-03-08 19:07:24 +00:00
fetcher = bb.fetch2.Fetch([srcuri], localdata, cache=False)
2011-02-04 13:20:28 +00:00
fetcher.download()
# Need to optimise this, if using file:// urls, the fetcher just changes the local path
# For now work around by symlinking
localpath = bb.data.expand(fetcher.localpath(srcuri), localdata)
if localpath != sstatepkg and os.path.exists(localpath) and not os.path.exists(sstatepkg):
os.symlink(localpath, sstatepkg)
except bb.fetch2.BBFetchException:
pass
2010-08-04 10:34:18 +00:00
def sstate_setscene(d):
shared_state = sstate_state_fromvars(d)
accelerate = sstate_installpkg(shared_state, d)
if not accelerate:
raise bb.build.FuncFailed("No suitable staging package found")
python sstate_task_prefunc () {
shared_state = sstate_state_fromvars(d)
sstate_clean(shared_state, d)
}
python sstate_task_postfunc () {
shared_state = sstate_state_fromvars(d)
sstate_install(shared_state, d)
2010-09-03 17:22:20 +00:00
for intercept in shared_state['interceptfuncs']:
bb.build.exec_func(intercept, d)
2010-08-04 10:34:18 +00:00
sstate_package(shared_state, d)
}
#
2010-09-29 10:02:07 +00:00
# Shell function to generate a sstate package from a directory
2010-09-29 09:57:16 +00:00
# set as SSTATE_BUILDDIR
2010-08-04 10:34:18 +00:00
#
sstate_create_package () {
2010-09-29 09:57:16 +00:00
cd ${SSTATE_BUILDDIR}
2011-01-26 11:36:24 +00:00
# Need to handle empty directories
if [ "$(ls -A)" ]; then
2011-01-27 22:38:11 +00:00
tar -czf ${SSTATE_PKG} *
2011-01-26 11:36:24 +00:00
else
2011-01-27 22:38:11 +00:00
tar -cz --file=${SSTATE_PKG} --files-from=/dev/null
2011-01-26 11:36:24 +00:00
fi
2010-11-11 08:27:05 +00:00
cd ${WORKDIR}
rm -rf ${SSTATE_BUILDDIR}
2010-08-04 10:34:18 +00:00
}
#
# Shell function to decompress and prepare a package for installation
#
sstate_unpack_package () {
2010-09-29 09:57:16 +00:00
mkdir -p ${SSTATE_INSTDIR}
cd ${SSTATE_INSTDIR}
tar -xvzf ${SSTATE_PKG}
2010-08-04 10:34:18 +00:00
}
2010-10-05 21:21:34 +00:00
BB_HASHCHECK_FUNCTION = "sstate_checkhashes"
def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d):
2010-10-07 14:42:56 +00:00
2010-10-05 21:21:34 +00:00
ret = []
# This needs to go away, FIXME
mapping = {
"do_populate_sysroot" : "populate-sysroot",
2011-02-03 12:33:18 +00:00
"do_populate_lic" : "populate-lic",
2010-10-05 21:21:34 +00:00
"do_package_write_ipk" : "deploy-ipk",
"do_package_write_deb" : "deploy-deb",
"do_package_write_rpm" : "deploy-rpm",
"do_package" : "package",
"do_deploy" : "deploy",
}
for task in range(len(sq_fn)):
sstatefile = bb.data.expand("${SSTATE_DIR}/" + sq_hashfn[task] + "_" + mapping[sq_task[task]] + ".tgz", d)
2010-10-07 14:42:56 +00:00
sstatefile = sstatefile.replace("${BB_TASKHASH}", sq_hash[task])
2010-10-05 21:21:34 +00:00
if os.path.exists(sstatefile):
2011-08-10 18:39:31 +00:00
bb.debug(2, "SState: Found valid sstate file %s" % sstatefile)
2010-10-05 21:21:34 +00:00
ret.append(task)
2010-10-07 14:42:56 +00:00
continue
2011-08-10 18:39:31 +00:00
else:
bb.debug(2, "SState: Looked for but didn't find file %s" % sstatefile)
2010-10-07 14:42:56 +00:00
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
mirrors = d.getVar("SSTATE_MIRRORS", True)
2010-10-07 14:42:56 +00:00
if mirrors:
# Copy the data object and override DL_DIR and SRC_URI
localdata = bb.data.createCopy(d)
bb.data.update_data(localdata)
dldir = bb.data.expand("${SSTATE_DIR}", localdata)
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
localdata.setVar('DL_DIR', dldir)
localdata.setVar('PREMIRRORS', mirrors)
2010-10-07 14:42:56 +00:00
2011-08-10 18:39:31 +00:00
bb.debug(2, "SState using premirror of: %s" % mirrors)
2010-10-07 14:42:56 +00:00
for task in range(len(sq_fn)):
if task in ret:
continue
sstatefile = bb.data.expand("${SSTATE_DIR}/" + sq_hashfn[task] + "_" + mapping[sq_task[task]] + ".tgz", d)
sstatefile = sstatefile.replace("${BB_TASKHASH}", sq_hash[task])
srcuri = "file://" + os.path.basename(sstatefile)
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
localdata.setVar('SRC_URI', srcuri)
2011-08-10 18:39:31 +00:00
bb.debug(2, "SState: Attempting to fetch %s" % srcuri)
2010-10-07 14:42:56 +00:00
try:
2011-02-11 13:55:07 +00:00
fetcher = bb.fetch2.Fetch(srcuri.split(), localdata)
fetcher.checkstatus()
2011-08-10 18:39:31 +00:00
bb.debug(2, "SState: Successful fetch test for %s" % srcuri)
2010-10-07 14:42:56 +00:00
ret.append(task)
except:
2011-08-10 18:39:31 +00:00
bb.debug(2, "SState: Unsuccessful fetch test for %s" % srcuri)
2010-10-07 14:42:56 +00:00
pass
2010-10-05 21:21:34 +00:00
return ret