[bitbake-devel] [PATCH 5/8] bb/command|cooker: refactor the reparseFiles logic

Joshua Lock josh at linux.intel.com
Thu Aug 11 22:57:28 UTC 2011


Turn the reparseFiles logic into a command to reset the cooker's state
machine and a noop which triggers a cache rebuild.

The resetCooker command resets the cookers state machine such that a cache
update will be triggered by any async command which requires the cache.
The reparseFiles command remains as a noop async command that has the
needcache property set to True so that when called it ensures the cache is
built.

Patch from Richard with the addition of removing the force parameter from
the updateCache method.

CC: Richard Purdie <richard.purdie at linuxfoundation.org>
Signed-off-by: Joshua Lock <josh at linux.intel.com>
---
 lib/bb/command.py |    7 +++++++
 lib/bb/cooker.py  |    9 ++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/lib/bb/command.py b/lib/bb/command.py
index 893a6d9..41796f6 100644
--- a/lib/bb/command.py
+++ b/lib/bb/command.py
@@ -172,6 +172,13 @@ class CommandsSync:
         value = params[1]
         bb.data.setVar(varname, value, command.cooker.configuration.data)
 
+    def resetCooker(self, command, params):
+        """
+        Reset the cooker to its initial state, thus forcing a reparse for
+        any async command that has the needcache property set to True
+        """
+        command.cooker.reset()
+
 
 class CommandsAsync:
     """
diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index a8edfe7..7641d60 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -1091,8 +1091,8 @@ class BBCooker:
 
         self.server_registration_cb(buildTargetsIdle, rq)
 
-    def updateCache(self, force=False):
-        if self.state == state.running and not force:
+    def updateCache(self):
+        if self.state == state.running:
             return
 
         if self.state in (state.shutdown, state.stop):
@@ -1277,8 +1277,11 @@ class BBCooker:
         self.state = state.stop
 
     def reparseFiles(self):
+        return
+
+    def reset(self):
+        self.state = state.initial
         self.loadConfigurationData()
-        self.updateCache(force=True)
 
 def server_main(cooker, func, *args):
     cooker.pre_serve()
-- 
1.7.6





More information about the bitbake-devel mailing list