From 7a8bae92ed18f5e79e4a982c226ec94e197587e8 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Fri, 20 Jan 2012 16:16:08 +0000 Subject: siggen.py: Abstract the runtime task dependency handling code in the generators This means that custom signature handlers can override specific parts of the code without having to reimplement whole functions allowing them more flexibility. (Bitbake rev: 164195c068a656733cfe7aa07369c5ed6ea62ca5) Signed-off-by: Richard Purdie --- bitbake/lib/bb/siggen.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'bitbake') diff --git a/bitbake/lib/bb/siggen.py b/bitbake/lib/bb/siggen.py index d9d0294615..f31d66a176 100644 --- a/bitbake/lib/bb/siggen.py +++ b/bitbake/lib/bb/siggen.py @@ -62,9 +62,13 @@ class SignatureGeneratorBasic(SignatureGenerator): self.runtaskdeps = {} self.gendeps = {} self.lookupcache = {} + self.pkgnameextract = re.compile("(?P.*)\..*") self.basewhitelist = set((data.getVar("BB_HASHBASE_WHITELIST", True) or "").split()) - self.taskwhitelist = data.getVar("BB_HASHTASK_WHITELIST", True) or None + self.taskwhitelist = None + self.init_rundepcheck(data) + def init_rundepcheck(self, data): + self.taskwhitelist = data.getVar("BB_HASHTASK_WHITELIST", True) or None if self.taskwhitelist: self.twl = re.compile(self.taskwhitelist) else: @@ -131,17 +135,24 @@ class SignatureGeneratorBasic(SignatureGenerator): for task in taskdeps: d.setVar("BB_BASEHASH_task-%s" % task, self.basehash[fn + "." + task]) + def rundep_check(self, fn, recipename, task, dep, depname): + # Return True if we should keep the dependency, False to drop it + # We only manipulate the dependencies for packages not in the whitelist + if self.twl and not self.twl.search(recipename): + # then process the actual dependencies + if self.twl.search(depname): + return False + return True + def get_taskhash(self, fn, task, deps, dataCache): k = fn + "." + task data = dataCache.basetaskhash[k] self.runtaskdeps[k] = [] + recipename = dataCache.pkg_fn[fn] for dep in sorted(deps, key=clean_basepath): - # We only manipulate the dependencies for packages not in the whitelist - if self.twl and not self.twl.search(dataCache.pkg_fn[fn]): - # then process the actual dependencies - dep_fn = re.search("(?P.*)\..*", dep).group('fn') - if self.twl.search(dataCache.pkg_fn[dep_fn]): - continue + depname = dataCache.pkg_fn[self.pkgnameextract.search(dep).group('fn')] + if not self.rundep_check(fn, recipename, task, dep, depname): + continue if dep not in self.taskhash: bb.fatal("%s is not in taskhash, caller isn't calling in dependency order?", dep) data = data + self.taskhash[dep] -- cgit v1.2.3-54-g00ecf