diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2009-07-08 22:46:09 +0100 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2009-07-08 22:46:09 +0100 |
commit | 433f50435e2227c66114223a2e2c9c88a5ffeed3 (patch) | |
tree | 6ae23a6032aa661d348254ab6afec727f2f3b9ed /bitbake-dev/lib/bb/command.py | |
parent | 67d169aa1ce9ce435989e1416b94f64652b1883d (diff) | |
download | openembedded-core-433f50435e2227c66114223a2e2c9c88a5ffeed3.tar.gz openembedded-core-433f50435e2227c66114223a2e2c9c88a5ffeed3.tar.bz2 openembedded-core-433f50435e2227c66114223a2e2c9c88a5ffeed3.zip |
bitbake-dev: Turn parsing into a server idle callback allowing the client to interrupt parsing and improving user interactvity. Also now specify whether async commands need the cache or not
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake-dev/lib/bb/command.py')
-rw-r--r-- | bitbake-dev/lib/bb/command.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/bitbake-dev/lib/bb/command.py b/bitbake-dev/lib/bb/command.py index b94756649b..8667736fa1 100644 --- a/bitbake-dev/lib/bb/command.py +++ b/bitbake-dev/lib/bb/command.py @@ -57,16 +57,18 @@ class Command: async_cmds[command] = (method) def runCommand(self, commandline): + bb.debug("Running command %s" % commandline) try: command = commandline.pop(0) if command in CommandsSync.__dict__: - # Can run online commands straight away + # Can run synchronous commands straight away return getattr(CommandsSync, command)(self.cmds_sync, self, commandline) if self.currentAsyncCommand is not None: return "Busy (%s in progress)" % self.currentAsyncCommand[0] if command not in CommandsAsync.__dict__: return "No such command" self.currentAsyncCommand = (command, commandline) + self.cooker.server.register_idle_function(self.cooker.runCommands, self.cooker) return True except: import traceback @@ -76,10 +78,20 @@ class Command: try: if self.currentAsyncCommand is not None: (command, options) = self.currentAsyncCommand - getattr(CommandsAsync, command)(self.cmds_async, self, options) + commandmethod = getattr(CommandsAsync, command) + needcache = getattr( commandmethod, "needcache" ) + if needcache and self.cooker.cookerState != bb.cooker.cookerParsed: + self.cooker.updateCache() + return True + else: + commandmethod(self.cmds_async, self, options) + return False + else: + return False except: import traceback self.finishAsyncCommand(traceback.format_exc()) + return False def finishAsyncCommand(self, error = None): if error: @@ -149,6 +161,7 @@ class CommandsAsync: task = params[1] command.cooker.buildFile(bfile, task) + buildFile.needcache = False def buildTargets(self, command, params): """ @@ -158,6 +171,7 @@ class CommandsAsync: task = params[1] command.cooker.buildTargets(pkgs_to_build, task) + buildTargets.needcache = True def generateDepTreeEvent(self, command, params): """ @@ -168,6 +182,7 @@ class CommandsAsync: command.cooker.generateDepTreeEvent(pkgs_to_build, task) command.finishAsyncCommand() + generateDepTreeEvent.needcache = True def generateDotGraph(self, command, params): """ @@ -178,6 +193,7 @@ class CommandsAsync: command.cooker.generateDotGraphFiles(pkgs_to_build, task) command.finishAsyncCommand() + generateDotGraph.needcache = True def showVersions(self, command, params): """ @@ -185,6 +201,7 @@ class CommandsAsync: """ command.cooker.showVersions() command.finishAsyncCommand() + showVersions.needcache = True def showEnvironment(self, command, params): """ @@ -195,6 +212,7 @@ class CommandsAsync: command.cooker.showEnvironment(bfile, pkg) command.finishAsyncCommand() + showEnvironment.needcache = True def parseFiles(self, command, params): """ @@ -202,6 +220,7 @@ class CommandsAsync: """ command.cooker.updateCache() command.finishAsyncCommand() + parseFiles.needcache = True # # Events |