@@ -395,6 +395,11 @@ def setup_bitbake(configParams, extrafeatures=None):
# In status only mode there are no logs and no UI
logger.addHandler(handler)
+ if configParams.dump_signatures:
+ if extrafeatures is None:
+ extrafeatures = []
+ extrafeatures.append(bb.cooker.CookerFeatures.RECIPE_SIGGEN_INFO)
+
if configParams.server_only:
featureset = []
ui_module = None
@@ -1608,39 +1608,17 @@ class RunQueue:
else:
self.rqexe.finish()
- def rq_dump_sigfn(self, fn, options):
- mc = bb.runqueue.mc_from_tid(fn)
- the_data = self.cooker.databuilder.parseRecipe(fn, self.cooker.collections[mc].get_file_appends(fn))
- siggen = bb.parse.siggen
- dataCaches = self.rqdata.dataCaches
- siggen.dump_sigfn(fn, dataCaches, options)
-
def dump_signatures(self, options):
- fns = set()
- bb.note("Reparsing files to collect dependency data")
+ if bb.cooker.CookerFeatures.RECIPE_SIGGEN_INFO not in self.cooker.featureset:
+ bb.fatal("The dump signatures functionality needs the RECIPE_SIGGEN_INFO feature enabled")
+ bb.note("Writing task signature files")
for tid in self.rqdata.runtaskentries:
- fn = fn_from_tid(tid)
- fns.add(fn)
-
- max_process = int(self.cfgData.getVar("BB_NUMBER_PARSE_THREADS") or os.cpu_count() or 1)
- # We cannot use the real multiprocessing.Pool easily due to some local data
- # that can't be pickled. This is a cheap multi-process solution.
- launched = []
- while fns:
- if len(launched) < max_process:
- p = Process(target=self.rq_dump_sigfn, args=(fns.pop(), options))
- p.start()
- launched.append(p)
- for q in launched:
- # The finished processes are joined when calling is_alive()
- if not q.is_alive():
- launched.remove(q)
- for p in launched:
- p.join()
+ (mc, fn, taskname, taskfn) = split_tid_mcfn(tid)
+ dataCaches = self.rqdata.dataCaches
+ bb.parse.siggen.dump_sigtask(taskfn, taskname, dataCaches[mc].stamp[fn], True)
bb.parse.siggen.dump_sigs(self.rqdata.dataCaches, options)
-
return
def print_diffscenetasks(self):
@@ -335,8 +335,8 @@ class SignatureGeneratorBasic(SignatureGenerator):
self.unihash_cache.copyfile(targetdir)
def dump_sigtask(self, fn, task, stampbase, runtime):
-
tid = fn + ":" + task
+ mc = bb.runqueue.mc_from_tid(fn)
referencestamp = stampbase
if isinstance(runtime, str) and runtime.startswith("customfile"):
sigfile = stampbase
@@ -353,16 +353,27 @@ class SignatureGeneratorBasic(SignatureGenerator):
data['task'] = task
data['basehash_ignore_vars'] = self.basehash_ignore_vars
data['taskhash_ignore_tasks'] = self.taskhash_ignore_tasks
- data['taskdeps'] = self.taskdeps[fn][task]
+ if hasattr(self, "datacaches"):
+ data['taskdeps'] = self.datacaches[mc].siggen_taskdeps[fn][task]
+ else:
+ data['taskdeps'] = self.taskdeps[fn][task]
data['basehash'] = self.basehash[tid]
data['gendeps'] = {}
data['varvals'] = {}
- data['varvals'][task] = self.lookupcache[fn][task]
- for dep in self.taskdeps[fn][task]:
- if dep in self.basehash_ignore_vars:
- continue
- data['gendeps'][dep] = self.gendeps[fn][dep]
- data['varvals'][dep] = self.lookupcache[fn][dep]
+ if hasattr(self, "datacaches"):
+ data['varvals'][task] = self.datacaches[mc].siggen_varvals[fn][task]
+ for dep in self.datacaches[mc].siggen_taskdeps[fn][task]:
+ if dep in self.basehash_ignore_vars:
+ continue
+ data['gendeps'][dep] = self.datacaches[mc].siggen_gendeps[fn][dep]
+ data['varvals'][dep] = self.datacaches[mc].siggen_varvals[fn][dep]
+ else:
+ data['varvals'][task] = self.lookupcache[fn][task]
+ for dep in self.taskdeps[fn][task]:
+ if dep in self.basehash_ignore_vars:
+ continue
+ data['gendeps'][dep] = self.gendeps[fn][dep]
+ data['varvals'][dep] = self.lookupcache[fn][dep]
if runtime and tid in self.taskhash:
data['runtaskdeps'] = self.runtaskdeps[tid]
@@ -409,18 +420,6 @@ class SignatureGeneratorBasic(SignatureGenerator):
pass
raise err
- def dump_sigfn(self, fn, dataCaches, options):
- if fn in self.taskdeps:
- for task in self.taskdeps[fn]:
- tid = fn + ":" + task
- mc = bb.runqueue.mc_from_tid(tid)
- if tid not in self.taskhash:
- continue
- if dataCaches[mc].basetaskhash[tid] != self.basehash[tid]:
- bb.error("Bitbake's cached basehash does not match the one we just generated (%s)!" % tid)
- bb.error("The mismatched hashes were %s and %s" % (dataCaches[mc].basetaskhash[tid], self.basehash[tid]))
- self.dump_sigtask(fn, task, dataCaches[mc].stamp[fn], True)
-
class SignatureGeneratorBasicHash(SignatureGeneratorBasic):
name = "basichash"
Now that we have cache support for the taskdep/gendep/lookupcache data, we can switch to use that cooker feature and skip the secondary reparse to write the sig files. This does make the initial parse longer but means the secondary one isn't needed. At present parsing with the larger cache isn't optimal but we have plans in place which will make this faster than the current reparse code being removed here. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> --- lib/bb/main.py | 5 +++++ lib/bb/runqueue.py | 34 ++++++---------------------------- lib/bb/siggen.py | 39 +++++++++++++++++++-------------------- 3 files changed, 30 insertions(+), 48 deletions(-)