Patchwork [bitbake-devel,05/16] data_smart: use the expand_cache in VariableParse

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

Comments

Richard Purdie - Sept. 16, 2013, 9:53 p.m.
When in VariableParse, use the expand_cache if possible rather than looking
up data. Ultimately it would come from the same place but this short cuts
a heavily used code block for speed improvements.

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

Patch

diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py
index 9be5d5e..a6a4b6c 100644
--- a/lib/bb/data_smart.py
+++ b/lib/bb/data_smart.py
@@ -94,6 +94,11 @@  class VariableParse:
             if self.varname and key:
                 if self.varname == key:
                     raise Exception("variable %s references itself!" % self.varname)
+            if key in self.d.expand_cache:
+                varparse = self.d.expand_cache[key]
+                self.references |= varparse.references
+                self.execs |= varparse.execs
+                return varparse.value
             var = self.d.getVar(key, True)
             if var is not None:
                 self.references.add(key)