From a10301f6a90567c2d2eca9306a4b7b752f58a9c2 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 25 Nov 2013 22:59:39 +0000 Subject: bitbake: data/codeparser: Improve handling of contains functions One of the current frustrations with the sstate checksums is that code like base_contains('X', 'y',...) adds a full dependency on X and varies depend even on whitespace changes in X. This patch adds special handling of the contains functions to expand the first parameter and check for the flag specified by the second parameter (assuming its a string). The result is then appended to the value of the variable with a "Set" or "Unset" status. If the flag is added/removed, the stored variable value changes and hence the checksum changes. No dependency on X is added so it is free to change with regard to other flags or whitespace. This code is far from ideal, ideally we'd have properly typed variables however it fixes a major annoyance of the current checksums and is of enough value its worth adding in a stopgap solution. It shouldn't significantly restrict any propely typed variable implementation in future. (Bitbake rev: ed2d0a22a80299de0cfd377999950cf4b26c512e) Signed-off-by: Richard Purdie Signed-off-by: Christopher Larson Signed-off-by: Richard Purdie --- bitbake/lib/bb/data_smart.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'bitbake/lib/bb/data_smart.py') diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index a1cbaba62b..9a6f767116 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py @@ -35,6 +35,7 @@ import hashlib import bb, bb.codeparser from bb import utils from bb.COW import COWDictBase +import collections logger = logging.getLogger("BitBake.Data") @@ -88,6 +89,7 @@ class VariableParse: self.references = set() self.execs = set() + self.contains = collections.defaultdict(set) def var_sub(self, match): key = match.group()[2:-1] @@ -120,6 +122,8 @@ class VariableParse: self.references |= parser.references self.execs |= parser.execs + for k in parser.contains: + self.contains[k].update(parser.contains[k]) value = utils.better_eval(codeobj, DataContext(self.d)) return str(value) -- cgit v1.2.3-54-g00ecf