bitbake: bitbake: cooker/command: Add error state for the server and use for pre_serve errors

Currently if errors occur when starting the PR service, there is a race that
occurs since the UI runs various commands including starting builds before
processing the CookerExit(). By adding the error state and refusing to run
async commands in this mode, builds are prevented from starting and the
UI reaches the exit code with the system shutting down cleanly.

(Bitbake master rev: 42fa34142ea685f91115a551e74416ca28ef1c91)

(Bitbake rev: bc2e0796c1846d1567db6343b24b85fd7dba9163)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2013-12-10 10:09:35 -05:00
parent 53d2563ff1
commit 9d5052d3ec
2 changed files with 4 additions and 1 deletions

View File

@ -86,6 +86,8 @@ class Command:
def runAsyncCommand(self):
try:
if self.cooker.state == bb.cooker.state.error:
return False
if self.currentAsyncCommand is not None:
(command, options) = self.currentAsyncCommand
commandmethod = getattr(CommandsAsync, command)

View File

@ -61,7 +61,7 @@ class CollectionError(bb.BBHandledException):
"""
class state:
initial, parsing, running, shutdown, forceshutdown, stopped = range(6)
initial, parsing, running, shutdown, forceshutdown, stopped, error = range(7)
class SkippedPackage:
@ -1321,6 +1321,7 @@ class BBCooker:
self.prhost = prserv.serv.auto_start(self.data)
except prserv.serv.PRServiceConfigError:
bb.event.fire(CookerExit(), self.event_data)
self.state = state.error
return
def post_serve(self):