bitbake: cooker: Rename confusing 'stop' state to 'forceshutdown'
The shutdown state causes the server to finish what its doing, stop was them meant to completely stop it. It doesn't mean the server is stopped though. Renaming the current stop event for forceshutdown gives more meaning to what it actually does. The stopped namespace then becomes available to indicate a completely stopped server. (Bitbake rev: 12e9d33bfae5294e3870dfd1202f63383ad05e92) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
2174a51ee8
commit
7663a52061
|
@ -137,13 +137,13 @@ class CommandsSync:
|
||||||
"""
|
"""
|
||||||
Trigger cooker 'shutdown' mode
|
Trigger cooker 'shutdown' mode
|
||||||
"""
|
"""
|
||||||
command.cooker.shutdown()
|
command.cooker.shutdown(False)
|
||||||
|
|
||||||
def stateStop(self, command, params):
|
def stateForceShutdown(self, command, params):
|
||||||
"""
|
"""
|
||||||
Stop the cooker
|
Stop the cooker
|
||||||
"""
|
"""
|
||||||
command.cooker.stop()
|
command.cooker.shutdown(True)
|
||||||
|
|
||||||
def getVariable(self, command, params):
|
def getVariable(self, command, params):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -61,7 +61,7 @@ class CollectionError(bb.BBHandledException):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
class state:
|
class state:
|
||||||
initial, parsing, running, shutdown, stop = range(5)
|
initial, parsing, running, shutdown, forceshutdown, stopped = range(6)
|
||||||
|
|
||||||
|
|
||||||
class SkippedPackage:
|
class SkippedPackage:
|
||||||
|
@ -1044,7 +1044,7 @@ class BBCooker:
|
||||||
|
|
||||||
def buildFileIdle(server, rq, abort):
|
def buildFileIdle(server, rq, abort):
|
||||||
|
|
||||||
if abort or self.state == state.stop:
|
if abort or self.state == state.forceshutdown:
|
||||||
rq.finish_runqueue(True)
|
rq.finish_runqueue(True)
|
||||||
elif self.state == state.shutdown:
|
elif self.state == state.shutdown:
|
||||||
rq.finish_runqueue(False)
|
rq.finish_runqueue(False)
|
||||||
|
@ -1081,7 +1081,7 @@ class BBCooker:
|
||||||
targets = self.checkPackages(targets)
|
targets = self.checkPackages(targets)
|
||||||
|
|
||||||
def buildTargetsIdle(server, rq, abort):
|
def buildTargetsIdle(server, rq, abort):
|
||||||
if abort or self.state == state.stop:
|
if abort or self.state == state.forceshutdown:
|
||||||
rq.finish_runqueue(True)
|
rq.finish_runqueue(True)
|
||||||
elif self.state == state.shutdown:
|
elif self.state == state.shutdown:
|
||||||
rq.finish_runqueue(False)
|
rq.finish_runqueue(False)
|
||||||
|
@ -1170,7 +1170,7 @@ class BBCooker:
|
||||||
if self.state == state.running:
|
if self.state == state.running:
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.state in (state.shutdown, state.stop):
|
if self.state in (state.shutdown, state.forceshutdown):
|
||||||
self.parser.shutdown(clean=False, force = True)
|
self.parser.shutdown(clean=False, force = True)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
@ -1240,11 +1240,11 @@ class BBCooker:
|
||||||
prserv.serv.auto_shutdown(self.data)
|
prserv.serv.auto_shutdown(self.data)
|
||||||
bb.event.fire(CookerExit(), self.event_data)
|
bb.event.fire(CookerExit(), self.event_data)
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self, force = False):
|
||||||
self.state = state.shutdown
|
if force:
|
||||||
|
self.state = state.forceshutdown
|
||||||
def stop(self):
|
else:
|
||||||
self.state = state.stop
|
self.state = state.shutdown
|
||||||
|
|
||||||
def initialize(self):
|
def initialize(self):
|
||||||
self.initConfigurationData()
|
self.initConfigurationData()
|
||||||
|
|
|
@ -113,7 +113,7 @@ class ProcessServer(Process, BaseImplServer):
|
||||||
self.event_queue.close()
|
self.event_queue.close()
|
||||||
bb.event.unregister_UIHhandler(self.event_handle.value)
|
bb.event.unregister_UIHhandler(self.event_handle.value)
|
||||||
self.command_channel.close()
|
self.command_channel.close()
|
||||||
self.cooker.stop()
|
self.cooker.shutdown(True)
|
||||||
self.idle_commands(.1)
|
self.idle_commands(.1)
|
||||||
|
|
||||||
def idle_commands(self, delay, fds = []):
|
def idle_commands(self, delay, fds = []):
|
||||||
|
|
|
@ -440,12 +440,12 @@ class HobHandler(gobject.GObject):
|
||||||
self.building = False
|
self.building = False
|
||||||
|
|
||||||
def cancel_parse(self):
|
def cancel_parse(self):
|
||||||
self.runCommand(["stateStop"])
|
self.runCommand(["stateForceShutdown"])
|
||||||
|
|
||||||
def cancel_build(self, force=False):
|
def cancel_build(self, force=False):
|
||||||
if force:
|
if force:
|
||||||
# Force the cooker to stop as quickly as possible
|
# Force the cooker to stop as quickly as possible
|
||||||
self.runCommand(["stateStop"])
|
self.runCommand(["stateForceShutdown"])
|
||||||
else:
|
else:
|
||||||
# Wait for tasks to complete before shutting down, this helps
|
# Wait for tasks to complete before shutting down, this helps
|
||||||
# leave the workdir in a usable state
|
# leave the workdir in a usable state
|
||||||
|
|
|
@ -314,7 +314,7 @@ def main(server, eventHandler, params):
|
||||||
break
|
break
|
||||||
if shutdown == 1:
|
if shutdown == 1:
|
||||||
print("\nSecond Keyboard Interrupt, stopping...\n")
|
print("\nSecond Keyboard Interrupt, stopping...\n")
|
||||||
_, error = server.runCommand(["stateStop"])
|
_, error = server.runCommand(["stateForceShutdown"])
|
||||||
if error:
|
if error:
|
||||||
print('Unable to cleanly stop: %s' % error)
|
print('Unable to cleanly stop: %s' % error)
|
||||||
if shutdown == 0:
|
if shutdown == 0:
|
||||||
|
|
|
@ -117,5 +117,5 @@ def main (server, eventHandler, params):
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
finally:
|
finally:
|
||||||
server.runCommand(["stateStop"])
|
server.runCommand(["stateForceShutdown"])
|
||||||
|
|
||||||
|
|
|
@ -499,7 +499,7 @@ def main(server, eventHandler, params, tf = TerminalFilter):
|
||||||
main.shutdown = 2
|
main.shutdown = 2
|
||||||
if not params.observe_only and main.shutdown == 1:
|
if not params.observe_only and main.shutdown == 1:
|
||||||
print("\nSecond Keyboard Interrupt, stopping...\n")
|
print("\nSecond Keyboard Interrupt, stopping...\n")
|
||||||
_, error = server.runCommand(["stateStop"])
|
_, error = server.runCommand(["stateForceShutdown"])
|
||||||
if error:
|
if error:
|
||||||
logger.error("Unable to cleanly stop: %s" % error)
|
logger.error("Unable to cleanly stop: %s" % error)
|
||||||
if not params.observe_only and main.shutdown == 0:
|
if not params.observe_only and main.shutdown == 0:
|
||||||
|
|
|
@ -350,7 +350,7 @@ class NCursesUI:
|
||||||
exitflag = True
|
exitflag = True
|
||||||
if shutdown == 1:
|
if shutdown == 1:
|
||||||
mw.appendText("Second Keyboard Interrupt, stopping...\n")
|
mw.appendText("Second Keyboard Interrupt, stopping...\n")
|
||||||
_, error = server.runCommand(["stateStop"])
|
_, error = server.runCommand(["stateForceShutdown"])
|
||||||
if error:
|
if error:
|
||||||
print("Unable to cleanly stop: %s" % error)
|
print("Unable to cleanly stop: %s" % error)
|
||||||
if shutdown == 0:
|
if shutdown == 0:
|
||||||
|
|
Loading…
Reference in New Issue