summaryrefslogtreecommitdiffstats
path: root/lib/bb/data.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-11-25 22:59:39 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-11-26 15:32:39 +0000
commited2d0a22a80299de0cfd377999950cf4b26c512e (patch)
treeda8355663be01732cb1c7d8819de2c3706424750 /lib/bb/data.py
parent84f1dde717dac22435005b79d03ee0b80a3e8e62 (diff)
downloadbitbake-contrib-ed2d0a22a80299de0cfd377999950cf4b26c512e.tar.gz
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. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/data.py')
-rw-r--r--lib/bb/data.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/bb/data.py b/lib/bb/data.py
index bdd1e79e2..3d2c6a497 100644
--- a/lib/bb/data.py
+++ b/lib/bb/data.py
@@ -299,6 +299,21 @@ def build_dependencies(key, keys, shelldeps, varflagsexcl, d):
vardeps = varflags.get("vardeps")
value = d.getVar(key, False)
+ def handle_contains(value, contains, d):
+ newvalue = ""
+ for k in contains:
+ l = (d.getVar(k, True) or "").split()
+ for word in contains[k]:
+ if word in l:
+ newvalue += "\n%s{%s} = Set" % (k, word)
+ else:
+ newvalue += "\n%s{%s} = Unset" % (k, word)
+ if not newvalue:
+ return value
+ if not value:
+ return newvalue
+ return value + newvalue
+
if "vardepvalue" in varflags:
value = varflags.get("vardepvalue")
elif varflags.get("func"):
@@ -309,6 +324,7 @@ def build_dependencies(key, keys, shelldeps, varflagsexcl, d):
logger.warn("Variable %s contains tabs, please remove these (%s)" % (key, d.getVar("FILE", True)))
parser.parse_python(parsedvar.value)
deps = deps | parser.references
+ value = handle_contains(value, parser.contains, d)
else:
parsedvar = d.expandWithRefs(value, key)
parser = bb.codeparser.ShellParser(key, logger)
@@ -318,10 +334,12 @@ def build_dependencies(key, keys, shelldeps, varflagsexcl, d):
parser.log.flush()
deps = deps | parsedvar.references
deps = deps | (keys & parser.execs) | (keys & parsedvar.execs)
+ value = handle_contains(value, parsedvar.contains, d)
else:
parser = d.expandWithRefs(value, key)
deps |= parser.references
deps = deps | (keys & parser.execs)
+ value = handle_contains(value, parser.contains, d)
# Add varflags, assuming an exclusion list is set
if varflagsexcl: