summaryrefslogtreecommitdiffstats
path: root/meta/classes/sstate.bbclass
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-06-24 00:07:01 +1200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-07-08 09:57:23 +0100
commit6677dd37ad3b1cdb8d805511c7a6234452ab77ad (patch)
treec9e59b9aabd6900d6eb29ee8f9db71c0ab182544 /meta/classes/sstate.bbclass
parente769dce794a4724e1bcfdd61652ec54d9520c29f (diff)
downloadpoky-6677dd37ad3b1cdb8d805511c7a6234452ab77ad.tar.gz
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>
Diffstat (limited to 'meta/classes/sstate.bbclass')
-rw-r--r--meta/classes/sstate.bbclass23
1 files changed, 23 insertions, 0 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 4e81fc925d..621dc37d70 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -719,6 +719,7 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d, siginfo=False):
719 719
720 ret = [] 720 ret = []
721 missed = [] 721 missed = []
722 missing = []
722 extension = ".tgz" 723 extension = ".tgz"
723 if siginfo: 724 if siginfo:
724 extension = extension + ".siginfo" 725 extension = extension + ".siginfo"
@@ -740,6 +741,18 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d, siginfo=False):
740 741
741 return spec, extrapath, tname 742 return spec, extrapath, tname
742 743
744 def sstate_pkg_to_pn(pkg, d):
745 """
746 Translate an sstate filename to a PN value by way of SSTATE_PKGSPEC. This is slightly hacky but
747 we don't have access to everything in this context.
748 """
749 pkgspec = d.getVar('SSTATE_PKGSPEC', False)
750 try:
751 idx = pkgspec.split(':').index('${PN}')
752 except ValueError:
753 bb.fatal('Unable to find ${PN} in SSTATE_PKGSPEC')
754 return pkg.split(':')[idx]
755
743 756
744 for task in range(len(sq_fn)): 757 for task in range(len(sq_fn)):
745 758
@@ -774,6 +787,8 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d, siginfo=False):
774 if localdata.getVar('BB_NO_NETWORK', True) == "1" and localdata.getVar('SSTATE_MIRROR_ALLOW_NETWORK', True) == "1": 787 if localdata.getVar('BB_NO_NETWORK', True) == "1" and localdata.getVar('SSTATE_MIRROR_ALLOW_NETWORK', True) == "1":
775 localdata.delVar('BB_NO_NETWORK') 788 localdata.delVar('BB_NO_NETWORK')
776 789
790 whitelist = bb.runqueue.get_setscene_enforce_whitelist(d)
791
777 from bb.fetch2 import FetchConnectionCache 792 from bb.fetch2 import FetchConnectionCache
778 def checkstatus_init(thread_worker): 793 def checkstatus_init(thread_worker):
779 thread_worker.connection_cache = FetchConnectionCache() 794 thread_worker.connection_cache = FetchConnectionCache()
@@ -800,6 +815,12 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d, siginfo=False):
800 except: 815 except:
801 missed.append(task) 816 missed.append(task)
802 bb.debug(2, "SState: Unsuccessful fetch test for %s" % srcuri) 817 bb.debug(2, "SState: Unsuccessful fetch test for %s" % srcuri)
818 if whitelist:
819 pn = sstate_pkg_to_pn(sstatefile, d)
820 taskname = sq_task[task]
821 if not bb.runqueue.check_setscene_enforce_whitelist(pn, taskname, whitelist):
822 missing.append(task)
823 bb.error('Sstate artifact unavailable for %s.%s' % (pn, taskname))
803 pass 824 pass
804 bb.event.fire(bb.event.ProcessProgress("Checking sstate mirror object availability", len(tasklist) - thread_worker.tasks.qsize()), d) 825 bb.event.fire(bb.event.ProcessProgress("Checking sstate mirror object availability", len(tasklist) - thread_worker.tasks.qsize()), d)
805 826
@@ -823,6 +844,8 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d, siginfo=False):
823 pool.start() 844 pool.start()
824 pool.wait_completion() 845 pool.wait_completion()
825 bb.event.fire(bb.event.ProcessFinished("Checking sstate mirror object availability"), d) 846 bb.event.fire(bb.event.ProcessFinished("Checking sstate mirror object availability"), d)
847 if whitelist and missing:
848 bb.fatal('Required artifacts were unavailable - exiting')
826 849
827 inheritlist = d.getVar("INHERIT", True) 850 inheritlist = d.getVar("INHERIT", True)
828 if "toaster" in inheritlist: 851 if "toaster" in inheritlist: