summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-02-23 11:48:01 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-02-23 11:48:01 +0000
commit6ea24f04cd635295d826f03d9c7d8a08cc1d5b31 (patch)
tree2832426819f702aa2a1f9d21c35a4a3d6dd22f6b
parent707132c60a84cdcf50da056c68f2da7402d3b2e8 (diff)
downloadpoky-6ea24f04cd635295d826f03d9c7d8a08cc1d5b31.tar.gz
bitbake/data_smart: Improve the way lazyassignment works
Currently, if a variable has been set with ??= and the code looks it up before the data finalisation phase, no value is found. This is causes serious problems for anonymous python functions which manipulate data, or for the fetcher revision handling code where revisions can be set with ??=. There is also a significant performance implication for processing lazy assignment in finalise. Moving the check for a default value into getVarFlag addresses both the timing issue and the performace. This change gives a 7% real time performance improvement to parsing the Poky metadata. The cost of the check at this point is minimal since we have all the data flags available. This should also fix Yocto bug 752. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/data_smart.py2
-rw-r--r--bitbake/lib/bb/parse/ast.py8
2 files changed, 2 insertions, 8 deletions
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py
index 83e6f70cd7..e76fbbf6ce 100644
--- a/bitbake/lib/bb/data_smart.py
+++ b/bitbake/lib/bb/data_smart.py
@@ -298,6 +298,8 @@ class DataSmart(MutableMapping):
298 if local_var: 298 if local_var:
299 if flag in local_var: 299 if flag in local_var:
300 value = copy.copy(local_var[flag]) 300 value = copy.copy(local_var[flag])
301 elif flag == "content" and "defaultval" in local_var:
302 value = copy.copy(local_var["defaultval"])
301 if expand and value: 303 if expand and value:
302 value = self.expand(value, None) 304 value = self.expand(value, None)
303 return value 305 return value
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py
index 8fffe1e8f0..b968db40b3 100644
--- a/bitbake/lib/bb/parse/ast.py
+++ b/bitbake/lib/bb/parse/ast.py
@@ -115,9 +115,6 @@ class DataNode(AstNode):
115 if 'flag' in groupd and groupd['flag'] != None: 115 if 'flag' in groupd and groupd['flag'] != None:
116 bb.data.setVarFlag(key, groupd['flag'], val, data) 116 bb.data.setVarFlag(key, groupd['flag'], val, data)
117 elif groupd["lazyques"]: 117 elif groupd["lazyques"]:
118 assigned = bb.data.getVar("__lazy_assigned", data) or []
119 assigned.append(key)
120 bb.data.setVar("__lazy_assigned", assigned, data)
121 bb.data.setVarFlag(key, "defaultval", val, data) 118 bb.data.setVarFlag(key, "defaultval", val, data)
122 else: 119 else:
123 bb.data.setVar(key, val, data) 120 bb.data.setVar(key, val, data)
@@ -310,11 +307,6 @@ def handleInherit(statements, filename, lineno, m):
310 statements.append(InheritNode(filename, lineno, classes.split())) 307 statements.append(InheritNode(filename, lineno, classes.split()))
311 308
312def finalize(fn, d, variant = None): 309def finalize(fn, d, variant = None):
313 for lazykey in bb.data.getVar("__lazy_assigned", d) or ():
314 if bb.data.getVar(lazykey, d) is None:
315 val = bb.data.getVarFlag(lazykey, "defaultval", d)
316 bb.data.setVar(lazykey, val, d)
317
318 bb.data.expandKeys(d) 310 bb.data.expandKeys(d)
319 bb.data.update_data(d) 311 bb.data.update_data(d)
320 code = [] 312 code = []