diff options
Diffstat (limited to 'meta/lib/oe/sstatesig.py')
-rw-r--r-- | meta/lib/oe/sstatesig.py | 43 |
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 |