summaryrefslogtreecommitdiff
path: root/meta/lib/oe/sstatesig.py
diff options
context:
space:
mode:
authorHongxu Jia <hongxu.jia@windriver.com>2014-09-11 16:30:16 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-09-17 22:00:05 +0100
commit1683815695f39d4bad352348913f927ac8a1bcf5 (patch)
tree8a27a832d7246adc368f7ee4da119ebd75fdea25 /meta/lib/oe/sstatesig.py
parentb42f305ce38b9e0f1a2b7cb9586bbabcd2d27429 (diff)
downloadopenembedded-core-1683815695f39d4bad352348913f927ac8a1bcf5.tar.gz
openembedded-core-1683815695f39d4bad352348913f927ac8a1bcf5.tar.bz2
openembedded-core-1683815695f39d4bad352348913f927ac8a1bcf5.zip
sstatesig: Improve the support for locked down sstate cache usage
Add code in the sstate hash validation code to ensure it really did install these from sstate since if it didn't should to warn/abort the build. The judgment condition is: 1) If a build is replaced by locked sstate-cache, it will triger a warn/error; 2) If objects are not used from the locked cache, it will triger a warn/error; 3) Use SIGGEN_LOCKEDSIGS_CHECK_LEVEL variable controls whether this is just a warning or a fatal error or nothing to report. [YOCTO #6639] (From OE-Core rev: 305912dce61c4fed0cbf631aa98a9e6f29db88e4) Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/sstatesig.py')
-rw-r--r--meta/lib/oe/sstatesig.py43
1 files changed, 27 insertions, 16 deletions
diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py
index add26193bc..a108761972 100644
--- a/meta/lib/oe/sstatesig.py
+++ b/meta/lib/oe/sstatesig.py
@@ -92,6 +92,7 @@ class SignatureGeneratorOEBasicHash(bb.siggen.SignatureGeneratorBasicHash):
self.lockedpnmap = {}
self.lockedhashfn = {}
self.machine = data.getVar("MACHINE", True)
+ self.mismatch_msgs = []
pass
def rundep_check(self, fn, recipename, task, dep, depname, dataCache = None):
return sstate_rundepfilter(self, fn, recipename, task, dep, depname, dataCache)
@@ -109,18 +110,24 @@ class SignatureGeneratorOEBasicHash(bb.siggen.SignatureGeneratorBasicHash):
return super(bb.siggen.SignatureGeneratorBasicHash, self).dump_sigs(dataCache, options)
def get_taskhash(self, fn, task, deps, dataCache):
+ h = super(bb.siggen.SignatureGeneratorBasicHash, self).get_taskhash(fn, task, deps, dataCache)
+
recipename = dataCache.pkg_fn[fn]
self.lockedpnmap[fn] = recipename
self.lockedhashfn[fn] = dataCache.hashfn[fn]
if recipename in self.lockedsigs:
if task in self.lockedsigs[recipename]:
k = fn + "." + task
- h = self.lockedsigs[recipename][task]
- self.lockedhashes[k] = h
- self.taskhash[k] = h
+ h_locked = self.lockedsigs[recipename][task]
+ self.lockedhashes[k] = h_locked
+ self.taskhash[k] = h_locked
#bb.warn("Using %s %s %s" % (recipename, task, h))
- return h
- h = super(bb.siggen.SignatureGeneratorBasicHash, self).get_taskhash(fn, task, deps, dataCache)
+
+ if h != h_locked:
+ self.mismatch_msgs.append('The %s:%s sig (%s) changed, use locked sig %s to instead'
+ % (recipename, task, h, h_locked))
+
+ return h_locked
#bb.warn("%s %s %s" % (recipename, task, h))
return h
@@ -130,8 +137,11 @@ class SignatureGeneratorOEBasicHash(bb.siggen.SignatureGeneratorBasicHash):
return
super(bb.siggen.SignatureGeneratorBasicHash, self).dump_sigtask(fn, task, stampbase, runtime)
- def dump_lockedsigs(self):
- bb.plain("Writing locked sigs to " + os.getcwd() + "/locked-sigs.inc")
+ def dump_lockedsigs(self, sigfile=None):
+ if not sigfile:
+ sigfile = os.getcwd() + "/locked-sigs.inc"
+
+ bb.plain("Writing locked sigs to %s" % sigfile)
types = {}
for k in self.runtaskdeps:
fn = k.rsplit(".",1)[0]
@@ -140,11 +150,11 @@ class SignatureGeneratorOEBasicHash(bb.siggen.SignatureGeneratorBasicHash):
types[t] = []
types[t].append(k)
- with open("locked-sigs.inc", "w") as f:
+ with open(sigfile, "w") as f:
for t in types:
f.write('SIGGEN_LOCKEDSIGS_%s = "\\\n' % t)
types[t].sort()
- sortedk = sorted(types[t], key=lambda k: self.lockedpnmap[k.rsplit(".",1)[0]])
+ sortedk = sorted(types[t], key=lambda k: self.lockedpnmap[k.rsplit(".",1)[0]])
for k in sortedk:
fn = k.rsplit(".",1)[0]
task = k.rsplit(".",1)[1]
@@ -155,17 +165,18 @@ class SignatureGeneratorOEBasicHash(bb.siggen.SignatureGeneratorBasicHash):
f.write('SIGGEN_LOCKEDSIGS_TYPES_%s = "%s"' % (self.machine, " ".join(types.keys())))
def checkhashes(self, missed, ret, sq_fn, sq_task, sq_hash, sq_hashfn, d):
- enforce = (d.getVar("SIGGEN_ENFORCE_LOCKEDSIGS", True) or "1") == "1"
- msgs = []
+ checklevel = d.getVar("SIGGEN_LOCKEDSIGS_CHECK_LEVEL", True)
for task in range(len(sq_fn)):
if task not in ret:
for pn in self.lockedsigs:
if sq_hash[task] in self.lockedsigs[pn].itervalues():
- msgs.append("Locked sig is set for %s:%s (%s) yet not in sstate cache?" % (pn, sq_task[task], sq_hash[task]))
- if msgs and enforce:
- bb.fatal("\n".join(msgs))
- elif msgs:
- bb.warn("\n".join(msgs))
+ self.mismatch_msgs.append("Locked sig is set for %s:%s (%s) yet not in sstate cache?"
+ % (pn, sq_task[task], sq_hash[task]))
+
+ if self.mismatch_msgs and checklevel == 'warn':
+ bb.warn("\n".join(self.mismatch_msgs))
+ elif self.mismatch_msgs and checklevel == 'error':
+ bb.fatal("\n".join(self.mismatch_msgs))
# Insert these classes into siggen's namespace so it can see and select them