summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-12-01 22:19:14 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-12-08 10:49:53 +0000
commit8fe5f307e2921e3ecf46e2b45f89fd1982680315 (patch)
treef2447d528e4058fa71c4fe2fe18c6f8d8a243735
parentc14d8b9b6bd3a6fa4bae93c65425aaa936336546 (diff)
downloadpoky-8fe5f307e2921e3ecf46e2b45f89fd1982680315.tar.gz
bitbake: siggen/cache: Optionally allow adding siggen hash data to the bitbake cache
Being able to track siggen hash construction data can be useful for cache debugging. For now, add an extra cache class which contains this information. It can be enabled in the same way as the hob data cache through a feature flag to cooker. This allows us to experiment with the data without carrying larger patches around and ultimately may allow use to have a hash mismatch debugging mode that is more easily enabled. (Bitbake rev: 0736a8a03da8b774fafbd28f746bef4705378049) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/cache.py25
-rw-r--r--bitbake/lib/bb/cooker.py10
-rw-r--r--bitbake/lib/bb/siggen.py4
3 files changed, 34 insertions, 5 deletions
diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py
index e117fe56cb..96ab069180 100644
--- a/bitbake/lib/bb/cache.py
+++ b/bitbake/lib/bb/cache.py
@@ -238,6 +238,31 @@ class CoreRecipeInfo(RecipeInfoCommon):
238 cachedata.fakerootlogs[fn] = self.fakerootlogs 238 cachedata.fakerootlogs[fn] = self.fakerootlogs
239 cachedata.extradepsfunc[fn] = self.extradepsfunc 239 cachedata.extradepsfunc[fn] = self.extradepsfunc
240 240
241
242class SiggenRecipeInfo(RecipeInfoCommon):
243 __slots__ = ()
244
245 classname = "SiggenRecipeInfo"
246 cachefile = "bb_cache_" + classname +".dat"
247 # we don't want to show this information in graph files so don't set cachefields
248 #cachefields = []
249
250 def __init__(self, filename, metadata):
251 self.siggen_gendeps = metadata.getVar("__siggen_gendeps", False)
252 self.siggen_varvals = metadata.getVar("__siggen_varvals", False)
253 self.siggen_taskdeps = metadata.getVar("__siggen_taskdeps", False)
254
255 @classmethod
256 def init_cacheData(cls, cachedata):
257 cachedata.siggen_taskdeps = {}
258 cachedata.siggen_gendeps = {}
259 cachedata.siggen_varvals = {}
260
261 def add_cacheData(self, cachedata, fn):
262 cachedata.siggen_gendeps[fn] = self.siggen_gendeps
263 cachedata.siggen_varvals[fn] = self.siggen_varvals
264 cachedata.siggen_taskdeps[fn] = self.siggen_taskdeps
265
241def virtualfn2realfn(virtualfn): 266def virtualfn2realfn(virtualfn):
242 """ 267 """
243 Convert a virtual file name to a real one + the associated subclass keyword 268 Convert a virtual file name to a real one + the associated subclass keyword
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 5a5ba7fb70..4be95dd7fb 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -80,7 +80,7 @@ class SkippedPackage:
80 80
81 81
82class CookerFeatures(object): 82class CookerFeatures(object):
83 _feature_list = [HOB_EXTRA_CACHES, BASEDATASTORE_TRACKING, SEND_SANITYEVENTS] = list(range(3)) 83 _feature_list = [HOB_EXTRA_CACHES, BASEDATASTORE_TRACKING, SEND_SANITYEVENTS, RECIPE_SIGGEN_INFO] = list(range(4))
84 84
85 def __init__(self): 85 def __init__(self):
86 self._features=set() 86 self._features=set()
@@ -367,12 +367,12 @@ class BBCooker:
367 if CookerFeatures.BASEDATASTORE_TRACKING in self.featureset: 367 if CookerFeatures.BASEDATASTORE_TRACKING in self.featureset:
368 self.enableDataTracking() 368 self.enableDataTracking()
369 369
370 all_extra_cache_names = [] 370 caches_name_array = ['bb.cache:CoreRecipeInfo']
371 # We hardcode all known cache types in a single place, here. 371 # We hardcode all known cache types in a single place, here.
372 if CookerFeatures.HOB_EXTRA_CACHES in self.featureset: 372 if CookerFeatures.HOB_EXTRA_CACHES in self.featureset:
373 all_extra_cache_names.append("bb.cache_extra:HobRecipeInfo") 373 caches_name_array.append("bb.cache_extra:HobRecipeInfo")
374 374 if CookerFeatures.RECIPE_SIGGEN_INFO in self.featureset:
375 caches_name_array = ['bb.cache:CoreRecipeInfo'] + all_extra_cache_names 375 caches_name_array.append("bb.cache:SiggenRecipeInfo")
376 376
377 # At least CoreRecipeInfo will be loaded, so caches_array will never be empty! 377 # At least CoreRecipeInfo will be loaded, so caches_array will never be empty!
378 # This is the entry point, no further check needed! 378 # This is the entry point, no further check needed!
diff --git a/bitbake/lib/bb/siggen.py b/bitbake/lib/bb/siggen.py
index 34b71d596a..3731cd6b69 100644
--- a/bitbake/lib/bb/siggen.py
+++ b/bitbake/lib/bb/siggen.py
@@ -252,6 +252,10 @@ class SignatureGeneratorBasic(SignatureGenerator):
252 basehashes[task] = self.basehash[fn + ":" + task] 252 basehashes[task] = self.basehash[fn + ":" + task]
253 253
254 d.setVar("__siggen_basehashes", basehashes) 254 d.setVar("__siggen_basehashes", basehashes)
255 d.setVar("__siggen_gendeps", self.gendeps[fn])
256 d.setVar("__siggen_varvals", self.lookupcache[fn])
257 d.setVar("__siggen_taskdeps", self.taskdeps[fn])
258
255 259
256 def postparsing_clean_cache(self): 260 def postparsing_clean_cache(self):
257 # 261 #