Patchwork [bitbake-devel,12/16] data: Optimise build_dependencies a little

login
register
mail settings
Submitter Richard Purdie
Date Sept. 16, 2013, 9:53 p.m.
Message ID <1379368413-9808-12-git-send-email-richard.purdie@linuxfoundation.org>
Download mbox | patch
Permalink /patch/58203/
State Accepted
Commit eba1e9545cc933820d40de96f023b2307b3c4d0b
Headers show

Comments

Richard Purdie - Sept. 16, 2013, 9:53 p.m.
Instead of multiple calls to getVarFlag, make one call to getVarFlags, only expanding
the flags that need to be expanded. This improves performance.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/bb/data.py | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

Patch

diff --git a/lib/bb/data.py b/lib/bb/data.py
index ecac66c..876f6ca 100644
--- a/lib/bb/data.py
+++ b/lib/bb/data.py
@@ -287,18 +287,19 @@  def update_data(d):
 
 def build_dependencies(key, keys, shelldeps, vardepvals, d):
     deps = set()
-    vardeps = d.getVarFlag(key, "vardeps", True)
     try:
         if key[-1] == ']':
             vf = key[:-1].split('[')
             value = d.getVarFlag(vf[0], vf[1], False)
         else:
             value = d.getVar(key, False)
+        varflags = d.getVarFlags(key, ["vardeps", "vardepvalue", "vardepsexclude"]) or {}
+        vardeps = varflags.get("vardeps")
 
-        if key in vardepvals:
-           value =  d.getVarFlag(key, "vardepvalue", True)
-        elif d.getVarFlag(key, "func"):
-            if d.getVarFlag(key, "python"):
+        if "vardepvalue" in varflags:
+           value = varflags.get("vardepvalue")
+        elif varflags.get("func"):
+            if varflags.get("python"):
                 parsedvar = d.expandWithRefs(value, key)
                 parser = bb.codeparser.PythonParser(key, logger)
                 if parsedvar.value and "\t" in parsedvar.value:
@@ -323,16 +324,14 @@  def build_dependencies(key, keys, shelldeps, vardepvals, d):
         varflagsexcl = d.getVar('BB_SIGNATURE_EXCLUDE_FLAGS', True)
         if varflagsexcl:
             varfdeps = []
-            varflags = d.getVarFlags(key)
-            if varflags:
-                for f in varflags:
-                    if f not in varflagsexcl:
-                        varfdeps.append('%s[%s]' % (key, f))
+            for f in varflags:
+                if f not in varflagsexcl:
+                    varfdeps.append('%s[%s]' % (key, f))
             if varfdeps:
                 deps |= set(varfdeps)
 
         deps |= set((vardeps or "").split())
-        deps -= set((d.getVarFlag(key, "vardepsexclude", True) or "").split())
+        deps -= set(varflags.get("vardepsexclude", "").split())
     except Exception as e:
         raise bb.data_smart.ExpansionError(key, None, e)
     return deps, value