1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-08 17:19:20 +00:00

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>
This commit is contained in:
Richard Purdie
2020-08-24 17:05:13 +01:00
parent a1c956ab4c
commit b9bbb5c7b7
5 changed files with 12 additions and 28 deletions
+2 -2
View File
@@ -148,7 +148,7 @@ class BBCooker:
Manages one bitbake build run Manages one bitbake build run
""" """
def __init__(self, configuration, featureSet=None, idleCallBackRegister=None): def __init__(self, featureSet=None, idleCallBackRegister=None):
self.recipecaches = None self.recipecaches = None
self.eventlog = None self.eventlog = None
self.skiplist = {} self.skiplist = {}
@@ -157,7 +157,7 @@ class BBCooker:
for f in featureSet: for f in featureSet:
self.featureset.setFeature(f) self.featureset.setFeature(f)
self.configuration = configuration self.configuration = bb.cookerdata.CookerConfiguration()
self.idleCallBackRegister = idleCallBackRegister self.idleCallBackRegister = idleCallBackRegister
-9
View File
@@ -136,22 +136,13 @@ class CookerConfiguration(object):
self.build_verbose_stdout = False self.build_verbose_stdout = False
self.dry_run = False self.dry_run = False
self.tracking = False self.tracking = False
self.xmlrpcinterface = []
self.server_timeout = None
self.writeeventlog = False self.writeeventlog = False
self.server_only = False
self.limited_deps = False self.limited_deps = False
self.runall = [] self.runall = []
self.runonly = [] self.runonly = []
self.env = {} self.env = {}
def setConfigParameters(self, parameters):
for key in self.__dict__.keys():
if key in parameters.options.__dict__:
setattr(self, key, parameters.options.__dict__[key])
self.env = parameters.environment.copy()
def __getstate__(self): def __getstate__(self):
state = {} state = {}
for key in self.__dict__.keys(): for key in self.__dict__.keys():
+4 -6
View File
@@ -344,8 +344,6 @@ def bitbake_main(configParams, configuration):
except: except:
pass pass
configuration.setConfigParameters(configParams)
if configParams.server_only and configParams.remote_server: if configParams.server_only and configParams.remote_server:
raise BBMainException("FATAL: The '--server-only' option conflicts with %s.\n" % raise BBMainException("FATAL: The '--server-only' option conflicts with %s.\n" %
("the BBSERVER environment variable" if "BBSERVER" in os.environ \ ("the BBSERVER environment variable" if "BBSERVER" in os.environ \
@@ -363,7 +361,7 @@ def bitbake_main(configParams, configuration):
bb.msg.init_msgconfig(configParams.verbose, configParams.debug, bb.msg.init_msgconfig(configParams.verbose, configParams.debug,
configParams.debug_domains) configParams.debug_domains)
server_connection, ui_module = setup_bitbake(configParams, configuration) server_connection, ui_module = setup_bitbake(configParams)
# No server connection # No server connection
if server_connection is None: if server_connection is None:
if configParams.status_only: if configParams.status_only:
@@ -390,7 +388,7 @@ def bitbake_main(configParams, configuration):
return 1 return 1
def setup_bitbake(configParams, configuration, extrafeatures=None): def setup_bitbake(configParams, extrafeatures=None):
# Ensure logging messages get sent to the UI as events # Ensure logging messages get sent to the UI as events
handler = bb.event.LogHandler() handler = bb.event.LogHandler()
if not configParams.status_only: if not configParams.status_only:
@@ -431,11 +429,11 @@ def setup_bitbake(configParams, configuration, extrafeatures=None):
logger.info("bitbake server is not running.") logger.info("bitbake server is not running.")
lock.close() lock.close()
return None, None return None, None
# we start a server with a given configuration # we start a server with a given featureset
logger.info("Starting bitbake server...") logger.info("Starting bitbake server...")
# Clear the event queue since we already displayed messages # Clear the event queue since we already displayed messages
bb.event.ui_queue = [] bb.event.ui_queue = []
server = bb.server.process.BitBakeServer(lock, sockname, configuration, featureset) server = bb.server.process.BitBakeServer(lock, sockname, featureset, configParams.server_timeout, configParams.xmlrpcinterface)
else: else:
logger.info("Reconnecting to bitbake server...") logger.info("Reconnecting to bitbake server...")
+5 -4
View File
@@ -394,9 +394,10 @@ class BitBakeServer(object):
start_log_format = '--- Starting bitbake server pid %s at %s ---' start_log_format = '--- Starting bitbake server pid %s at %s ---'
start_log_datetime_format = '%Y-%m-%d %H:%M:%S.%f' start_log_datetime_format = '%Y-%m-%d %H:%M:%S.%f'
def __init__(self, lock, sockname, configuration, featureset): def __init__(self, lock, sockname, featureset, server_timeout, xmlrpcinterface):
self.configuration = configuration self.server_timeout = server_timeout
self.xmlrpcinterface = xmlrpcinterface
self.featureset = featureset self.featureset = featureset
self.sockname = sockname self.sockname = sockname
self.bitbake_lock = lock self.bitbake_lock = lock
@@ -476,11 +477,11 @@ class BitBakeServer(object):
os.chdir(cwd) os.chdir(cwd)
sock.listen(1) sock.listen(1)
server = ProcessServer(self.bitbake_lock, sock, self.sockname, self.configuration.server_timeout, self.configuration.xmlrpcinterface) server = ProcessServer(self.bitbake_lock, sock, self.sockname, self.server_timeout, self.xmlrpcinterface)
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, server.register_idle_function) self.cooker = bb.cooker.BBCooker(self.featureset, server.register_idle_function)
except bb.BBHandledException: except bb.BBHandledException:
return None return None
writer.send("r") writer.send("r")
+1 -7
View File
@@ -22,7 +22,6 @@ import bb.taskdata
import bb.utils import bb.utils
import bb.command import bb.command
import bb.remotedata import bb.remotedata
from bb.cookerdata import CookerConfiguration
from bb.main import setup_bitbake, BitBakeConfigParameters from bb.main import setup_bitbake, BitBakeConfigParameters
import bb.fetch2 import bb.fetch2
@@ -381,18 +380,13 @@ class Tinfoil:
if not config_params: if not config_params:
config_params = TinfoilConfigParameters(config_only=config_only, quiet=quiet) config_params = TinfoilConfigParameters(config_only=config_only, quiet=quiet)
cookerconfig = CookerConfiguration()
cookerconfig.setConfigParameters(config_params)
if not config_only: if not config_only:
# Disable local loggers because the UI module is going to set up its own # Disable local loggers because the UI module is going to set up its own
for handler in self.localhandlers: for handler in self.localhandlers:
self.logger.handlers.remove(handler) self.logger.handlers.remove(handler)
self.localhandlers = [] self.localhandlers = []
self.server_connection, ui_module = setup_bitbake(config_params, self.server_connection, ui_module = setup_bitbake(config_params, extrafeatures)
cookerconfig,
extrafeatures)
self.ui_module = ui_module self.ui_module = ui_module