diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-08-24 17:05:13 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-08-25 18:14:53 +0100 |
commit | b9bbb5c7b7ea010a098e19c8da34fd5ea667a39f (patch) | |
tree | db4630996fbebd794815d0cb9e0144ba4297ff7f /bitbake | |
parent | a1c956ab4cae61ab3640d0455887645940e85ab6 (diff) | |
download | poky-b9bbb5c7b7ea010a098e19c8da34fd5ea667a39f.tar.gz |
bitbake: main/server/process: Drop configuration object passing
The first thing the UIs do is update the server config from the UI. We
can just rely upon that and start the server with a standard config,
removing the need to pass the confusing configuration object around
as well as configParams, which contains a similar copy of some of the
data.
This makes memory resident bitbake work the same way as the normal
mode, removing the opportunity for some class of bugs.
The xmlrpcinterface and server_timeout values are passed in at server
startup time now and there no longer a second option in the
configuration which is effective ignored once the server starts.
(Bitbake rev: 783a03330802e83c525c55522e3ee2a933bded3a)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/cooker.py | 4 | ||||
-rw-r--r-- | bitbake/lib/bb/cookerdata.py | 9 | ||||
-rwxr-xr-x | bitbake/lib/bb/main.py | 10 | ||||
-rw-r--r-- | bitbake/lib/bb/server/process.py | 9 | ||||
-rw-r--r-- | bitbake/lib/bb/tinfoil.py | 8 |
5 files changed, 12 insertions, 28 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 3f9cb75434..99605e5844 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, idleCallBackRegister=None): | 151 | def __init__(self, featureSet=None, idleCallBackRegister=None): |
152 | self.recipecaches = None | 152 | self.recipecaches = None |
153 | self.eventlog = None | 153 | self.eventlog = None |
154 | self.skiplist = {} | 154 | self.skiplist = {} |
@@ -157,7 +157,7 @@ class BBCooker: | |||
157 | for f in featureSet: | 157 | for f in featureSet: |
158 | self.featureset.setFeature(f) | 158 | self.featureset.setFeature(f) |
159 | 159 | ||
160 | self.configuration = configuration | 160 | self.configuration = bb.cookerdata.CookerConfiguration() |
161 | 161 | ||
162 | self.idleCallBackRegister = idleCallBackRegister | 162 | self.idleCallBackRegister = idleCallBackRegister |
163 | 163 | ||
diff --git a/bitbake/lib/bb/cookerdata.py b/bitbake/lib/bb/cookerdata.py index 3baa9ade1b..190ff3ab82 100644 --- a/bitbake/lib/bb/cookerdata.py +++ b/bitbake/lib/bb/cookerdata.py | |||
@@ -136,22 +136,13 @@ class CookerConfiguration(object): | |||
136 | self.build_verbose_stdout = False | 136 | self.build_verbose_stdout = False |
137 | self.dry_run = False | 137 | self.dry_run = False |
138 | self.tracking = False | 138 | self.tracking = False |
139 | self.xmlrpcinterface = [] | ||
140 | self.server_timeout = None | ||
141 | self.writeeventlog = False | 139 | self.writeeventlog = False |
142 | self.server_only = False | ||
143 | self.limited_deps = False | 140 | self.limited_deps = False |
144 | self.runall = [] | 141 | self.runall = [] |
145 | self.runonly = [] | 142 | self.runonly = [] |
146 | 143 | ||
147 | self.env = {} | 144 | self.env = {} |
148 | 145 | ||
149 | def setConfigParameters(self, parameters): | ||
150 | for key in self.__dict__.keys(): | ||
151 | if key in parameters.options.__dict__: | ||
152 | setattr(self, key, parameters.options.__dict__[key]) | ||
153 | self.env = parameters.environment.copy() | ||
154 | |||
155 | def __getstate__(self): | 146 | def __getstate__(self): |
156 | state = {} | 147 | state = {} |
157 | for key in self.__dict__.keys(): | 148 | for key in self.__dict__.keys(): |
diff --git a/bitbake/lib/bb/main.py b/bitbake/lib/bb/main.py index e483cce1ae..7990195eac 100755 --- a/bitbake/lib/bb/main.py +++ b/bitbake/lib/bb/main.py | |||
@@ -344,8 +344,6 @@ def bitbake_main(configParams, configuration): | |||
344 | except: | 344 | except: |
345 | pass | 345 | pass |
346 | 346 | ||
347 | configuration.setConfigParameters(configParams) | ||
348 | |||
349 | if configParams.server_only and configParams.remote_server: | 347 | if configParams.server_only and configParams.remote_server: |
350 | raise BBMainException("FATAL: The '--server-only' option conflicts with %s.\n" % | 348 | raise BBMainException("FATAL: The '--server-only' option conflicts with %s.\n" % |
351 | ("the BBSERVER environment variable" if "BBSERVER" in os.environ \ | 349 | ("the BBSERVER environment variable" if "BBSERVER" in os.environ \ |
@@ -363,7 +361,7 @@ def bitbake_main(configParams, configuration): | |||
363 | bb.msg.init_msgconfig(configParams.verbose, configParams.debug, | 361 | bb.msg.init_msgconfig(configParams.verbose, configParams.debug, |
364 | configParams.debug_domains) | 362 | configParams.debug_domains) |
365 | 363 | ||
366 | server_connection, ui_module = setup_bitbake(configParams, configuration) | 364 | server_connection, ui_module = setup_bitbake(configParams) |
367 | # No server connection | 365 | # No server connection |
368 | if server_connection is None: | 366 | if server_connection is None: |
369 | if configParams.status_only: | 367 | if configParams.status_only: |
@@ -390,7 +388,7 @@ def bitbake_main(configParams, configuration): | |||
390 | 388 | ||
391 | return 1 | 389 | return 1 |
392 | 390 | ||
393 | def setup_bitbake(configParams, configuration, extrafeatures=None): | 391 | def setup_bitbake(configParams, extrafeatures=None): |
394 | # Ensure logging messages get sent to the UI as events | 392 | # Ensure logging messages get sent to the UI as events |
395 | handler = bb.event.LogHandler() | 393 | handler = bb.event.LogHandler() |
396 | if not configParams.status_only: | 394 | if not configParams.status_only: |
@@ -431,11 +429,11 @@ def setup_bitbake(configParams, configuration, extrafeatures=None): | |||
431 | logger.info("bitbake server is not running.") | 429 | logger.info("bitbake server is not running.") |
432 | lock.close() | 430 | lock.close() |
433 | return None, None | 431 | return None, None |
434 | # we start a server with a given configuration | 432 | # we start a server with a given featureset |
435 | logger.info("Starting bitbake server...") | 433 | logger.info("Starting bitbake server...") |
436 | # Clear the event queue since we already displayed messages | 434 | # Clear the event queue since we already displayed messages |
437 | bb.event.ui_queue = [] | 435 | bb.event.ui_queue = [] |
438 | server = bb.server.process.BitBakeServer(lock, sockname, configuration, featureset) | 436 | server = bb.server.process.BitBakeServer(lock, sockname, featureset, configParams.server_timeout, configParams.xmlrpcinterface) |
439 | 437 | ||
440 | else: | 438 | else: |
441 | logger.info("Reconnecting to bitbake server...") | 439 | logger.info("Reconnecting to bitbake server...") |
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py index 8f5abb32bf..03cdde04ee 100644 --- a/bitbake/lib/bb/server/process.py +++ b/bitbake/lib/bb/server/process.py | |||
@@ -394,9 +394,10 @@ class BitBakeServer(object): | |||
394 | start_log_format = '--- Starting bitbake server pid %s at %s ---' | 394 | start_log_format = '--- Starting bitbake server pid %s at %s ---' |
395 | start_log_datetime_format = '%Y-%m-%d %H:%M:%S.%f' | 395 | start_log_datetime_format = '%Y-%m-%d %H:%M:%S.%f' |
396 | 396 | ||
397 | def __init__(self, lock, sockname, configuration, featureset): | 397 | def __init__(self, lock, sockname, featureset, server_timeout, xmlrpcinterface): |
398 | 398 | ||
399 | self.configuration = configuration | 399 | self.server_timeout = server_timeout |
400 | self.xmlrpcinterface = xmlrpcinterface | ||
400 | self.featureset = featureset | 401 | self.featureset = featureset |
401 | self.sockname = sockname | 402 | self.sockname = sockname |
402 | self.bitbake_lock = lock | 403 | self.bitbake_lock = lock |
@@ -476,11 +477,11 @@ class BitBakeServer(object): | |||
476 | os.chdir(cwd) | 477 | os.chdir(cwd) |
477 | sock.listen(1) | 478 | sock.listen(1) |
478 | 479 | ||
479 | server = ProcessServer(self.bitbake_lock, sock, self.sockname, self.configuration.server_timeout, self.configuration.xmlrpcinterface) | 480 | server = ProcessServer(self.bitbake_lock, sock, self.sockname, self.server_timeout, self.xmlrpcinterface) |
480 | os.close(self.readypipe) | 481 | os.close(self.readypipe) |
481 | writer = ConnectionWriter(self.readypipein) | 482 | writer = ConnectionWriter(self.readypipein) |
482 | try: | 483 | try: |
483 | self.cooker = bb.cooker.BBCooker(self.configuration, self.featureset, server.register_idle_function) | 484 | self.cooker = bb.cooker.BBCooker(self.featureset, server.register_idle_function) |
484 | except bb.BBHandledException: | 485 | except bb.BBHandledException: |
485 | return None | 486 | return None |
486 | writer.send("r") | 487 | writer.send("r") |
diff --git a/bitbake/lib/bb/tinfoil.py b/bitbake/lib/bb/tinfoil.py index dccbe0ebb5..e19d9cff04 100644 --- a/bitbake/lib/bb/tinfoil.py +++ b/bitbake/lib/bb/tinfoil.py | |||
@@ -22,7 +22,6 @@ import bb.taskdata | |||
22 | import bb.utils | 22 | import bb.utils |
23 | import bb.command | 23 | import bb.command |
24 | import bb.remotedata | 24 | import bb.remotedata |
25 | from bb.cookerdata import CookerConfiguration | ||
26 | from bb.main import setup_bitbake, BitBakeConfigParameters | 25 | from bb.main import setup_bitbake, BitBakeConfigParameters |
27 | import bb.fetch2 | 26 | import bb.fetch2 |
28 | 27 | ||
@@ -381,18 +380,13 @@ class Tinfoil: | |||
381 | if not config_params: | 380 | if not config_params: |
382 | config_params = TinfoilConfigParameters(config_only=config_only, quiet=quiet) | 381 | config_params = TinfoilConfigParameters(config_only=config_only, quiet=quiet) |
383 | 382 | ||
384 | cookerconfig = CookerConfiguration() | ||
385 | cookerconfig.setConfigParameters(config_params) | ||
386 | |||
387 | if not config_only: | 383 | if not config_only: |
388 | # Disable local loggers because the UI module is going to set up its own | 384 | # Disable local loggers because the UI module is going to set up its own |
389 | for handler in self.localhandlers: | 385 | for handler in self.localhandlers: |
390 | self.logger.handlers.remove(handler) | 386 | self.logger.handlers.remove(handler) |
391 | self.localhandlers = [] | 387 | self.localhandlers = [] |
392 | 388 | ||
393 | self.server_connection, ui_module = setup_bitbake(config_params, | 389 | self.server_connection, ui_module = setup_bitbake(config_params, extrafeatures) |
394 | cookerconfig, | ||
395 | extrafeatures) | ||
396 | 390 | ||
397 | self.ui_module = ui_module | 391 | self.ui_module = ui_module |
398 | 392 | ||