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 | poky-433f50435e2227c66114223a2e2c9c88a5ffeed3.tar.gz | |
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: | |||
| 57 | async_cmds[command] = (method) | 57 | async_cmds[command] = (method) |
| 58 | 58 | ||
| 59 | def runCommand(self, commandline): | 59 | def runCommand(self, commandline): |
| 60 | bb.debug("Running command %s" % commandline) | ||
| 60 | try: | 61 | try: |
| 61 | command = commandline.pop(0) | 62 | command = commandline.pop(0) |
| 62 | if command in CommandsSync.__dict__: | 63 | if command in CommandsSync.__dict__: |
| 63 | # Can run online commands straight away | 64 | # Can run synchronous commands straight away |
| 64 | return getattr(CommandsSync, command)(self.cmds_sync, self, commandline) | 65 | return getattr(CommandsSync, command)(self.cmds_sync, self, commandline) |
| 65 | if self.currentAsyncCommand is not None: | 66 | if self.currentAsyncCommand is not None: |
| 66 | return "Busy (%s in progress)" % self.currentAsyncCommand[0] | 67 | return "Busy (%s in progress)" % self.currentAsyncCommand[0] |
| 67 | if command not in CommandsAsync.__dict__: | 68 | if command not in CommandsAsync.__dict__: |
| 68 | return "No such command" | 69 | return "No such command" |
| 69 | self.currentAsyncCommand = (command, commandline) | 70 | self.currentAsyncCommand = (command, commandline) |
| 71 | self.cooker.server.register_idle_function(self.cooker.runCommands, self.cooker) | ||
| 70 | return True | 72 | return True |
| 71 | except: | 73 | except: |
| 72 | import traceback | 74 | import traceback |
| @@ -76,10 +78,20 @@ class Command: | |||
| 76 | try: | 78 | try: |
| 77 | if self.currentAsyncCommand is not None: | 79 | if self.currentAsyncCommand is not None: |
| 78 | (command, options) = self.currentAsyncCommand | 80 | (command, options) = self.currentAsyncCommand |
| 79 | getattr(CommandsAsync, command)(self.cmds_async, self, options) | 81 | commandmethod = getattr(CommandsAsync, command) |
| 82 | needcache = getattr( commandmethod, "needcache" ) | ||
| 83 | if needcache and self.cooker.cookerState != bb.cooker.cookerParsed: | ||
| 84 | self.cooker.updateCache() | ||
| 85 | return True | ||
| 86 | else: | ||
| 87 | commandmethod(self.cmds_async, self, options) | ||
| 88 | return False | ||
| 89 | else: | ||
| 90 | return False | ||
| 80 | except: | 91 | except: |
| 81 | import traceback | 92 | import traceback |
| 82 | self.finishAsyncCommand(traceback.format_exc()) | 93 | self.finishAsyncCommand(traceback.format_exc()) |
| 94 | return False | ||
| 83 | 95 | ||
| 84 | def finishAsyncCommand(self, error = None): | 96 | def finishAsyncCommand(self, error = None): |
| 85 | if error: | 97 | if error: |
| @@ -149,6 +161,7 @@ class CommandsAsync: | |||
| 149 | task = params[1] | 161 | task = params[1] |
| 150 | 162 | ||
| 151 | command.cooker.buildFile(bfile, task) | 163 | command.cooker.buildFile(bfile, task) |
| 164 | buildFile.needcache = False | ||
| 152 | 165 | ||
| 153 | def buildTargets(self, command, params): | 166 | def buildTargets(self, command, params): |
| 154 | """ | 167 | """ |
| @@ -158,6 +171,7 @@ class CommandsAsync: | |||
| 158 | task = params[1] | 171 | task = params[1] |
| 159 | 172 | ||
| 160 | command.cooker.buildTargets(pkgs_to_build, task) | 173 | command.cooker.buildTargets(pkgs_to_build, task) |
| 174 | buildTargets.needcache = True | ||
| 161 | 175 | ||
| 162 | def generateDepTreeEvent(self, command, params): | 176 | def generateDepTreeEvent(self, command, params): |
| 163 | """ | 177 | """ |
| @@ -168,6 +182,7 @@ class CommandsAsync: | |||
| 168 | 182 | ||
| 169 | command.cooker.generateDepTreeEvent(pkgs_to_build, task) | 183 | command.cooker.generateDepTreeEvent(pkgs_to_build, task) |
| 170 | command.finishAsyncCommand() | 184 | command.finishAsyncCommand() |
| 185 | generateDepTreeEvent.needcache = True | ||
| 171 | 186 | ||
| 172 | def generateDotGraph(self, command, params): | 187 | def generateDotGraph(self, command, params): |
| 173 | """ | 188 | """ |
| @@ -178,6 +193,7 @@ class CommandsAsync: | |||
| 178 | 193 | ||
| 179 | command.cooker.generateDotGraphFiles(pkgs_to_build, task) | 194 | command.cooker.generateDotGraphFiles(pkgs_to_build, task) |
| 180 | command.finishAsyncCommand() | 195 | command.finishAsyncCommand() |
| 196 | generateDotGraph.needcache = True | ||
| 181 | 197 | ||
| 182 | def showVersions(self, command, params): | 198 | def showVersions(self, command, params): |
| 183 | """ | 199 | """ |
| @@ -185,6 +201,7 @@ class CommandsAsync: | |||
| 185 | """ | 201 | """ |
| 186 | command.cooker.showVersions() | 202 | command.cooker.showVersions() |
| 187 | command.finishAsyncCommand() | 203 | command.finishAsyncCommand() |
| 204 | showVersions.needcache = True | ||
| 188 | 205 | ||
| 189 | def showEnvironment(self, command, params): | 206 | def showEnvironment(self, command, params): |
| 190 | """ | 207 | """ |
| @@ -195,6 +212,7 @@ class CommandsAsync: | |||
| 195 | 212 | ||
| 196 | command.cooker.showEnvironment(bfile, pkg) | 213 | command.cooker.showEnvironment(bfile, pkg) |
| 197 | command.finishAsyncCommand() | 214 | command.finishAsyncCommand() |
| 215 | showEnvironment.needcache = True | ||
| 198 | 216 | ||
| 199 | def parseFiles(self, command, params): | 217 | def parseFiles(self, command, params): |
| 200 | """ | 218 | """ |
| @@ -202,6 +220,7 @@ class CommandsAsync: | |||
| 202 | """ | 220 | """ |
| 203 | command.cooker.updateCache() | 221 | command.cooker.updateCache() |
| 204 | command.finishAsyncCommand() | 222 | command.finishAsyncCommand() |
| 223 | parseFiles.needcache = True | ||
| 205 | 224 | ||
| 206 | # | 225 | # |
| 207 | # Events | 226 | # Events |
