command|cooker: Add reparseFiles command
Add command reparseFiles to reparse bb files in a running cooker instance. Fixes [YOCTO #1249] (Bitbake rev: de035ad99feb7644f99ad54804bf9f98cc776877) Signed-off-by: Joshua Lock <josh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
0828e6c481
commit
ba3aef9b06
|
@ -311,6 +311,14 @@ class CommandsAsync:
|
|||
command.finishAsyncCommand()
|
||||
parseFiles.needcache = True
|
||||
|
||||
def reparseFiles(self, command, params):
|
||||
"""
|
||||
Reparse .bb files
|
||||
"""
|
||||
command.cooker.reparseFiles()
|
||||
command.finishAsyncCommand()
|
||||
reparseFiles.needcache = True
|
||||
|
||||
def compareRevisions(self, command, params):
|
||||
"""
|
||||
Parse the .bb files
|
||||
|
|
|
@ -130,21 +130,8 @@ class BBCooker:
|
|||
logger.critical("Unable to import extra RecipeInfo '%s' from '%s': %s" % (cache_name, module_name, exc))
|
||||
sys.exit("FATAL: Failed to import extra cache class '%s'." % cache_name)
|
||||
|
||||
self.configuration.data = bb.data.init()
|
||||
|
||||
if not self.server_registration_cb:
|
||||
bb.data.setVar("BB_WORKERCONTEXT", "1", self.configuration.data)
|
||||
|
||||
bb.data.inheritFromOS(self.configuration.data, self.savedenv)
|
||||
|
||||
try:
|
||||
self.parseConfigurationFiles(self.configuration.prefile,
|
||||
self.configuration.postfile)
|
||||
except SyntaxError:
|
||||
sys.exit(1)
|
||||
except Exception:
|
||||
logger.exception("Error parsing configuration files")
|
||||
sys.exit(1)
|
||||
self.configuration.data = None
|
||||
self.loadConfigurationData()
|
||||
|
||||
if not self.configuration.cmd:
|
||||
self.configuration.cmd = bb.data.getVar("BB_DEFAULT_TASK", self.configuration.data, True) or "build"
|
||||
|
@ -174,6 +161,26 @@ class BBCooker:
|
|||
|
||||
self.parser = None
|
||||
|
||||
def loadConfigurationData(self):
|
||||
self.configuration.data = bb.data.init()
|
||||
|
||||
if not self.server_registration_cb:
|
||||
bb.data.setVar("BB_WORKERCONTEXT", "1", self.configuration.data)
|
||||
|
||||
bb.data.inheritFromOS(self.configuration.data, self.savedenv)
|
||||
|
||||
try:
|
||||
self.parseConfigurationFiles(self.configuration.prefile,
|
||||
self.configuration.postfile)
|
||||
except SyntaxError:
|
||||
sys.exit(1)
|
||||
except Exception:
|
||||
logger.exception("Error parsing configuration files")
|
||||
sys.exit(1)
|
||||
|
||||
if not self.configuration.cmd:
|
||||
self.configuration.cmd = bb.data.getVar("BB_DEFAULT_TASK", self.configuration.data, True) or "build"
|
||||
|
||||
def parseConfiguration(self):
|
||||
|
||||
|
||||
|
@ -566,7 +573,7 @@ class BBCooker:
|
|||
bb.data.expandKeys(localdata)
|
||||
|
||||
# Handle PREFERRED_PROVIDERS
|
||||
for p in (bb.data.getVar('PREFERRED_PROVIDERS', localdata, 1) or "").split():
|
||||
for p in (bb.data.getVar('PREFERRED_PROVIDERS', localdata, True) or "").split():
|
||||
try:
|
||||
(providee, provider) = p.split(':')
|
||||
except:
|
||||
|
@ -1062,8 +1069,8 @@ class BBCooker:
|
|||
|
||||
self.server_registration_cb(buildTargetsIdle, rq)
|
||||
|
||||
def updateCache(self):
|
||||
if self.state == state.running:
|
||||
def updateCache(self, force=False):
|
||||
if self.state == state.running and not force:
|
||||
return
|
||||
|
||||
if self.state in (state.shutdown, state.stop):
|
||||
|
@ -1073,6 +1080,8 @@ class BBCooker:
|
|||
if self.state != state.parsing:
|
||||
self.parseConfiguration ()
|
||||
|
||||
if self.status:
|
||||
del self.status
|
||||
self.status = bb.cache.CacheData(self.caches_array)
|
||||
|
||||
ignore = bb.data.getVar("ASSUME_PROVIDED", self.configuration.data, 1) or ""
|
||||
|
@ -1146,7 +1155,7 @@ class BBCooker:
|
|||
|
||||
collectlog.debug(1, "collecting .bb files")
|
||||
|
||||
files = (data.getVar( "BBFILES", self.configuration.data, 1 ) or "").split()
|
||||
files = (data.getVar( "BBFILES", self.configuration.data, True) or "").split()
|
||||
data.setVar("BBFILES", " ".join(files), self.configuration.data)
|
||||
|
||||
# Sort files by priority
|
||||
|
@ -1244,6 +1253,10 @@ class BBCooker:
|
|||
def stop(self):
|
||||
self.state = state.stop
|
||||
|
||||
def reparseFiles(self):
|
||||
self.loadConfigurationData()
|
||||
self.updateCache(force=True)
|
||||
|
||||
def server_main(cooker, func, *args):
|
||||
cooker.pre_serve()
|
||||
|
||||
|
|
Loading…
Reference in New Issue