cache: Add support for BB_CACHE_EXTRAVARS
PATCH v2 1/1 cache: Add support for BB_CACHE_EXTRAVARS
This allows the metadata to specify that some variables should be cached on a per recipe basis.
This is useful for example to allow RECIPE_HOSTTOOLS in OE-Core to error up front in a build if tools are missing rather than the build failing part way through.
Signed-off-by Richard Purdie <[email protected]>
--- lib/bb/cache.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
lib/bb/cache.py +11 -1
@@ -27,7 +27,7 @@ import shutil logger = logging.getLogger("BitBake.Cache") -__cache_version__ = "156" +__cache_version__ = "157" def getCacheFile(path, filename, mc, data_hash): mcspec = ''
@@ -131,6 +131,11 @@ class CoreRecipeInfo(RecipeInfoCommon): self.fakerootnoenv = self.getvar('FAKEROOTNOENV', metadata) self.extradepsfunc = self.getvar('calculate_extra_depends', metadata) + self.extravars = self.listvar('BB_CACHE_EXTRAVARS', metadata) + if self.extravars: + for var in self.extravars: + setattr(self, var, self.getvar(var, metadata)) + @classmethod def init_cacheData(cls, cachedata): # CacheData in Core RecipeInfo Class
@@ -168,6 +173,8 @@ class CoreRecipeInfo(RecipeInfoCommon): cachedata.fakerootlogs = {} cachedata.extradepsfunc = {} + cachedata.extravars = {} + def add_cacheData(self, cachedata, fn): cachedata.task_deps[fn] = self.task_deps cachedata.pkg_fn[fn] = self.pn
@@ -237,6 +244,9 @@ class CoreRecipeInfo(RecipeInfoCommon): cachedata.fakerootlogs[fn] = self.fakerootlogs cachedata.extradepsfunc[fn] = self.extradepsfunc + cachedata.extravars[fn] = {} + for var in self.extravars: + cachedata.extravars[fn][var] = getattr(self, var) class SiggenRecipeInfo(RecipeInfoCommon): __slots__ = ()