summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2019-07-29 17:28:04 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-08-06 11:24:26 +0100
commita0542ed3ff700eca35f9195f743c9e28bcd50f3e (patch)
tree89365477808ad999fb35b96ab4b86d66d164a06f /meta/lib
parentbcc9f1b5f1e1c78d07b250672e4ea84d942514e5 (diff)
downloadpoky-a0542ed3ff700eca35f9195f743c9e28bcd50f3e.tar.gz
sstatesig: Updates to match bitbake siggen changes
Update the metadata to correspond to the bitbake siggen task specification format change. This standardises on "<fn>:<task>" everywhere rather than the "." delimiter that was being used in some places. This is an API breaking change but means we now have a consistent format being used throughout the codebase without compatibility APIs. (From OE-Core rev: 23db236a054ee7a989cdbbcb42ad5c6eefd4a6ae) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oe/copy_buildsystem.py2
-rw-r--r--meta/lib/oe/sstatesig.py54
2 files changed, 23 insertions, 33 deletions
diff --git a/meta/lib/oe/copy_buildsystem.py b/meta/lib/oe/copy_buildsystem.py
index 246ff58250..cb663b21c6 100644
--- a/meta/lib/oe/copy_buildsystem.py
+++ b/meta/lib/oe/copy_buildsystem.py
@@ -174,7 +174,7 @@ class BuildSystem(object):
174def generate_locked_sigs(sigfile, d): 174def generate_locked_sigs(sigfile, d):
175 bb.utils.mkdirhier(os.path.dirname(sigfile)) 175 bb.utils.mkdirhier(os.path.dirname(sigfile))
176 depd = d.getVar('BB_TASKDEPDATA', False) 176 depd = d.getVar('BB_TASKDEPDATA', False)
177 tasks = ['%s.%s' % (v[2], v[1]) for v in depd.values()] 177 tasks = ['%s:%s' % (v[2], v[1]) for v in depd.values()]
178 bb.parse.siggen.dump_lockedsigs(sigfile, tasks) 178 bb.parse.siggen.dump_lockedsigs(sigfile, tasks)
179 179
180def prune_lockedsigs(excluded_tasks, excluded_targets, lockedsigs, pruned_output): 180def prune_lockedsigs(excluded_tasks, excluded_targets, lockedsigs, pruned_output):
diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py
index 80aafa0c2d..ee4f28e5ef 100644
--- a/meta/lib/oe/sstatesig.py
+++ b/meta/lib/oe/sstatesig.py
@@ -59,7 +59,7 @@ def sstate_rundepfilter(siggen, fn, recipename, task, dep, depname, dataCache):
59 # is machine specific. 59 # is machine specific.
60 # Therefore if we're not a kernel or a module recipe (inheriting the kernel classes) 60 # Therefore if we're not a kernel or a module recipe (inheriting the kernel classes)
61 # and we reccomend a kernel-module, we exclude the dependency. 61 # and we reccomend a kernel-module, we exclude the dependency.
62 depfn = dep.rsplit(".", 1)[0] 62 depfn = dep.rsplit(":", 1)[0]
63 if dataCache and isKernel(depfn) and not isKernel(fn): 63 if dataCache and isKernel(depfn) and not isKernel(fn):
64 for pkg in dataCache.runrecs[fn]: 64 for pkg in dataCache.runrecs[fn]:
65 if " ".join(dataCache.runrecs[fn][pkg]).find("kernel-module-") != -1: 65 if " ".join(dataCache.runrecs[fn][pkg]).find("kernel-module-") != -1:
@@ -142,8 +142,10 @@ class SignatureGeneratorOEBasicHash(bb.siggen.SignatureGeneratorBasicHash):
142 self.dump_lockedsigs(sigfile) 142 self.dump_lockedsigs(sigfile)
143 return super(bb.siggen.SignatureGeneratorBasicHash, self).dump_sigs(dataCache, options) 143 return super(bb.siggen.SignatureGeneratorBasicHash, self).dump_sigs(dataCache, options)
144 144
145 def get_taskhash(self, fn, task, deps, dataCache): 145 def get_taskhash(self, tid, deps, dataCache):
146 h = super(bb.siggen.SignatureGeneratorBasicHash, self).get_taskhash(fn, task, deps, dataCache) 146 h = super(bb.siggen.SignatureGeneratorBasicHash, self).get_taskhash(tid, deps, dataCache)
147
148 (mc, _, task, fn) = bb.runqueue.split_tid_mcfn(tid)
147 149
148 recipename = dataCache.pkg_fn[fn] 150 recipename = dataCache.pkg_fn[fn]
149 self.lockedpnmap[fn] = recipename 151 self.lockedpnmap[fn] = recipename
@@ -153,34 +155,23 @@ class SignatureGeneratorOEBasicHash(bb.siggen.SignatureGeneratorBasicHash):
153 if recipename in self.unlockedrecipes: 155 if recipename in self.unlockedrecipes:
154 unlocked = True 156 unlocked = True
155 else: 157 else:
156 def get_mc(tid):
157 tid = tid.rsplit('.', 1)[0]
158 if tid.startswith('mc:'):
159 elems = tid.split(':')
160 return elems[1]
161 def recipename_from_dep(dep): 158 def recipename_from_dep(dep):
162 # The dep entry will look something like 159 fn = bb.runqueue.fn_from_tid(dep)
163 # /path/path/recipename.bb.task, virtual:native:/p/foo.bb.task,
164 # ...
165
166 fn = dep.rsplit('.', 1)[0]
167 return dataCache.pkg_fn[fn] 160 return dataCache.pkg_fn[fn]
168 161
169 mc = get_mc(fn)
170 # If any unlocked recipe is in the direct dependencies then the 162 # If any unlocked recipe is in the direct dependencies then the
171 # current recipe should be unlocked as well. 163 # current recipe should be unlocked as well.
172 depnames = [ recipename_from_dep(x) for x in deps if mc == get_mc(x)] 164 depnames = [ recipename_from_dep(x) for x in deps if mc == bb.runqueue.mc_from_tid(x)]
173 if any(x in y for y in depnames for x in self.unlockedrecipes): 165 if any(x in y for y in depnames for x in self.unlockedrecipes):
174 self.unlockedrecipes[recipename] = '' 166 self.unlockedrecipes[recipename] = ''
175 unlocked = True 167 unlocked = True
176 168
177 if not unlocked and recipename in self.lockedsigs: 169 if not unlocked and recipename in self.lockedsigs:
178 if task in self.lockedsigs[recipename]: 170 if task in self.lockedsigs[recipename]:
179 k = fn + "." + task
180 h_locked = self.lockedsigs[recipename][task][0] 171 h_locked = self.lockedsigs[recipename][task][0]
181 var = self.lockedsigs[recipename][task][1] 172 var = self.lockedsigs[recipename][task][1]
182 self.lockedhashes[k] = h_locked 173 self.lockedhashes[tid] = h_locked
183 self.taskhash[k] = h_locked 174 self.taskhash[tid] = h_locked
184 #bb.warn("Using %s %s %s" % (recipename, task, h)) 175 #bb.warn("Using %s %s %s" % (recipename, task, h))
185 176
186 if h != h_locked: 177 if h != h_locked:
@@ -192,36 +183,35 @@ class SignatureGeneratorOEBasicHash(bb.siggen.SignatureGeneratorBasicHash):
192 return h 183 return h
193 184
194 def dump_sigtask(self, fn, task, stampbase, runtime): 185 def dump_sigtask(self, fn, task, stampbase, runtime):
195 k = fn + "." + task 186 tid = fn + ":" + task
196 if k in self.lockedhashes: 187 if tid in self.lockedhashes:
197 return 188 return
198 super(bb.siggen.SignatureGeneratorBasicHash, self).dump_sigtask(fn, task, stampbase, runtime) 189 super(bb.siggen.SignatureGeneratorBasicHash, self).dump_sigtask(fn, task, stampbase, runtime)
199 190
200 def dump_lockedsigs(self, sigfile, taskfilter=None): 191 def dump_lockedsigs(self, sigfile, taskfilter=None):
201 types = {} 192 types = {}
202 for k in self.runtaskdeps: 193 for tid in self.runtaskdeps:
203 if taskfilter: 194 if taskfilter:
204 if not k in taskfilter: 195 if not tid in taskfilter:
205 continue 196 continue
206 fn = k.rsplit(".",1)[0] 197 fn = bb.runqueue.fn_from_tid(tid)
207 t = self.lockedhashfn[fn].split(" ")[1].split(":")[5] 198 t = self.lockedhashfn[fn].split(" ")[1].split(":")[5]
208 t = 't-' + t.replace('_', '-') 199 t = 't-' + t.replace('_', '-')
209 if t not in types: 200 if t not in types:
210 types[t] = [] 201 types[t] = []
211 types[t].append(k) 202 types[t].append(tid)
212 203
213 with open(sigfile, "w") as f: 204 with open(sigfile, "w") as f:
214 l = sorted(types) 205 l = sorted(types)
215 for t in l: 206 for t in l:
216 f.write('SIGGEN_LOCKEDSIGS_%s = "\\\n' % t) 207 f.write('SIGGEN_LOCKEDSIGS_%s = "\\\n' % t)
217 types[t].sort() 208 types[t].sort()
218 sortedk = sorted(types[t], key=lambda k: self.lockedpnmap[k.rsplit(".",1)[0]]) 209 sortedtid = sorted(types[t], key=lambda tid: self.lockedpnmap[bb.runqueue.fn_from_tid(tid)])
219 for k in sortedk: 210 for tid in sortedtid:
220 fn = k.rsplit(".",1)[0] 211 (_, _, task, fn) = bb.runqueue.split_tid_mcfn(tid)
221 task = k.rsplit(".",1)[1] 212 if tid not in self.taskhash:
222 if k not in self.taskhash:
223 continue 213 continue
224 f.write(" " + self.lockedpnmap[fn] + ":" + task + ":" + self.taskhash[k] + " \\\n") 214 f.write(" " + self.lockedpnmap[fn] + ":" + task + ":" + self.taskhash[tid] + " \\\n")
225 f.write(' "\n') 215 f.write(' "\n')
226 f.write('SIGGEN_LOCKEDSIGS_TYPES_%s = "%s"' % (self.machine, " ".join(l))) 216 f.write('SIGGEN_LOCKEDSIGS_TYPES_%s = "%s"' % (self.machine, " ".join(l)))
227 217
@@ -229,11 +219,11 @@ class SignatureGeneratorOEBasicHash(bb.siggen.SignatureGeneratorBasicHash):
229 with open(sigfile, "w") as f: 219 with open(sigfile, "w") as f:
230 tasks = [] 220 tasks = []
231 for taskitem in self.taskhash: 221 for taskitem in self.taskhash:
232 (fn, task) = taskitem.rsplit(".", 1) 222 (fn, task) = taskitem.rsplit(":", 1)
233 pn = self.lockedpnmap[fn] 223 pn = self.lockedpnmap[fn]
234 tasks.append((pn, task, fn, self.taskhash[taskitem])) 224 tasks.append((pn, task, fn, self.taskhash[taskitem]))
235 for (pn, task, fn, taskhash) in sorted(tasks): 225 for (pn, task, fn, taskhash) in sorted(tasks):
236 f.write('%s.%s %s %s\n' % (pn, task, fn, taskhash)) 226 f.write('%s:%s %s %s\n' % (pn, task, fn, taskhash))
237 227
238 def checkhashes(self, sq_data, missed, found, d): 228 def checkhashes(self, sq_data, missed, found, d):
239 warn_msgs = [] 229 warn_msgs = []