The attached patch fixes up some minor issues with exception handling
in bitbake.

Thanks,
Cliff
From 15cd67608dd5a7564186d29ebb936bd110ace64f Mon Sep 17 00:00:00 2001
From: Cliff Brake <[email protected]>
Date: Wed, 2 Jun 2010 11:56:39 -0400
Subject: [PATCH] fix up exception handling in bitbake

before this change, with the following recipe we were getting
error messages like:

http://cgit.bec-systems.com/cgit.cgi/autotools-demo/
(note this is a srctree recipe, so simply check out in your
recipes directory)

this produced:
FATAL: Unable to start to 'None' UI due to exception: 27224

with this patch, we get marginally more useful information:

NOTE: package autotools-demo-1.0-27-g355ad90-r0: task do_install: Succeeded
DEBUG: mkdirhier(/scratch/oe/oe-build/oe/build/angstrom-2008.1/tmp/stamps/armv5te-angstrom-linux-gnueabi)
FATAL: Unable to start to 'knotty' UI due to exception: 22100.
Traceback (most recent call last):
  File "/scratch/oe/oe-build/oe/bitbake/bin/bitbake", line 188, in main
    exec "return_value = " + ui + ".init(serverConnection.connection, serverConnection.events)"
  File "<string>", line 1, in <module>
  File "/scratch/oe/oe-build/oe/bitbake/lib/bb/ui/knotty.py", line 61, in init
    helper.eventHandler(event)
  File "/scratch/oe/oe-build/oe/bitbake/lib/bb/ui/uihelper.py", line 31, in eventHandler
    del self.running_tasks[event.pid]
KeyError: 22100

Signed-off-by: Cliff Brake <[email protected]>
---
 bin/bitbake |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/bin/bitbake b/bin/bitbake
index 37bed36..83f287b 100755
--- a/bin/bitbake
+++ b/bin/bitbake
@@ -22,7 +22,7 @@
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
-import sys, os, getopt, re, time, optparse, xmlrpclib
+import sys, os, getopt, re, time, optparse, xmlrpclib, traceback
 sys.path.insert(0,os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib'))
 import bb
 from bb import cooker
@@ -178,16 +178,18 @@ Default BBFILES are the .bb files in the current directory.""" )
         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(serverConnection.connection, serverConnection.events)"
+        # 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(serverConnection.connection, serverConnection.events)"
     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 due to exception: %s." % (configuration.ui, e)
+        print "FATAL: Unable to start to '%s' UI due to exception: %s." % (ui, str(e))
+        if bb.msg.debug_level['default']:
+            traceback.print_exc()
     finally:
         serverConnection.terminate()
         return return_value
-- 
1.7.0.4

_______________________________________________
Bitbake-dev mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/bitbake-dev

Reply via email to