]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
Update the UIs against the core changes and allow dynamic loading of the UI so UIs...
authorRichard Purdie <rpurdie@linux.intel.com>
Sat, 6 Dec 2008 13:03:19 +0000 (13:03 +0000)
committerRichard Purdie <rpurdie@linux.intel.com>
Sat, 6 Dec 2008 13:03:19 +0000 (13:03 +0000)
bin/bitbake
lib/bb/ui/depexp.py
lib/bb/ui/knotty.py
lib/bb/ui/ncurses.py

index 0a0ecfc4ee5686cff035b95b6ddde934030b99ba..b699afbab7fd07e3b937e473085d070a955f3db2 100755 (executable)
@@ -126,22 +126,6 @@ Default BBFILES are the .bb files in the current directory.""" )
     configuration.pkgs_to_build = []
     configuration.pkgs_to_build.extend(args[1:])
 
-
-    # Work out which UI(s) to use
-    curseUI = False
-    depexplorerUI = False
-    if configuration.ui:
-        if configuration.ui == "ncurses":
-            curseUI = True
-        elif configuration.ui == "knotty" or configuration.ui == "tty" or configuration.ui == "file":
-            curseUI = False
-        elif configuration.ui == "depexp":
-            depexplorerUI = True
-        else:
-            print "FATAL: Invalid user interface '%s' specified.\nValid interfaces are 'ncurses', 'depexp' or the default, 'knotty'." % configuration.ui
-            sys.exit(1)
-
-
     cooker = bb.cooker.BBCooker(configuration)
 
     # Clear away any spurious environment variables. But don't wipe the
@@ -170,27 +154,22 @@ Default BBFILES are the .bb files in the current directory.""" )
     eventHandler = uievent.BBUIEventQueue(server)
 
     # Launch the UI
-    try:
-        # Disable UIs that need a terminal
-        if not os.isatty(sys.stdout.fileno()):
-            curseUI = False
-
-        if curseUI:
-            try:
-                import curses
-            except ImportError, details:
-                curseUI = False
-
-        if curseUI:
-            from bb.ui import ncurses
-            ncurses.init(server, eventHandler)
-        elif depexplorerUI:
-            from bb.ui import depexplorer
-            depexplorer.init(server, eventHandler)
-        else:
-            from bb.ui import knotty
-            return_value = knotty.init(server, eventHandler)
+    if configuration.ui:
+        ui = configuration.ui
+    else:
+        ui = "knotty"
 
+    try:
+            # Dynamically load the UI based on the ui name. Although we
+            # suggest a fixed set this allows you to have flexibility in which
+            # ones are available.
+            exec "from bb.ui import " + ui
+            exec "return_value = " + ui + ".init(server, eventHandler)"
+    except ImportError:
+        print "FATAL: Invalid user interface '%s' specified. " % ui
+        print "Valid interfaces are 'ncurses', 'depexp' or the default, 'knotty'."
+    except Exception, e:
+        print "FATAL: Unable to start to '%s' UI: %s." % (configuration.ui, e.message)
     finally:
         # Don't wait for server indefinitely
         import socket
index becbb5dd5da40900d141a00525bb6febcb1909b8..9d92fa0a087c34c5c8a917766f9f950f536955dc 100644 (file)
@@ -202,7 +202,7 @@ def init(server, eventHandler):
         if not cmdline or cmdline[0] != "generateDotGraph":
             print "This UI is only compatible with the -g option"
             return
-        ret = server.runCommand(["generateDepTreeEvent", cmdline[1]])
+        ret = server.runCommand(["generateDepTreeEvent", cmdline[1], cmdline[2]])
         if ret != True:
             print "Couldn't run command! %s" % ret
             return
index 0de90a92796f6b8d692ae8a9b8824e39717fdc0e..a6595df3f44002530501a7324ad0cdc0c6b9bfc7 100644 (file)
@@ -56,9 +56,6 @@ def init(server, eventHandler):
             if event is None:
                 continue
             #print event
-            if event[0].startswith('bb.event.Pkg'):
-                print "NOTE: %s" % event[1]['_message']
-                continue
             if event[0].startswith('bb.msg.MsgPlain'):
                 print event[1]['_message']
                 continue
@@ -75,12 +72,16 @@ def init(server, eventHandler):
                 return_value = 1
                 print 'ERROR: ' + event[1]['_message']
                 continue
+            if event[0].startswith('bb.msg.MsgFatal'):
+                return_value = 1
+                print 'FATAL: ' + event[1]['_message']
+                break
             if event[0].startswith('bb.build.TaskFailed'):
                 return_value = 1
                 logfile = event[1]['logfile']
                 if logfile:
                     print "ERROR: Logfile of failure stored in %s." % logfile
-                    if includelogs:
+                    if 1 or includelogs:
                         print "Log data follows:"
                         f = open(logfile, "r")
                         lines = []
@@ -140,6 +141,8 @@ def init(server, eventHandler):
                 continue
             if event[0].startswith('bb.event.StampUpdate'):
                 continue
+            if event[0].startswith('bb.event.ConfigParsed'):
+                continue
             print "Unknown Event: %s" % event
 
         except KeyboardInterrupt:
index 1476baa61fa344c1d562ee0a4fa0ec4e4651d77d..3cac264648a0d99173f867affe3f6bbb2a482359 100644 (file)
@@ -245,8 +245,6 @@ class NCursesUI:
                     continue
                 helper.eventHandler(event)
                 #mw.appendText("%s\n" % event[0])
-                if event[0].startswith('bb.event.Pkg'):
-                    mw.appendText("NOTE: %s\n" % event[1]['_message'])
                 if event[0].startswith('bb.build.Task'):
                     mw.appendText("NOTE: %s\n" % event[1]['_message'])
                 if event[0].startswith('bb.msg.MsgDebug'):
@@ -324,6 +322,9 @@ class NCursesUI:
                 pass
 
 def init(server, eventHandler):
+    if not os.isatty(sys.stdout.fileno()):
+        print "FATAL: Unable to run 'ncurses' UI without a TTY."
+        return
     ui = NCursesUI()
     try:
         curses.wrapper(ui.main, server, eventHandler)