diff options
Diffstat (limited to 'bitbake/lib/bb/ui/knotty.py')
-rw-r--r-- | bitbake/lib/bb/ui/knotty.py | 92 |
1 files changed, 51 insertions, 41 deletions
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index ed26bb2b4..f81759abf 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py @@ -18,8 +18,9 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -import os +from __future__ import division +import os import sys import itertools import xmlrpclib @@ -44,10 +45,10 @@ def init(server, eventHandler): return 1 ret = server.runCommand(cmdline) if ret != True: - print "Couldn't get default commandline! %s" % ret + print("Couldn't get default commandline! %s" % ret) return 1 - except xmlrpclib.Fault, x: - print "XMLRPC Fault getting commandline:\n %s" % x + except xmlrpclib.Fault as x: + print("XMLRPC Fault getting commandline:\n %s" % x) return 1 shutdown = 0 @@ -65,39 +66,39 @@ def init(server, eventHandler): if shutdown and helper.needUpdate: activetasks, failedtasks = helper.getTasks() if activetasks: - print "Waiting for %s active tasks to finish:" % len(activetasks) + print("Waiting for %s active tasks to finish:" % len(activetasks)) tasknum = 1 for task in activetasks: - print "%s: %s (pid %s)" % (tasknum, activetasks[task]["title"], task) + print("%s: %s (pid %s)" % (tasknum, activetasks[task]["title"], task)) tasknum = tasknum + 1 if isinstance(event, bb.msg.MsgPlain): - print event._message + print(event._message) continue if isinstance(event, bb.msg.MsgDebug): - print 'DEBUG: ' + event._message + print('DEBUG: ' + event._message) continue if isinstance(event, bb.msg.MsgNote): - print 'NOTE: ' + event._message + print('NOTE: ' + event._message) continue if isinstance(event, bb.msg.MsgWarn): - print 'WARNING: ' + event._message + print('WARNING: ' + event._message) continue if isinstance(event, bb.msg.MsgError): return_value = 1 - print 'ERROR: ' + event._message + print('ERROR: ' + event._message) continue if isinstance(event, bb.msg.MsgFatal): return_value = 1 - print 'FATAL: ' + event._message + print('FATAL: ' + event._message) break if isinstance(event, bb.build.TaskFailed): return_value = 1 logfile = event.logfile - if logfile: - print "ERROR: Logfile of failure stored in: %s" % logfile + if logfile and os.path.exists(logfile): + print("ERROR: Logfile of failure stored in: %s" % logfile) if 1 or includelogs: - print "Log data follows:" + print("Log data follows:") f = open(logfile, "r") lines = [] while True: @@ -110,19 +111,19 @@ def init(server, eventHandler): if len(lines) > int(loglines): lines.pop(0) else: - print '| %s' % l + print('| %s' % l) f.close() if lines: for line in lines: - print line + print(line) if isinstance(event, bb.build.TaskBase): - print "NOTE: %s" % event._message + print("NOTE: %s" % event._message) continue if isinstance(event, bb.event.ParseProgress): x = event.sofar y = event.total if os.isatty(sys.stdout.fileno()): - sys.stdout.write("\rNOTE: Handling BitBake files: %s (%04d/%04d) [%2d %%]" % ( parsespin.next(), x, y, x*100/y ) ) + sys.stdout.write("\rNOTE: Handling BitBake files: %s (%04d/%04d) [%2d %%]" % ( next(parsespin), x, y, x*100//y ) ) sys.stdout.flush() else: if x == 1: @@ -132,8 +133,8 @@ def init(server, eventHandler): sys.stdout.write("done.") sys.stdout.flush() if x == y: - print("\nParsing of %d .bb files complete (%d cached, %d parsed). %d targets, %d skipped, %d masked, %d errors." - % ( event.total, event.cached, event.parsed, event.virtuals, event.skipped, event.masked, event.errors)) + print(("\nParsing of %d .bb files complete (%d cached, %d parsed). %d targets, %d skipped, %d masked, %d errors." + % ( event.total, event.cached, event.parsed, event.virtuals, event.skipped, event.masked, event.errors))) continue if isinstance(event, bb.command.CookerCommandCompleted): @@ -143,39 +144,48 @@ def init(server, eventHandler): continue if isinstance(event, bb.command.CookerCommandFailed): return_value = 1 - print "Command execution failed: %s" % event.error + print("Command execution failed: %s" % event.error) break if isinstance(event, bb.cooker.CookerExit): break - - # ignore - if isinstance(event, bb.event.BuildStarted): - continue - if isinstance(event, bb.event.BuildCompleted): - continue if isinstance(event, bb.event.MultipleProviders): + print("NOTE: multiple providers are available for %s%s (%s)" % (event._is_runtime and "runtime " or "", + event._item, + ", ".join(event._candidates))) + print("NOTE: consider defining a PREFERRED_PROVIDER entry to match %s" % event._item) + continue + if isinstance(event, bb.event.NoProvider): + if event._runtime: + r = "R" + else: + r = "" + + if event._dependees: + print("ERROR: Nothing %sPROVIDES '%s' (but %s %sDEPENDS on or otherwise requires it)" % (r, event._item, ", ".join(event._dependees), r)) + else: + print("ERROR: Nothing %sPROVIDES '%s'" % (r, event._item)) continue - if isinstance(event, bb.runqueue.runQueueEvent): - continue - if isinstance(event, bb.runqueue.runQueueExitWait): - continue - if isinstance(event, bb.event.StampUpdate): - continue - if isinstance(event, bb.event.ConfigParsed): - continue - if isinstance(event, bb.event.RecipeParsed): + + # ignore + if isinstance(event, (bb.event.BuildBase, + bb.event.StampUpdate, + bb.event.ConfigParsed, + bb.event.RecipeParsed, + bb.runqueue.runQueueEvent, + bb.runqueue.runQueueExitWait)): continue - print "Unknown Event: %s" % event + + print("Unknown Event: %s" % event) except KeyboardInterrupt: if shutdown == 2: - print "\nThird Keyboard Interrupt, exit.\n" + print("\nThird Keyboard Interrupt, exit.\n") break if shutdown == 1: - print "\nSecond Keyboard Interrupt, stopping...\n" + print("\nSecond Keyboard Interrupt, stopping...\n") server.runCommand(["stateStop"]) if shutdown == 0: - print "\nKeyboard Interrupt, closing down...\n" + print("\nKeyboard Interrupt, closing down...\n") server.runCommand(["stateShutdown"]) shutdown = shutdown + 1 pass |