summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2020-08-12 16:53:41 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-08-13 08:07:00 +0100
commita3448ad15ec811bbf64aaf5d6496356d26516dfa (patch)
tree33f9c65cafb95c446f3347bf70a555a76f7cba47
parent0c91113c077d8efe01a7c9f788c9bdecbc6493bc (diff)
downloadpoky-a3448ad15ec811bbf64aaf5d6496356d26516dfa.tar.gz
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>
-rw-r--r--bitbake/lib/bb/command.py2
-rw-r--r--bitbake/lib/bb/cooker.py10
-rw-r--r--bitbake/lib/bb/cookerdata.py8
-rw-r--r--bitbake/lib/bb/server/process.py3
4 files changed, 9 insertions, 14 deletions
diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
index 48a7f1a158..4d152ff4c0 100644
--- a/bitbake/lib/bb/command.py
+++ b/bitbake/lib/bb/command.py
@@ -84,7 +84,7 @@ class Command:
84 if command not in CommandsAsync.__dict__: 84 if command not in CommandsAsync.__dict__:
85 return None, "No such command" 85 return None, "No such command"
86 self.currentAsyncCommand = (command, commandline) 86 self.currentAsyncCommand = (command, commandline)
87 self.cooker.configuration.server_register_idlecallback(self.cooker.runCommands, self.cooker) 87 self.cooker.idleCallBackRegister(self.cooker.runCommands, self.cooker)
88 return True, None 88 return True, None
89 89
90 def runAsyncCommand(self): 90 def runAsyncCommand(self):
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index f6abc63487..9123605461 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -148,7 +148,7 @@ class BBCooker:
148 Manages one bitbake build run 148 Manages one bitbake build run
149 """ 149 """
150 150
151 def __init__(self, configuration, featureSet=None): 151 def __init__(self, configuration, featureSet=None, idleCallBackRegister=None):
152 self.recipecaches = None 152 self.recipecaches = None
153 self.skiplist = {} 153 self.skiplist = {}
154 self.featureset = CookerFeatures() 154 self.featureset = CookerFeatures()
@@ -158,6 +158,8 @@ class BBCooker:
158 158
159 self.configuration = configuration 159 self.configuration = configuration
160 160
161 self.idleCallBackRegister = idleCallBackRegister
162
161 bb.debug(1, "BBCooker starting %s" % time.time()) 163 bb.debug(1, "BBCooker starting %s" % time.time())
162 sys.stdout.flush() 164 sys.stdout.flush()
163 165
@@ -210,7 +212,7 @@ class BBCooker:
210 cooker.process_inotify_updates() 212 cooker.process_inotify_updates()
211 return 1.0 213 return 1.0
212 214
213 self.configuration.server_register_idlecallback(_process_inotify_updates, self) 215 self.idleCallBackRegister(_process_inotify_updates, self)
214 216
215 # TOSTOP must not be set or our children will hang when they output 217 # TOSTOP must not be set or our children will hang when they output
216 try: 218 try:
@@ -1423,7 +1425,7 @@ class BBCooker:
1423 return True 1425 return True
1424 return retval 1426 return retval
1425 1427
1426 self.configuration.server_register_idlecallback(buildFileIdle, rq) 1428 self.idleCallBackRegister(buildFileIdle, rq)
1427 1429
1428 def buildTargets(self, targets, task): 1430 def buildTargets(self, targets, task):
1429 """ 1431 """
@@ -1494,7 +1496,7 @@ class BBCooker:
1494 if 'universe' in targets: 1496 if 'universe' in targets:
1495 rq.rqdata.warn_multi_bb = True 1497 rq.rqdata.warn_multi_bb = True
1496 1498
1497 self.configuration.server_register_idlecallback(buildTargetsIdle, rq) 1499 self.idleCallBackRegister(buildTargetsIdle, rq)
1498 1500
1499 1501
1500 def getAllKeysWithFlags(self, flaglist): 1502 def getAllKeysWithFlags(self, flaglist):
diff --git a/bitbake/lib/bb/cookerdata.py b/bitbake/lib/bb/cookerdata.py
index 24bf09c56b..b86e7d446b 100644
--- a/bitbake/lib/bb/cookerdata.py
+++ b/bitbake/lib/bb/cookerdata.py
@@ -143,16 +143,10 @@ class CookerConfiguration(object):
143 setattr(self, key, parameters.options.__dict__[key]) 143 setattr(self, key, parameters.options.__dict__[key])
144 self.env = parameters.environment.copy() 144 self.env = parameters.environment.copy()
145 145
146 def setServerRegIdleCallback(self, srcb):
147 self.server_register_idlecallback = srcb
148
149 def __getstate__(self): 146 def __getstate__(self):
150 state = {} 147 state = {}
151 for key in self.__dict__.keys(): 148 for key in self.__dict__.keys():
152 if key == "server_register_idlecallback": 149 state[key] = getattr(self, key)
153 state[key] = None
154 else:
155 state[key] = getattr(self, key)
156 return state 150 return state
157 151
158 def __setstate__(self,state): 152 def __setstate__(self,state):
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py
index a152b44824..a3ef10753d 100644
--- a/bitbake/lib/bb/server/process.py
+++ b/bitbake/lib/bb/server/process.py
@@ -467,11 +467,10 @@ class BitBakeServer(object):
467 sys.stdout.flush() 467 sys.stdout.flush()
468 468
469 server = ProcessServer(self.bitbake_lock, self.sock, self.sockname) 469 server = ProcessServer(self.bitbake_lock, self.sock, self.sockname)
470 self.configuration.setServerRegIdleCallback(server.register_idle_function)
471 os.close(self.readypipe) 470 os.close(self.readypipe)
472 writer = ConnectionWriter(self.readypipein) 471 writer = ConnectionWriter(self.readypipein)
473 try: 472 try:
474 self.cooker = bb.cooker.BBCooker(self.configuration, self.featureset) 473 self.cooker = bb.cooker.BBCooker(self.configuration, self.featureset, server.register_idle_function)
475 except bb.BBHandledException: 474 except bb.BBHandledException:
476 return None 475 return None
477 writer.send("r") 476 writer.send("r")