diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-12-11 17:56:44 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-12-17 08:52:28 +0000 |
commit | a225aa3ec4726161172ca4b03d02751b1250e7ae (patch) | |
tree | cd73bc4fb6040440608d0628cd60dfaf06a81aa8 /bitbake/lib/bb/siggen.py | |
parent | 1a45c29ff13f6e78b9428336f813d0c3e0fd980a (diff) | |
download | poky-a225aa3ec4726161172ca4b03d02751b1250e7ae.tar.gz |
bitbake: siggen: Clarify which fn is meant
"fn" can mean different things in bitbake, we added support for class
extensions and then mutlticonfigs by extending it. In siggen, it generally
means that mc is prefixed to it and that it is a virtual filename.
Replace "fn" with "mcfn" in the code to make this clearer as if I'm getting
confused, everyone else likely is as well. "mcfn" is sometimes referred
to as taskfn as well but mcfn is probably the easiest to understand as the
taskname isn't included.
(Bitbake rev: e1c1139ab90f8da1b5036db11d943daefbe87859)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/siggen.py')
-rw-r--r-- | bitbake/lib/bb/siggen.py | 77 |
1 files changed, 39 insertions, 38 deletions
diff --git a/bitbake/lib/bb/siggen.py b/bitbake/lib/bb/siggen.py index 513f3811a1..f551c74890 100644 --- a/bitbake/lib/bb/siggen.py +++ b/bitbake/lib/bb/siggen.py | |||
@@ -144,7 +144,7 @@ class SignatureGenerator(object): | |||
144 | def stampcleanmask(self, stampbase, file_name, taskname, extrainfo): | 144 | def stampcleanmask(self, stampbase, file_name, taskname, extrainfo): |
145 | return ("%s.%s.%s" % (stampbase, taskname, extrainfo)).rstrip('.') | 145 | return ("%s.%s.%s" % (stampbase, taskname, extrainfo)).rstrip('.') |
146 | 146 | ||
147 | def dump_sigtask(self, fn, task, stampbase, runtime): | 147 | def dump_sigtask(self, mcfn, task, stampbase, runtime): |
148 | return | 148 | return |
149 | 149 | ||
150 | def invalidate_task(self, task, mcfn): | 150 | def invalidate_task(self, task, mcfn): |
@@ -217,15 +217,15 @@ class SignatureGeneratorBasic(SignatureGenerator): | |||
217 | else: | 217 | else: |
218 | self.twl = None | 218 | self.twl = None |
219 | 219 | ||
220 | def _build_data(self, fn, d): | 220 | def _build_data(self, mcfn, d): |
221 | 221 | ||
222 | ignore_mismatch = ((d.getVar("BB_HASH_IGNORE_MISMATCH") or '') == '1') | 222 | ignore_mismatch = ((d.getVar("BB_HASH_IGNORE_MISMATCH") or '') == '1') |
223 | tasklist, gendeps, lookupcache = bb.data.generate_dependencies(d, self.basehash_ignore_vars) | 223 | tasklist, gendeps, lookupcache = bb.data.generate_dependencies(d, self.basehash_ignore_vars) |
224 | 224 | ||
225 | taskdeps, basehash = bb.data.generate_dependency_hash(tasklist, gendeps, lookupcache, self.basehash_ignore_vars, fn) | 225 | taskdeps, basehash = bb.data.generate_dependency_hash(tasklist, gendeps, lookupcache, self.basehash_ignore_vars, mcfn) |
226 | 226 | ||
227 | for task in tasklist: | 227 | for task in tasklist: |
228 | tid = fn + ":" + task | 228 | tid = mcfn + ":" + task |
229 | if not ignore_mismatch and tid in self.basehash and self.basehash[tid] != basehash[tid]: | 229 | if not ignore_mismatch and tid in self.basehash and self.basehash[tid] != basehash[tid]: |
230 | bb.error("When reparsing %s, the basehash value changed from %s to %s. The metadata is not deterministic and this needs to be fixed." % (tid, self.basehash[tid], basehash[tid])) | 230 | bb.error("When reparsing %s, the basehash value changed from %s to %s. The metadata is not deterministic and this needs to be fixed." % (tid, self.basehash[tid], basehash[tid])) |
231 | bb.error("The following commands may help:") | 231 | bb.error("The following commands may help:") |
@@ -244,24 +244,25 @@ class SignatureGeneratorBasic(SignatureGenerator): | |||
244 | def finalise(self, fn, d, variant): | 244 | def finalise(self, fn, d, variant): |
245 | 245 | ||
246 | mc = d.getVar("__BBMULTICONFIG", False) or "" | 246 | mc = d.getVar("__BBMULTICONFIG", False) or "" |
247 | mcfn = fn | ||
247 | if variant or mc: | 248 | if variant or mc: |
248 | fn = bb.cache.realfn2virtual(fn, variant, mc) | 249 | mcfn = bb.cache.realfn2virtual(fn, variant, mc) |
249 | 250 | ||
250 | try: | 251 | try: |
251 | taskdeps, gendeps, lookupcache = self._build_data(fn, d) | 252 | taskdeps, gendeps, lookupcache = self._build_data(mcfn, d) |
252 | except bb.parse.SkipRecipe: | 253 | except bb.parse.SkipRecipe: |
253 | raise | 254 | raise |
254 | except: | 255 | except: |
255 | bb.warn("Error during finalise of %s" % fn) | 256 | bb.warn("Error during finalise of %s" % mcfn) |
256 | raise | 257 | raise |
257 | 258 | ||
258 | #Slow but can be useful for debugging mismatched basehashes | 259 | #Slow but can be useful for debugging mismatched basehashes |
259 | #for task in self.taskdeps[fn]: | 260 | #for task in self.taskdeps[mcfn]: |
260 | # self.dump_sigtask(fn, task, d.getVar("STAMP"), False) | 261 | # self.dump_sigtask(mcfn, task, d.getVar("STAMP"), False) |
261 | 262 | ||
262 | basehashes = {} | 263 | basehashes = {} |
263 | for task in taskdeps: | 264 | for task in taskdeps: |
264 | basehashes[task] = self.basehash[fn + ":" + task] | 265 | basehashes[task] = self.basehash[mcfn + ":" + task] |
265 | 266 | ||
266 | d.setVar("__siggen_basehashes", basehashes) | 267 | d.setVar("__siggen_basehashes", basehashes) |
267 | d.setVar("__siggen_gendeps", gendeps) | 268 | d.setVar("__siggen_gendeps", gendeps) |
@@ -300,33 +301,33 @@ class SignatureGeneratorBasic(SignatureGenerator): | |||
300 | 301 | ||
301 | def prep_taskhash(self, tid, deps, dataCaches): | 302 | def prep_taskhash(self, tid, deps, dataCaches): |
302 | 303 | ||
303 | (mc, _, task, fn) = bb.runqueue.split_tid_mcfn(tid) | 304 | (mc, _, task, mcfn) = bb.runqueue.split_tid_mcfn(tid) |
304 | 305 | ||
305 | self.basehash[tid] = dataCaches[mc].basetaskhash[tid] | 306 | self.basehash[tid] = dataCaches[mc].basetaskhash[tid] |
306 | self.runtaskdeps[tid] = [] | 307 | self.runtaskdeps[tid] = [] |
307 | self.file_checksum_values[tid] = [] | 308 | self.file_checksum_values[tid] = [] |
308 | recipename = dataCaches[mc].pkg_fn[fn] | 309 | recipename = dataCaches[mc].pkg_fn[mcfn] |
309 | 310 | ||
310 | self.tidtopn[tid] = recipename | 311 | self.tidtopn[tid] = recipename |
311 | 312 | ||
312 | for dep in sorted(deps, key=clean_basepath): | 313 | for dep in sorted(deps, key=clean_basepath): |
313 | (depmc, _, _, depmcfn) = bb.runqueue.split_tid_mcfn(dep) | 314 | (depmc, _, _, depmcfn) = bb.runqueue.split_tid_mcfn(dep) |
314 | depname = dataCaches[depmc].pkg_fn[depmcfn] | 315 | depname = dataCaches[depmc].pkg_fn[depmcfn] |
315 | if not self.rundep_check(fn, recipename, task, dep, depname, dataCaches): | 316 | if not self.rundep_check(mcfn, recipename, task, dep, depname, dataCaches): |
316 | continue | 317 | continue |
317 | if dep not in self.taskhash: | 318 | if dep not in self.taskhash: |
318 | bb.fatal("%s is not in taskhash, caller isn't calling in dependency order?" % dep) | 319 | bb.fatal("%s is not in taskhash, caller isn't calling in dependency order?" % dep) |
319 | self.runtaskdeps[tid].append(dep) | 320 | self.runtaskdeps[tid].append(dep) |
320 | 321 | ||
321 | if task in dataCaches[mc].file_checksums[fn]: | 322 | if task in dataCaches[mc].file_checksums[mcfn]: |
322 | if self.checksum_cache: | 323 | if self.checksum_cache: |
323 | checksums = self.checksum_cache.get_checksums(dataCaches[mc].file_checksums[fn][task], recipename, self.localdirsexclude) | 324 | checksums = self.checksum_cache.get_checksums(dataCaches[mc].file_checksums[mcfn][task], recipename, self.localdirsexclude) |
324 | else: | 325 | else: |
325 | checksums = bb.fetch2.get_file_checksums(dataCaches[mc].file_checksums[fn][task], recipename, self.localdirsexclude) | 326 | checksums = bb.fetch2.get_file_checksums(dataCaches[mc].file_checksums[mcfn][task], recipename, self.localdirsexclude) |
326 | for (f,cs) in checksums: | 327 | for (f,cs) in checksums: |
327 | self.file_checksum_values[tid].append((f,cs)) | 328 | self.file_checksum_values[tid].append((f,cs)) |
328 | 329 | ||
329 | taskdep = dataCaches[mc].task_deps[fn] | 330 | taskdep = dataCaches[mc].task_deps[mcfn] |
330 | if 'nostamp' in taskdep and task in taskdep['nostamp']: | 331 | if 'nostamp' in taskdep and task in taskdep['nostamp']: |
331 | # Nostamp tasks need an implicit taint so that they force any dependent tasks to run | 332 | # Nostamp tasks need an implicit taint so that they force any dependent tasks to run |
332 | if tid in self.taints and self.taints[tid].startswith("nostamp:"): | 333 | if tid in self.taints and self.taints[tid].startswith("nostamp:"): |
@@ -337,7 +338,7 @@ class SignatureGeneratorBasic(SignatureGenerator): | |||
337 | taint = str(uuid.uuid4()) | 338 | taint = str(uuid.uuid4()) |
338 | self.taints[tid] = "nostamp:" + taint | 339 | self.taints[tid] = "nostamp:" + taint |
339 | 340 | ||
340 | taint = self.read_taint(fn, task, dataCaches[mc].stamp[fn]) | 341 | taint = self.read_taint(mcfn, task, dataCaches[mc].stamp[mcfn]) |
341 | if taint: | 342 | if taint: |
342 | self.taints[tid] = taint | 343 | self.taints[tid] = taint |
343 | logger.warning("%s is tainted from a forced run" % tid) | 344 | logger.warning("%s is tainted from a forced run" % tid) |
@@ -382,9 +383,9 @@ class SignatureGeneratorBasic(SignatureGenerator): | |||
382 | def copy_unitaskhashes(self, targetdir): | 383 | def copy_unitaskhashes(self, targetdir): |
383 | self.unihash_cache.copyfile(targetdir) | 384 | self.unihash_cache.copyfile(targetdir) |
384 | 385 | ||
385 | def dump_sigtask(self, fn, task, stampbase, runtime): | 386 | def dump_sigtask(self, mcfn, task, stampbase, runtime): |
386 | tid = fn + ":" + task | 387 | tid = mcfn + ":" + task |
387 | mc = bb.runqueue.mc_from_tid(fn) | 388 | mc = bb.runqueue.mc_from_tid(mcfn) |
388 | referencestamp = stampbase | 389 | referencestamp = stampbase |
389 | if isinstance(runtime, str) and runtime.startswith("customfile"): | 390 | if isinstance(runtime, str) and runtime.startswith("customfile"): |
390 | sigfile = stampbase | 391 | sigfile = stampbase |
@@ -401,16 +402,16 @@ class SignatureGeneratorBasic(SignatureGenerator): | |||
401 | data['task'] = task | 402 | data['task'] = task |
402 | data['basehash_ignore_vars'] = self.basehash_ignore_vars | 403 | data['basehash_ignore_vars'] = self.basehash_ignore_vars |
403 | data['taskhash_ignore_tasks'] = self.taskhash_ignore_tasks | 404 | data['taskhash_ignore_tasks'] = self.taskhash_ignore_tasks |
404 | data['taskdeps'] = self.datacaches[mc].siggen_taskdeps[fn][task] | 405 | data['taskdeps'] = self.datacaches[mc].siggen_taskdeps[mcfn][task] |
405 | data['basehash'] = self.basehash[tid] | 406 | data['basehash'] = self.basehash[tid] |
406 | data['gendeps'] = {} | 407 | data['gendeps'] = {} |
407 | data['varvals'] = {} | 408 | data['varvals'] = {} |
408 | data['varvals'][task] = self.datacaches[mc].siggen_varvals[fn][task] | 409 | data['varvals'][task] = self.datacaches[mc].siggen_varvals[mcfn][task] |
409 | for dep in self.datacaches[mc].siggen_taskdeps[fn][task]: | 410 | for dep in self.datacaches[mc].siggen_taskdeps[mcfn][task]: |
410 | if dep in self.basehash_ignore_vars: | 411 | if dep in self.basehash_ignore_vars: |
411 | continue | 412 | continue |
412 | data['gendeps'][dep] = self.datacaches[mc].siggen_gendeps[fn][dep] | 413 | data['gendeps'][dep] = self.datacaches[mc].siggen_gendeps[mcfn][dep] |
413 | data['varvals'][dep] = self.datacaches[mc].siggen_varvals[fn][dep] | 414 | data['varvals'][dep] = self.datacaches[mc].siggen_varvals[mcfn][dep] |
414 | 415 | ||
415 | if runtime and tid in self.taskhash: | 416 | if runtime and tid in self.taskhash: |
416 | data['runtaskdeps'] = self.runtaskdeps[tid] | 417 | data['runtaskdeps'] = self.runtaskdeps[tid] |
@@ -426,7 +427,7 @@ class SignatureGeneratorBasic(SignatureGenerator): | |||
426 | data['taskhash'] = self.taskhash[tid] | 427 | data['taskhash'] = self.taskhash[tid] |
427 | data['unihash'] = self.get_unihash(tid) | 428 | data['unihash'] = self.get_unihash(tid) |
428 | 429 | ||
429 | taint = self.read_taint(fn, task, referencestamp) | 430 | taint = self.read_taint(mcfn, task, referencestamp) |
430 | if taint: | 431 | if taint: |
431 | data['taint'] = taint | 432 | data['taint'] = taint |
432 | 433 | ||
@@ -467,11 +468,11 @@ class SignatureGeneratorBasicHash(SignatureGeneratorBasic): | |||
467 | # If task is not in basehash, then error | 468 | # If task is not in basehash, then error |
468 | return self.basehash[tid] | 469 | return self.basehash[tid] |
469 | 470 | ||
470 | def stampfile(self, stampbase, fn, taskname, extrainfo, clean=False): | 471 | def stampfile(self, stampbase, mcfn, taskname, extrainfo, clean=False): |
471 | if taskname.endswith("_setscene"): | 472 | if taskname.endswith("_setscene"): |
472 | tid = fn + ":" + taskname[:-9] | 473 | tid = mcfn + ":" + taskname[:-9] |
473 | else: | 474 | else: |
474 | tid = fn + ":" + taskname | 475 | tid = mcfn + ":" + taskname |
475 | if clean: | 476 | if clean: |
476 | h = "*" | 477 | h = "*" |
477 | else: | 478 | else: |
@@ -479,8 +480,8 @@ class SignatureGeneratorBasicHash(SignatureGeneratorBasic): | |||
479 | 480 | ||
480 | return ("%s.%s.%s.%s" % (stampbase, taskname, h, extrainfo)).rstrip('.') | 481 | return ("%s.%s.%s.%s" % (stampbase, taskname, h, extrainfo)).rstrip('.') |
481 | 482 | ||
482 | def stampcleanmask(self, stampbase, fn, taskname, extrainfo): | 483 | def stampcleanmask(self, stampbase, mcfn, taskname, extrainfo): |
483 | return self.stampfile(stampbase, fn, taskname, extrainfo, clean=True) | 484 | return self.stampfile(stampbase, mcfn, taskname, extrainfo, clean=True) |
484 | 485 | ||
485 | def invalidate_task(self, task, mcfn): | 486 | def invalidate_task(self, task, mcfn): |
486 | bb.note("Tainting hash to force rebuild of task %s, %s" % (mcfn, task)) | 487 | bb.note("Tainting hash to force rebuild of task %s, %s" % (mcfn, task)) |
@@ -614,8 +615,8 @@ class SignatureGeneratorUniHashMixIn(object): | |||
614 | unihash = d.getVar('BB_UNIHASH') | 615 | unihash = d.getVar('BB_UNIHASH') |
615 | report_taskdata = d.getVar('SSTATE_HASHEQUIV_REPORT_TASKDATA') == '1' | 616 | report_taskdata = d.getVar('SSTATE_HASHEQUIV_REPORT_TASKDATA') == '1' |
616 | tempdir = d.getVar('T') | 617 | tempdir = d.getVar('T') |
617 | fn = d.getVar('BB_FILENAME') | 618 | mcfn = d.getVar('BB_FILENAME') |
618 | tid = fn + ':do_' + task | 619 | tid = mcfn + ':do_' + task |
619 | key = tid + ':' + taskhash | 620 | key = tid + ':' + taskhash |
620 | 621 | ||
621 | if self.setscenetasks and tid not in self.setscenetasks: | 622 | if self.setscenetasks and tid not in self.setscenetasks: |
@@ -674,7 +675,7 @@ class SignatureGeneratorUniHashMixIn(object): | |||
674 | 675 | ||
675 | if new_unihash != unihash: | 676 | if new_unihash != unihash: |
676 | hashequiv_logger.debug('Task %s unihash changed %s -> %s by server %s' % (taskhash, unihash, new_unihash, self.server)) | 677 | hashequiv_logger.debug('Task %s unihash changed %s -> %s by server %s' % (taskhash, unihash, new_unihash, self.server)) |
677 | bb.event.fire(bb.runqueue.taskUniHashUpdate(fn + ':do_' + task, new_unihash), d) | 678 | bb.event.fire(bb.runqueue.taskUniHashUpdate(mcfn + ':do_' + task, new_unihash), d) |
678 | self.set_unihash(tid, new_unihash) | 679 | self.set_unihash(tid, new_unihash) |
679 | d.setVar('BB_UNIHASH', new_unihash) | 680 | d.setVar('BB_UNIHASH', new_unihash) |
680 | else: | 681 | else: |
@@ -736,10 +737,10 @@ class SignatureGeneratorTestEquivHash(SignatureGeneratorUniHashMixIn, SignatureG | |||
736 | 737 | ||
737 | def dump_this_task(outfile, d): | 738 | def dump_this_task(outfile, d): |
738 | import bb.parse | 739 | import bb.parse |
739 | fn = d.getVar("BB_FILENAME") | 740 | mcfn = d.getVar("BB_FILENAME") |
740 | task = "do_" + d.getVar("BB_CURRENTTASK") | 741 | task = "do_" + d.getVar("BB_CURRENTTASK") |
741 | referencestamp = bb.parse.siggen.stampfile_base(fn) | 742 | referencestamp = bb.parse.siggen.stampfile_base(mcfn) |
742 | bb.parse.siggen.dump_sigtask(fn, task, outfile, "customfile:" + referencestamp) | 743 | bb.parse.siggen.dump_sigtask(mcfn, task, outfile, "customfile:" + referencestamp) |
743 | 744 | ||
744 | def init_colors(enable_color): | 745 | def init_colors(enable_color): |
745 | """Initialise colour dict for passing to compare_sigfiles()""" | 746 | """Initialise colour dict for passing to compare_sigfiles()""" |