bitbake: server/process: Simplfy idle callback handler function

Having the idle callbacks abstracted via the configuration object
makes no sense. Its like this for historical reasons from the
multiple server backends but we don't need this now so simplfy.

(Bitbake rev: e56c49717355c9493b07d5fc80981a95ad8a0ec8)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2020-08-12 16:53:41 +01:00
parent 0c91113c07
commit a3448ad15e
4 changed files with 9 additions and 14 deletions

View File

@@ -84,7 +84,7 @@ class Command:
if command not in CommandsAsync.__dict__: if command not in CommandsAsync.__dict__:
return None, "No such command" return None, "No such command"
self.currentAsyncCommand = (command, commandline) self.currentAsyncCommand = (command, commandline)
self.cooker.configuration.server_register_idlecallback(self.cooker.runCommands, self.cooker) self.cooker.idleCallBackRegister(self.cooker.runCommands, self.cooker)
return True, None return True, None
def runAsyncCommand(self): def runAsyncCommand(self):

View File

@@ -148,7 +148,7 @@ class BBCooker:
Manages one bitbake build run Manages one bitbake build run
""" """
def __init__(self, configuration, featureSet=None): def __init__(self, configuration, featureSet=None, idleCallBackRegister=None):
self.recipecaches = None self.recipecaches = None
self.skiplist = {} self.skiplist = {}
self.featureset = CookerFeatures() self.featureset = CookerFeatures()
@@ -158,6 +158,8 @@ class BBCooker:
self.configuration = configuration self.configuration = configuration
self.idleCallBackRegister = idleCallBackRegister
bb.debug(1, "BBCooker starting %s" % time.time()) bb.debug(1, "BBCooker starting %s" % time.time())
sys.stdout.flush() sys.stdout.flush()
@@ -210,7 +212,7 @@ class BBCooker:
cooker.process_inotify_updates() cooker.process_inotify_updates()
return 1.0 return 1.0
self.configuration.server_register_idlecallback(_process_inotify_updates, self) self.idleCallBackRegister(_process_inotify_updates, self)
# TOSTOP must not be set or our children will hang when they output # TOSTOP must not be set or our children will hang when they output
try: try:
@@ -1423,7 +1425,7 @@ class BBCooker:
return True return True
return retval return retval
self.configuration.server_register_idlecallback(buildFileIdle, rq) self.idleCallBackRegister(buildFileIdle, rq)
def buildTargets(self, targets, task): def buildTargets(self, targets, task):
""" """
@@ -1494,7 +1496,7 @@ class BBCooker:
if 'universe' in targets: if 'universe' in targets:
rq.rqdata.warn_multi_bb = True rq.rqdata.warn_multi_bb = True
self.configuration.server_register_idlecallback(buildTargetsIdle, rq) self.idleCallBackRegister(buildTargetsIdle, rq)
def getAllKeysWithFlags(self, flaglist): def getAllKeysWithFlags(self, flaglist):

View File

@@ -143,16 +143,10 @@ class CookerConfiguration(object):
setattr(self, key, parameters.options.__dict__[key]) setattr(self, key, parameters.options.__dict__[key])
self.env = parameters.environment.copy() self.env = parameters.environment.copy()
def setServerRegIdleCallback(self, srcb):
self.server_register_idlecallback = srcb
def __getstate__(self): def __getstate__(self):
state = {} state = {}
for key in self.__dict__.keys(): for key in self.__dict__.keys():
if key == "server_register_idlecallback": state[key] = getattr(self, key)
state[key] = None
else:
state[key] = getattr(self, key)
return state return state
def __setstate__(self,state): def __setstate__(self,state):

View File

@@ -467,11 +467,10 @@ class BitBakeServer(object):
sys.stdout.flush() sys.stdout.flush()
server = ProcessServer(self.bitbake_lock, self.sock, self.sockname) server = ProcessServer(self.bitbake_lock, self.sock, self.sockname)
self.configuration.setServerRegIdleCallback(server.register_idle_function)
os.close(self.readypipe) os.close(self.readypipe)
writer = ConnectionWriter(self.readypipein) writer = ConnectionWriter(self.readypipein)
try: try:
self.cooker = bb.cooker.BBCooker(self.configuration, self.featureset) self.cooker = bb.cooker.BBCooker(self.configuration, self.featureset, server.register_idle_function)
except bb.BBHandledException: except bb.BBHandledException:
return None return None
writer.send("r") writer.send("r")