summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/sstatesig.py
diff options
context:
space:
mode:
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):
92 self.lockedpnmap = {} 92 self.lockedpnmap = {}
93 self.lockedhashfn = {} 93 self.lockedhashfn = {}
94 self.machine = data.getVar("MACHINE", True) 94 self.machine = data.getVar("MACHINE", True)
95 self.mismatch_msgs = []
95 pass 96 pass
96 def rundep_check(self, fn, recipename, task, dep, depname, dataCache = None): 97 def rundep_check(self, fn, recipename, task, dep, depname, dataCache = None):
97 return sstate_rundepfilter(self, fn, recipename, task, dep, depname, dataCache) 98 return sstate_rundepfilter(self, fn, recipename, task, dep, depname, dataCache)
@@ -109,18 +110,24 @@ class SignatureGeneratorOEBasicHash(bb.siggen.SignatureGeneratorBasicHash):
109 return super(bb.siggen.SignatureGeneratorBasicHash, self).dump_sigs(dataCache, options) 110 return super(bb.siggen.SignatureGeneratorBasicHash, self).dump_sigs(dataCache, options)
110 111
111 def get_taskhash(self, fn, task, deps, dataCache): 112 def get_taskhash(self, fn, task, deps, dataCache):
113 h = super(bb.siggen.SignatureGeneratorBasicHash, self).get_taskhash(fn, task, deps, dataCache)
114
112 recipename = dataCache.pkg_fn[fn] 115 recipename = dataCache.pkg_fn[fn]
113 self.lockedpnmap[fn] = recipename 116 self.lockedpnmap[fn] = recipename
114 self.lockedhashfn[fn] = dataCache.hashfn[fn] 117 self.lockedhashfn[fn] = dataCache.hashfn[fn]
115 if recipename in self.lockedsigs: 118 if recipename in self.lockedsigs:
116 if task in self.lockedsigs[recipename]: 119 if task in self.lockedsigs[recipename]:
117 k = fn + "." + task 120 k = fn + "." + task
118 h = self.lockedsigs[recipename][task] 121 h_locked = self.lockedsigs[recipename][task]
119 self.lockedhashes[k] = h 122 self.lockedhashes[k] = h_locked
120 self.taskhash[k] = h 123 self.taskhash[k] = h_locked
121 #bb.warn("Using %s %s %s" % (recipename, task, h)) 124 #bb.warn("Using %s %s %s" % (recipename, task, h))
122 return h 125
123 h = super(bb.siggen.SignatureGeneratorBasicHash, self).get_taskhash(fn, task, deps, dataCache) 126 if h != h_locked:
127 self.mismatch_msgs.append('The %s:%s sig (%s) changed, use locked sig %s to instead'
128 % (recipename, task, h, h_locked))
129
130 return h_locked
124 #bb.warn("%s %s %s" % (recipename, task, h)) 131 #bb.warn("%s %s %s" % (recipename, task, h))
125 return h 132 return h
126 133
@@ -130,8 +137,11 @@ class SignatureGeneratorOEBasicHash(bb.siggen.SignatureGeneratorBasicHash):
130 return 137 return
131 super(bb.siggen.SignatureGeneratorBasicHash, self).dump_sigtask(fn, task, stampbase, runtime) 138 super(bb.siggen.SignatureGeneratorBasicHash, self).dump_sigtask(fn, task, stampbase, runtime)
132 139
133 def dump_lockedsigs(self): 140 def dump_lockedsigs(self, sigfile=None):
134 bb.plain("Writing locked sigs to " + os.getcwd() + "/locked-sigs.inc") 141 if not sigfile:
142 sigfile = os.getcwd() + "/locked-sigs.inc"
143
144 bb.plain("Writing locked sigs to %s" % sigfile)
135 types = {} 145 types = {}
136 for k in self.runtaskdeps: 146 for k in self.runtaskdeps:
137 fn = k.rsplit(".",1)[0] 147 fn = k.rsplit(".",1)[0]
@@ -140,11 +150,11 @@ class SignatureGeneratorOEBasicHash(bb.siggen.SignatureGeneratorBasicHash):
140 types[t] = [] 150 types[t] = []
141 types[t].append(k) 151 types[t].append(k)
142 152
143 with open("locked-sigs.inc", "w") as f: 153 with open(sigfile, "w") as f:
144 for t in types: 154 for t in types:
145 f.write('SIGGEN_LOCKEDSIGS_%s = "\\\n' % t) 155 f.write('SIGGEN_LOCKEDSIGS_%s = "\\\n' % t)
146 types[t].sort() 156 types[t].sort()
147 sortedk = sorted(types[t], key=lambda k: self.lockedpnmap[k.rsplit(".",1)[0]]) 157 sortedk = sorted(types[t], key=lambda k: self.lockedpnmap[k.rsplit(".",1)[0]])
148 for k in sortedk: 158 for k in sortedk:
149 fn = k.rsplit(".",1)[0] 159 fn = k.rsplit(".",1)[0]
150 task = k.rsplit(".",1)[1] 160 task = k.rsplit(".",1)[1]
@@ -155,17 +165,18 @@ class SignatureGeneratorOEBasicHash(bb.siggen.SignatureGeneratorBasicHash):
155 f.write('SIGGEN_LOCKEDSIGS_TYPES_%s = "%s"' % (self.machine, " ".join(types.keys()))) 165 f.write('SIGGEN_LOCKEDSIGS_TYPES_%s = "%s"' % (self.machine, " ".join(types.keys())))
156 166
157 def checkhashes(self, missed, ret, sq_fn, sq_task, sq_hash, sq_hashfn, d): 167 def checkhashes(self, missed, ret, sq_fn, sq_task, sq_hash, sq_hashfn, d):
158 enforce = (d.getVar("SIGGEN_ENFORCE_LOCKEDSIGS", True) or "1") == "1" 168 checklevel = d.getVar("SIGGEN_LOCKEDSIGS_CHECK_LEVEL", True)
159 msgs = []
160 for task in range(len(sq_fn)): 169 for task in range(len(sq_fn)):
161 if task not in ret: 170 if task not in ret:
162 for pn in self.lockedsigs: 171 for pn in self.lockedsigs:
163 if sq_hash[task] in self.lockedsigs[pn].itervalues(): 172 if sq_hash[task] in self.lockedsigs[pn].itervalues():
164 msgs.append("Locked sig is set for %s:%s (%s) yet not in sstate cache?" % (pn, sq_task[task], sq_hash[task])) 173 self.mismatch_msgs.append("Locked sig is set for %s:%s (%s) yet not in sstate cache?"
165 if msgs and enforce: 174 % (pn, sq_task[task], sq_hash[task]))
166 bb.fatal("\n".join(msgs)) 175
167 elif msgs: 176 if self.mismatch_msgs and checklevel == 'warn':
168 bb.warn("\n".join(msgs)) 177 bb.warn("\n".join(self.mismatch_msgs))
178 elif self.mismatch_msgs and checklevel == 'error':
179 bb.fatal("\n".join(self.mismatch_msgs))
169 180
170 181
171# Insert these classes into siggen's namespace so it can see and select them 182# Insert these classes into siggen's namespace so it can see and select them