diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2008-03-16 12:54:01 +0000 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2008-03-16 12:54:01 +0000 |
commit | 38ce7b95b9f76afaf1d2fe9b39817411b0b3ba57 (patch) | |
tree | acf0aa202d24e247ba9ff04a8b21db8498309880 | |
parent | 8b25cead6217c458cc6db32b9705ecdf3b2ff66f (diff) | |
download | bitbake-38ce7b95b9f76afaf1d2fe9b39817411b0b3ba57.tar.gz |
Add return value handling (thanks pH5)
-rw-r--r-- | ChangeLog | 1 | ||||
-rwxr-xr-x | bin/bitbake | 6 | ||||
-rw-r--r-- | lib/bb/ui/knotty.py | 13 |
3 files changed, 14 insertions, 6 deletions
@@ -121,6 +121,7 @@ Changes in Bitbake 1.9.x: - Fix -f (force) in conjunction with -b - Fix problems with recrdeptask handling where some idepends weren't handled correctly. + - Handle exit codes correctly (from pH5) Changes in Bitbake 1.8.0: - Release 1.7.x as a stable series diff --git a/bin/bitbake b/bin/bitbake index ae048ef59..f684ef51e 100755 --- a/bin/bitbake +++ b/bin/bitbake @@ -49,6 +49,7 @@ class BBConfiguration( object ): #============================================================================# def main(): + return_value = 0 pythonver = sys.version_info if pythonver[0] < 2 or (pythonver[0] == 2 and pythonver[1] < 5): print "Sorry, bitbake needs python 2.5 or later." @@ -171,7 +172,7 @@ Default BBFILES are the .bb files in the current directory.""" ) ncurses.init(frontend, eventHandler) else: from bb.ui import knotty - knotty.init(frontend, eventHandler) + return_value = knotty.init(frontend, eventHandler) finally: # Don't wait for server indefinitely @@ -185,6 +186,7 @@ Default BBFILES are the .bb files in the current directory.""" ) frontend.system.quit() except: pass + return return_value if __name__ == "__main__": print """WARNING, WARNING, WARNING @@ -192,4 +194,4 @@ This is a Bitbake from the Unstable/Development 1.9 Branch. This software contai You might want to use the bitbake-1.8 stable branch (if you are not a BitBake developer or tester). I'm going to sleep 5 seconds now to make sure you see that.""" import time time.sleep(5) - main() + sys.exit(main()) diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py index a549cceb8..12c1b3838 100644 --- a/lib/bb/ui/knotty.py +++ b/lib/bb/ui/knotty.py @@ -39,16 +39,17 @@ def init(frontend, eventHandler): cmdline = frontend.runCommand(["getCmdLineAction"]) #print cmdline if not cmdline: - return + return 1 ret = frontend.runCommand(cmdline) if ret != True: - print "Couldn't get default commandlind! %s" % ret - return + print "Couldn't get default commandline! %s" % ret + return 1 except xmlrpclib.Fault, x: print "XMLRPC Fault getting commandline:\n %s" % x - return + return 1 shutdown = 0 + return_value = 0 while True: try: event = eventHandler.waitEvent(0.25) @@ -71,9 +72,11 @@ def init(frontend, eventHandler): print 'WARNING: ' + event[1]['_message'] continue if event[0].startswith('bb.msg.MsgError'): + return_value = 1 print 'ERROR: ' + event[1]['_message'] continue 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 @@ -120,6 +123,7 @@ def init(frontend, eventHandler): if event[0] == 'bb.command.CookerCommandCompleted': break if event[0] == 'bb.command.CookerCommandFailed': + return_value = 1 print "Command execution failed: %s" % event[1]['error'] break if event[0] == 'bb.cooker.CookerExit': @@ -150,3 +154,4 @@ def init(frontend, eventHandler): frontend.runCommand(["stateShutdown"]) shutdown = shutdown + 1 pass + return return_value |