bb/command|cooker: refactor the reparseFiles logic

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@linuxfoundation.org>
(Bitbake rev: a98f698fe9f38310024013e58475e6d1447ee154)

Signed-off-by: Joshua Lock <josh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Joshua Lock 2011-08-09 18:27:51 -07:00 committed by Richard Purdie
parent 57fd78eae9
commit 1926591876
2 changed files with 13 additions and 3 deletions

View File

@ -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:
"""

View File

@ -1104,8 +1104,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):
@ -1290,8 +1290,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()