diff options
Diffstat (limited to 'import-layers/yocto-poky/bitbake/lib/bb/main.py')
-rwxr-xr-x | import-layers/yocto-poky/bitbake/lib/bb/main.py | 108 |
1 files changed, 69 insertions, 39 deletions
diff --git a/import-layers/yocto-poky/bitbake/lib/bb/main.py b/import-layers/yocto-poky/bitbake/lib/bb/main.py index f2f59f670..8c948c2c1 100755 --- a/import-layers/yocto-poky/bitbake/lib/bb/main.py +++ b/import-layers/yocto-poky/bitbake/lib/bb/main.py @@ -174,13 +174,24 @@ class BitBakeConfigParameters(cookerdata.ConfigParameters): help="Read the specified file after bitbake.conf.") parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False, - help="Output more log message data to the terminal.") + help="Enable tracing of shell tasks (with 'set -x'). " + "Also print bb.note(...) messages to stdout (in " + "addition to writing them to ${T}/log.do_<task>).") parser.add_option("-D", "--debug", action="count", dest="debug", default=0, - help="Increase the debug level. You can specify this more than once.") - - parser.add_option("-q", "--quiet", action="store_true", dest="quiet", default=False, - help="Output less log message data to the terminal.") + help="Increase the debug level. You can specify this " + "more than once. -D sets the debug level to 1, " + "where only bb.debug(1, ...) messages are printed " + "to stdout; -DD sets the debug level to 2, where " + "both bb.debug(1, ...) and bb.debug(2, ...) " + "messages are printed; etc. Without -D, no debug " + "messages are printed. Note that -D only affects " + "output to stdout. All debug messages are written " + "to ${T}/log.do_taskname, regardless of the debug " + "level.") + + parser.add_option("-q", "--quiet", action="count", dest="quiet", default=0, + help="Output less log message data to the terminal. You can specify this more than once.") parser.add_option("-n", "--dry-run", action="store_true", dest="dry_run", default=False, help="Don't execute, just go through the motions.") @@ -287,6 +298,9 @@ class BitBakeConfigParameters(cookerdata.ConfigParameters): help="Writes the event log of the build to a bitbake event json file. " "Use '' (empty string) to assign the name automatically.") + parser.add_option("", "--runall", action="store", dest="runall", + help="Run the specified task for all build targets and their dependencies.") + options, targets = parser.parse_args(argv) if options.quiet and options.verbose: @@ -367,6 +381,7 @@ def start_server(servermodule, configParams, configuration, features): raise if not configParams.foreground: server.detach() + cooker.shutdown() cooker.lock.close() return server @@ -389,12 +404,8 @@ def bitbake_main(configParams, configuration): except: pass - configuration.setConfigParameters(configParams) - ui_module = import_extension_module(bb.ui, configParams.ui, 'main') - servermodule = import_extension_module(bb.server, configParams.servertype, 'BitBakeServer') - if configParams.server_only: if configParams.servertype != "xmlrpc": raise BBMainException("FATAL: If '--server-only' is defined, we must set the " @@ -442,6 +453,31 @@ def bitbake_main(configParams, configuration): bb.msg.init_msgconfig(configParams.verbose, configuration.debug, configuration.debug_domains) + server, server_connection, ui_module = setup_bitbake(configParams, configuration) + if server_connection is None and configParams.kill_server: + return 0 + + if not configParams.server_only: + if configParams.status_only: + server_connection.terminate() + return 0 + + try: + return ui_module.main(server_connection.connection, server_connection.events, + configParams) + finally: + bb.event.ui_queue = [] + server_connection.terminate() + else: + print("Bitbake server address: %s, server port: %s" % (server.serverImpl.host, + server.serverImpl.port)) + if configParams.foreground: + server.serverImpl.serve_forever() + return 0 + + return 1 + +def setup_bitbake(configParams, configuration, extrafeatures=None): # Ensure logging messages get sent to the UI as events handler = bb.event.LogHandler() if not configParams.status_only: @@ -451,8 +487,11 @@ def bitbake_main(configParams, configuration): # Clear away any spurious environment variables while we stoke up the cooker cleanedvars = bb.utils.clean_environment() - featureset = [] - if not configParams.server_only: + if configParams.server_only: + featureset = [] + ui_module = None + else: + ui_module = import_extension_module(bb.ui, configParams.ui, 'main') # Collect the feature set for the UI featureset = getattr(ui_module, "featureSet", []) @@ -463,11 +502,15 @@ def bitbake_main(configParams, configuration): setattr(configuration, "%s_server" % param, value) param = "%s_server" % param - if not configParams.remote_server: - # we start a server with a given configuration - server = start_server(servermodule, configParams, configuration, featureset) - bb.event.ui_queue = [] - else: + if extrafeatures: + for feature in extrafeatures: + if not feature in featureset: + featureset.append(feature) + + servermodule = import_extension_module(bb.server, + configParams.servertype, + 'BitBakeServer') + if configParams.remote_server: if os.getenv('BBSERVER') == 'autostart': if configParams.remote_server == 'autostart' or \ not servermodule.check_connection(configParams.remote_server, timeout=2): @@ -475,14 +518,19 @@ def bitbake_main(configParams, configuration): srv = start_server(servermodule, configParams, configuration, featureset) configParams.remote_server = '%s:%d' % tuple(configuration.interface) bb.event.ui_queue = [] - # we start a stub server that is actually a XMLRPClient that connects to a real server + from bb.server.xmlrpc import BitBakeXMLRPCClient server = servermodule.BitBakeXMLRPCClient(configParams.observe_only, configParams.xmlrpctoken) server.saveConnectionDetails(configParams.remote_server) + else: + # we start a server with a given configuration + server = start_server(servermodule, configParams, configuration, featureset) + bb.event.ui_queue = [] - - if not configParams.server_only: + if configParams.server_only: + server_connection = None + else: try: server_connection = server.establishConnection(featureset) except Exception as e: @@ -491,7 +539,7 @@ def bitbake_main(configParams, configuration): if configParams.kill_server: server_connection.connection.terminateServer() bb.event.ui_queue = [] - return 0 + return None, None, None server_connection.setupEventQueue() @@ -501,22 +549,4 @@ def bitbake_main(configParams, configuration): logger.removeHandler(handler) - - if configParams.status_only: - server_connection.terminate() - return 0 - - try: - return ui_module.main(server_connection.connection, server_connection.events, - configParams) - finally: - bb.event.ui_queue = [] - server_connection.terminate() - else: - print("Bitbake server address: %s, server port: %s" % (server.serverImpl.host, - server.serverImpl.port)) - if configParams.foreground: - server.serverImpl.serve_forever() - return 0 - - return 1 + return server, server_connection, ui_module |