diff options
author | Bob Foerster <robert@erafx.com> | 2010-12-17 23:20:39 +0800 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2011-01-05 11:13:48 +0000 |
commit | 2e0ef25a50c6a31cd6de52dfb31a04b77e694da3 (patch) | |
tree | fee195184ef180928f6712b05c1ed223382a6c96 /bitbake/lib/bb/ui/ncurses.py | |
parent | 25ac24e02e3e96945e8ac83e16fe27a6b24789b1 (diff) | |
download | poky-2e0ef25a50c6a31cd6de52dfb31a04b77e694da3.tar.gz |
Resurrect alternative UIs
The various alternative UIs have been updated to once again be functional
with the latest bitbake internals. Each of the UIs still have much room for
functional improvement.
In particular, they have been updated to:
- interact with the new process based server
- handle the current set of events and notifications fired from the server
and its associated subsystems
(Bitbake rev: b947e7aa405966262c0614cae02e7978ec637095)
Signed-off-by: Bob Foerster <robert@erafx.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/ui/ncurses.py')
-rw-r--r-- | bitbake/lib/bb/ui/ncurses.py | 58 |
1 files changed, 36 insertions, 22 deletions
diff --git a/bitbake/lib/bb/ui/ncurses.py b/bitbake/lib/bb/ui/ncurses.py index 1db4ec173b..469f1b7309 100644 --- a/bitbake/lib/bb/ui/ncurses.py +++ b/bitbake/lib/bb/ui/ncurses.py | |||
@@ -44,8 +44,9 @@ | |||
44 | 44 | ||
45 | """ | 45 | """ |
46 | 46 | ||
47 | from __future__ import division | ||
48 | 47 | ||
48 | from __future__ import division | ||
49 | import logging | ||
49 | import os, sys, curses, itertools, time | 50 | import os, sys, curses, itertools, time |
50 | import bb | 51 | import bb |
51 | import xmlrpclib | 52 | import xmlrpclib |
@@ -246,29 +247,35 @@ class NCursesUI: | |||
246 | event = eventHandler.waitEvent(0.25) | 247 | event = eventHandler.waitEvent(0.25) |
247 | if not event: | 248 | if not event: |
248 | continue | 249 | continue |
250 | |||
249 | helper.eventHandler(event) | 251 | helper.eventHandler(event) |
250 | #mw.appendText("%s\n" % event[0]) | ||
251 | if isinstance(event, bb.build.TaskBase): | 252 | if isinstance(event, bb.build.TaskBase): |
252 | mw.appendText("NOTE: %s\n" % event._message) | 253 | mw.appendText("NOTE: %s\n" % event._message) |
253 | if isinstance(event, bb.msg.MsgDebug): | 254 | if isinstance(event, logging.LogRecord): |
254 | mw.appendText('DEBUG: ' + event._message + '\n') | 255 | mw.appendText(logging.getLevelName(event.levelno) + ': ' + event.getMessage() + '\n') |
255 | if isinstance(event, bb.msg.MsgNote): | 256 | |
256 | mw.appendText('NOTE: ' + event._message + '\n') | 257 | if isinstance(event, bb.event.CacheLoadStarted): |
257 | if isinstance(event, bb.msg.MsgWarn): | 258 | self.parse_total = event.total |
258 | mw.appendText('WARNING: ' + event._message + '\n') | 259 | if isinstance(event, bb.event.CacheLoadProgress): |
259 | if isinstance(event, bb.msg.MsgError): | 260 | x = event.current |
260 | mw.appendText('ERROR: ' + event._message + '\n') | 261 | y = self.parse_total |
261 | if isinstance(event, bb.msg.MsgFatal): | 262 | mw.setStatus("Loading Cache: %s [%2d %%]" % ( next(parsespin), x*100/y ) ) |
262 | mw.appendText('FATAL: ' + event._message + '\n') | 263 | if isinstance(event, bb.event.CacheLoadCompleted): |
264 | mw.setStatus("Idle") | ||
265 | mw.appendText("Loaded %d entries from dependency cache.\n" | ||
266 | % ( event.num_entries)) | ||
267 | |||
268 | if isinstance(event, bb.event.ParseStarted): | ||
269 | self.parse_total = event.total | ||
263 | if isinstance(event, bb.event.ParseProgress): | 270 | if isinstance(event, bb.event.ParseProgress): |
264 | x = event.sofar | 271 | x = event.current |
265 | y = event.total | 272 | y = self.parse_total |
266 | if x == y: | 273 | mw.setStatus("Parsing Recipes: %s [%2d %%]" % ( next(parsespin), x*100/y ) ) |
267 | mw.setStatus("Idle") | 274 | if isinstance(event, bb.event.ParseCompleted): |
268 | mw.appendText("Parsing finished. %d cached, %d parsed, %d skipped, %d masked." | 275 | mw.setStatus("Idle") |
276 | mw.appendText("Parsing finished. %d cached, %d parsed, %d skipped, %d masked.\n" | ||
269 | % ( event.cached, event.parsed, event.skipped, event.masked )) | 277 | % ( event.cached, event.parsed, event.skipped, event.masked )) |
270 | else: | 278 | |
271 | mw.setStatus("Parsing: %s (%04d/%04d) [%2d %%]" % ( next(parsespin), x, y, x*100//y ) ) | ||
272 | # if isinstance(event, bb.build.TaskFailed): | 279 | # if isinstance(event, bb.build.TaskFailed): |
273 | # if event.logfile: | 280 | # if event.logfile: |
274 | # if data.getVar("BBINCLUDELOGS", d): | 281 | # if data.getVar("BBINCLUDELOGS", d): |
@@ -289,7 +296,9 @@ class NCursesUI: | |||
289 | # bb.msg.error(bb.msg.domain.Build, "see log in %s" % logfile) | 296 | # bb.msg.error(bb.msg.domain.Build, "see log in %s" % logfile) |
290 | 297 | ||
291 | if isinstance(event, bb.command.CommandCompleted): | 298 | if isinstance(event, bb.command.CommandCompleted): |
292 | exitflag = True | 299 | # stop so the user can see the result of the build, but |
300 | # also allow them to now exit with a single ^C | ||
301 | shutdown = 2 | ||
293 | if isinstance(event, bb.command.CommandFailed): | 302 | if isinstance(event, bb.command.CommandFailed): |
294 | mw.appendText("Command execution failed: %s" % event.error) | 303 | mw.appendText("Command execution failed: %s" % event.error) |
295 | time.sleep(2) | 304 | time.sleep(2) |
@@ -306,13 +315,18 @@ class NCursesUI: | |||
306 | if activetasks: | 315 | if activetasks: |
307 | taw.appendText("Active Tasks:\n") | 316 | taw.appendText("Active Tasks:\n") |
308 | for task in activetasks.itervalues(): | 317 | for task in activetasks.itervalues(): |
309 | taw.appendText(task["title"]) | 318 | taw.appendText(task["title"] + '\n') |
310 | if failedtasks: | 319 | if failedtasks: |
311 | taw.appendText("Failed Tasks:\n") | 320 | taw.appendText("Failed Tasks:\n") |
312 | for task in failedtasks: | 321 | for task in failedtasks: |
313 | taw.appendText(task["title"]) | 322 | taw.appendText(task["title"] + '\n') |
314 | 323 | ||
315 | curses.doupdate() | 324 | curses.doupdate() |
325 | except EnvironmentError as ioerror: | ||
326 | # ignore interrupted io | ||
327 | if ioerror.args[0] == 4: | ||
328 | pass | ||
329 | |||
316 | except KeyboardInterrupt: | 330 | except KeyboardInterrupt: |
317 | if shutdown == 2: | 331 | if shutdown == 2: |
318 | mw.appendText("Third Keyboard Interrupt, exit.\n") | 332 | mw.appendText("Third Keyboard Interrupt, exit.\n") |