[yocto] [PATCH 04/10][auh] bitbake.py: Improve performance on env() call

Aníbal Limón anibal.limon at linux.intel.com
Wed Jul 29 13:50:47 PDT 2015


When AUH load recipe enviroment use bitbake -e call and parses the
output using regex VAR=VALUE.

For improve performance discard all the comments on cmd output adding
a output_filter using grep.

Signed-off-by: Aníbal Limón <anibal.limon at linux.intel.com>
---
 bitbake.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/bitbake.py b/bitbake.py
index 3631896..54389fb 100644
--- a/bitbake.py
+++ b/bitbake.py
@@ -42,7 +42,7 @@ class Bitbake(object):
         self.log_dir = None
         super(Bitbake, self).__init__()
 
-    def _cmd(self, recipe, options=None, env_var=None):
+    def _cmd(self, recipe, options=None, env_var=None, output_filter=None):
         cmd = ""
         if env_var is not None:
             cmd += env_var + " "
@@ -52,6 +52,9 @@ class Bitbake(object):
 
         cmd += recipe
 
+        if output_filter is not None:
+            cmd += ' |  grep ' + output_filter
+
         os.chdir(self.build_dir)
 
         try:
@@ -74,7 +77,7 @@ class Bitbake(object):
         return os.path.join(self.log_dir, "bitbake_log.txt")
 
     def env(self, recipe):
-        return self._cmd(recipe, "-e")
+        return self._cmd(recipe, "-e", output_filter="-v \"^#\"")
 
     def fetch(self, recipe):
         return self._cmd(recipe, "-c fetch")
-- 
1.9.1




More information about the yocto mailing list