[bitbake-devel] [PATCH 1/3] bitbake : handle each ui error
Andrei Dinu
andrei.adrianx.dinu at intel.com
Mon Apr 15 10:38:13 UTC 2013
Added the functionality to bitbake to handle each
ui error in particular. The function handle_sys_exit()
needs to be implemented in the ui that needs different
error reporting than default.
Signed-off-by: Andrei Dinu <andrei.adrianx.dinu at intel.com>
---
bitbake/bin/bitbake | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/bitbake/bin/bitbake b/bitbake/bin/bitbake
index 40b50e1..4dce7be 100755
--- a/bitbake/bin/bitbake
+++ b/bitbake/bin/bitbake
@@ -75,7 +75,7 @@ def get_ui(config):
# suggest a fixed set this allows you to have flexibility in which
# ones are available.
module = __import__("bb.ui", fromlist = [interface])
- return getattr(module, interface).main
+ return getattr(module, interface)
except AttributeError:
sys.exit("FATAL: Invalid user interface '%s' specified.\n"
"Valid interfaces: depexp, goggle, ncurses, hob, knotty [default]." % interface)
@@ -100,7 +100,7 @@ warnings.filterwarnings("ignore", category=ImportWarning)
warnings.filterwarnings("ignore", category=DeprecationWarning, module="<string>$")
warnings.filterwarnings("ignore", message="With-statements now directly support multiple context managers")
-
+ui_main = None
def main():
parser = optparse.OptionParser(
version = "BitBake Build Tool Core version %s, %%prog version %s" % (bb.__version__, __version__),
@@ -189,6 +189,7 @@ Default BBFILES are the .bb files in the current directory.""")
configuration = BBConfiguration(options)
configuration.pkgs_to_build.extend(args[1:])
+ global ui_main
ui_main = get_ui(configuration)
# Server type can be xmlrpc, process or none currently, if nothing is specified,
@@ -261,7 +262,7 @@ Default BBFILES are the .bb files in the current directory.""")
os.environ[k] = cleanedvars[k]
try:
- return server.launchUI(ui_main, server_connection.connection, server_connection.events)
+ return server.launchUI(ui_main.main, server_connection.connection, server_connection.events)
finally:
bb.event.ui_queue = []
server_connection.terminate()
@@ -277,5 +278,11 @@ if __name__ == "__main__":
ret = 1
import traceback
traceback.print_exc(5)
+ except SystemExit:
+ try:
+ hasattr(ui_main, 'handle_sys_exit')
+ ui_main.handle_sys_exit()
+ except AttributeError:
+ ret = 1
sys.exit(ret)
--
1.7.9.5
More information about the bitbake-devel
mailing list