mirror of
https://git.yoctoproject.org/poky
synced 2026-06-02 01:19:52 +00:00
classes/sstate: add a mode to error if sstate package unavailable
If BB_SETSCENE_ENFORCE is set to "1" and an sstate package fails to download outside of the whitelist specified by BB_SETSCENE_ENFORCE_WHITELIST, then fail immediately so you can tell that the problem was caused by failing to restore the task from sstate. Part of the implementation of [YOCTO #9367]. (From OE-Core rev: 9e711b54487c3141d7264b8cf0d74f9465020190) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
e769dce794
commit
6677dd37ad
@@ -719,6 +719,7 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d, siginfo=False):
|
||||
|
||||
ret = []
|
||||
missed = []
|
||||
missing = []
|
||||
extension = ".tgz"
|
||||
if siginfo:
|
||||
extension = extension + ".siginfo"
|
||||
@@ -740,6 +741,18 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d, siginfo=False):
|
||||
|
||||
return spec, extrapath, tname
|
||||
|
||||
def sstate_pkg_to_pn(pkg, d):
|
||||
"""
|
||||
Translate an sstate filename to a PN value by way of SSTATE_PKGSPEC. This is slightly hacky but
|
||||
we don't have access to everything in this context.
|
||||
"""
|
||||
pkgspec = d.getVar('SSTATE_PKGSPEC', False)
|
||||
try:
|
||||
idx = pkgspec.split(':').index('${PN}')
|
||||
except ValueError:
|
||||
bb.fatal('Unable to find ${PN} in SSTATE_PKGSPEC')
|
||||
return pkg.split(':')[idx]
|
||||
|
||||
|
||||
for task in range(len(sq_fn)):
|
||||
|
||||
@@ -774,6 +787,8 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d, siginfo=False):
|
||||
if localdata.getVar('BB_NO_NETWORK', True) == "1" and localdata.getVar('SSTATE_MIRROR_ALLOW_NETWORK', True) == "1":
|
||||
localdata.delVar('BB_NO_NETWORK')
|
||||
|
||||
whitelist = bb.runqueue.get_setscene_enforce_whitelist(d)
|
||||
|
||||
from bb.fetch2 import FetchConnectionCache
|
||||
def checkstatus_init(thread_worker):
|
||||
thread_worker.connection_cache = FetchConnectionCache()
|
||||
@@ -800,6 +815,12 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d, siginfo=False):
|
||||
except:
|
||||
missed.append(task)
|
||||
bb.debug(2, "SState: Unsuccessful fetch test for %s" % srcuri)
|
||||
if whitelist:
|
||||
pn = sstate_pkg_to_pn(sstatefile, d)
|
||||
taskname = sq_task[task]
|
||||
if not bb.runqueue.check_setscene_enforce_whitelist(pn, taskname, whitelist):
|
||||
missing.append(task)
|
||||
bb.error('Sstate artifact unavailable for %s.%s' % (pn, taskname))
|
||||
pass
|
||||
bb.event.fire(bb.event.ProcessProgress("Checking sstate mirror object availability", len(tasklist) - thread_worker.tasks.qsize()), d)
|
||||
|
||||
@@ -823,6 +844,8 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d, siginfo=False):
|
||||
pool.start()
|
||||
pool.wait_completion()
|
||||
bb.event.fire(bb.event.ProcessFinished("Checking sstate mirror object availability"), d)
|
||||
if whitelist and missing:
|
||||
bb.fatal('Required artifacts were unavailable - exiting')
|
||||
|
||||
inheritlist = d.getVar("INHERIT", True)
|
||||
if "toaster" in inheritlist:
|
||||
|
||||
Reference in New Issue
Block a user