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>
This commit is contained in:
Richard Purdie 2022-12-01 22:19:14 +00:00
parent c14d8b9b6b
commit 8fe5f307e2
3 changed files with 34 additions and 5 deletions

View File

@ -238,6 +238,31 @@ class CoreRecipeInfo(RecipeInfoCommon):
cachedata.fakerootlogs[fn] = self.fakerootlogs
cachedata.extradepsfunc[fn] = self.extradepsfunc
class SiggenRecipeInfo(RecipeInfoCommon):
__slots__ = ()
classname = "SiggenRecipeInfo"
cachefile = "bb_cache_" + classname +".dat"
# we don't want to show this information in graph files so don't set cachefields
#cachefields = []
def __init__(self, filename, metadata):
self.siggen_gendeps = metadata.getVar("__siggen_gendeps", False)
self.siggen_varvals = metadata.getVar("__siggen_varvals", False)
self.siggen_taskdeps = metadata.getVar("__siggen_taskdeps", False)
@classmethod
def init_cacheData(cls, cachedata):
cachedata.siggen_taskdeps = {}
cachedata.siggen_gendeps = {}
cachedata.siggen_varvals = {}
def add_cacheData(self, cachedata, fn):
cachedata.siggen_gendeps[fn] = self.siggen_gendeps
cachedata.siggen_varvals[fn] = self.siggen_varvals
cachedata.siggen_taskdeps[fn] = self.siggen_taskdeps
def virtualfn2realfn(virtualfn):
"""
Convert a virtual file name to a real one + the associated subclass keyword

View File

@ -80,7 +80,7 @@ class SkippedPackage:
class CookerFeatures(object):
_feature_list = [HOB_EXTRA_CACHES, BASEDATASTORE_TRACKING, SEND_SANITYEVENTS] = list(range(3))
_feature_list = [HOB_EXTRA_CACHES, BASEDATASTORE_TRACKING, SEND_SANITYEVENTS, RECIPE_SIGGEN_INFO] = list(range(4))
def __init__(self):
self._features=set()
@ -367,12 +367,12 @@ class BBCooker:
if CookerFeatures.BASEDATASTORE_TRACKING in self.featureset:
self.enableDataTracking()
all_extra_cache_names = []
caches_name_array = ['bb.cache:CoreRecipeInfo']
# We hardcode all known cache types in a single place, here.
if CookerFeatures.HOB_EXTRA_CACHES in self.featureset:
all_extra_cache_names.append("bb.cache_extra:HobRecipeInfo")
caches_name_array = ['bb.cache:CoreRecipeInfo'] + all_extra_cache_names
caches_name_array.append("bb.cache_extra:HobRecipeInfo")
if CookerFeatures.RECIPE_SIGGEN_INFO in self.featureset:
caches_name_array.append("bb.cache:SiggenRecipeInfo")
# At least CoreRecipeInfo will be loaded, so caches_array will never be empty!
# This is the entry point, no further check needed!

View File

@ -252,6 +252,10 @@ class SignatureGeneratorBasic(SignatureGenerator):
basehashes[task] = self.basehash[fn + ":" + task]
d.setVar("__siggen_basehashes", basehashes)
d.setVar("__siggen_gendeps", self.gendeps[fn])
d.setVar("__siggen_varvals", self.lookupcache[fn])
d.setVar("__siggen_taskdeps", self.taskdeps[fn])
def postparsing_clean_cache(self):
#