summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-09-16 07:51:18 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-09-17 14:11:04 +0100
commitd7e7b991ce42439e2df8531859fafcd4a91f2ed9 (patch)
tree7c67d6a23a913ef3db8cadecacd67226310317f8
parentd6ac67f9afbd431ed308d6513730217cce0d689d (diff)
downloadpoky-d7e7b991ce42439e2df8531859fafcd4a91f2ed9.tar.gz
bitbake: data: Optimise build_dependencies a little
Instead of multiple calls to getVarFlag, make one call to getVarFlags, only expanding the flags that need to be expanded. This improves performance. (Bitbake rev: eba1e9545cc933820d40de96f023b2307b3c4d0b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/data.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py
index ecac66c6ba..876f6ca542 100644
--- a/bitbake/lib/bb/data.py
+++ b/bitbake/lib/bb/data.py
@@ -287,18 +287,19 @@ def update_data(d):
287 287
288def build_dependencies(key, keys, shelldeps, vardepvals, d): 288def build_dependencies(key, keys, shelldeps, vardepvals, d):
289 deps = set() 289 deps = set()
290 vardeps = d.getVarFlag(key, "vardeps", True)
291 try: 290 try:
292 if key[-1] == ']': 291 if key[-1] == ']':
293 vf = key[:-1].split('[') 292 vf = key[:-1].split('[')
294 value = d.getVarFlag(vf[0], vf[1], False) 293 value = d.getVarFlag(vf[0], vf[1], False)
295 else: 294 else:
296 value = d.getVar(key, False) 295 value = d.getVar(key, False)
296 varflags = d.getVarFlags(key, ["vardeps", "vardepvalue", "vardepsexclude"]) or {}
297 vardeps = varflags.get("vardeps")
297 298
298 if key in vardepvals: 299 if "vardepvalue" in varflags:
299 value = d.getVarFlag(key, "vardepvalue", True) 300 value = varflags.get("vardepvalue")
300 elif d.getVarFlag(key, "func"): 301 elif varflags.get("func"):
301 if d.getVarFlag(key, "python"): 302 if varflags.get("python"):
302 parsedvar = d.expandWithRefs(value, key) 303 parsedvar = d.expandWithRefs(value, key)
303 parser = bb.codeparser.PythonParser(key, logger) 304 parser = bb.codeparser.PythonParser(key, logger)
304 if parsedvar.value and "\t" in parsedvar.value: 305 if parsedvar.value and "\t" in parsedvar.value:
@@ -323,16 +324,14 @@ def build_dependencies(key, keys, shelldeps, vardepvals, d):
323 varflagsexcl = d.getVar('BB_SIGNATURE_EXCLUDE_FLAGS', True) 324 varflagsexcl = d.getVar('BB_SIGNATURE_EXCLUDE_FLAGS', True)
324 if varflagsexcl: 325 if varflagsexcl:
325 varfdeps = [] 326 varfdeps = []
326 varflags = d.getVarFlags(key) 327 for f in varflags:
327 if varflags: 328 if f not in varflagsexcl:
328 for f in varflags: 329 varfdeps.append('%s[%s]' % (key, f))
329 if f not in varflagsexcl:
330 varfdeps.append('%s[%s]' % (key, f))
331 if varfdeps: 330 if varfdeps:
332 deps |= set(varfdeps) 331 deps |= set(varfdeps)
333 332
334 deps |= set((vardeps or "").split()) 333 deps |= set((vardeps or "").split())
335 deps -= set((d.getVarFlag(key, "vardepsexclude", True) or "").split()) 334 deps -= set(varflags.get("vardepsexclude", "").split())
336 except Exception as e: 335 except Exception as e:
337 raise bb.data_smart.ExpansionError(key, None, e) 336 raise bb.data_smart.ExpansionError(key, None, e)
338 return deps, value 337 return deps, value