From f0535beecc692a6213be2a22f9eef5956450ecf8 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 24 Aug 2020 12:41:53 +0100 Subject: cooker/cookerdata/main: Improve loglevel handling Rather than passing debug/verbose/debug_domains around, pass the computed output of these. Ensure that the cooker sets the levels to match the levels currently set in the UI and generally try and make it easier to understand what the code is doing. Signed-off-by: Richard Purdie --- lib/bb/cooker.py | 7 ++++++- lib/bb/cookerdata.py | 10 ++++++---- lib/bb/main.py | 8 ++++---- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py index 57caf38c2..c34de303f 100644 --- a/lib/bb/cooker.py +++ b/lib/bb/cooker.py @@ -446,7 +446,12 @@ class BBCooker: logger.debug(1, "Marking as dirty due to '%s' option change to '%s'" % (o, options[o])) print("Marking as dirty due to '%s' option change to '%s'" % (o, options[o])) clean = False - setattr(self.configuration, o, options[o]) + if hasattr(self.configuration, o): + setattr(self.configuration, o, options[o]) + + bb.msg.loggerDefaultLogLevel = self.configuration.default_loglevel + bb.msg.loggerDefaultDomains = self.configuration.debug_domains + for k in bb.utils.approved_variables(): if k in environment and k not in self.configuration.env: logger.debug(1, "Updating new environment variable %s to %s" % (k, environment[k])) diff --git a/lib/bb/cookerdata.py b/lib/bb/cookerdata.py index 6bf411bcd..f43610e7f 100644 --- a/lib/bb/cookerdata.py +++ b/lib/bb/cookerdata.py @@ -58,13 +58,15 @@ class ConfigParameters(object): def updateToServer(self, server, environment): options = {} for o in ["abort", "force", "invalidate_stamp", - "debug", "dry_run", "dump_signatures", - "debug_domains", "extra_assume_provided", "profile", + "dry_run", "dump_signatures", + "extra_assume_provided", "profile", "prefile", "postfile", "server_timeout"]: options[o] = getattr(self.options, o) options['build_verbose_shell'] = self.options.verbose options['build_verbose_stdout'] = self.options.verbose + options['default_loglevel'] = bb.msg.loggerDefaultLogLevel + options['debug_domains'] = bb.msg.loggerDefaultDomains ret, error = server.runCommand(["updateConfig", options, environment, sys.argv]) if error: @@ -114,11 +116,11 @@ class CookerConfiguration(object): """ def __init__(self): - self.debug_domains = [] + self.debug_domains = bb.msg.loggerDefaultDomains + self.default_loglevel = bb.msg.loggerDefaultLogLevel self.extra_assume_provided = [] self.prefile = [] self.postfile = [] - self.debug = 0 self.cmd = None self.abort = True self.force = False diff --git a/lib/bb/main.py b/lib/bb/main.py index af2880f8d..e483cce1a 100755 --- a/lib/bb/main.py +++ b/lib/bb/main.py @@ -357,11 +357,11 @@ def bitbake_main(configParams, configuration): if "BBDEBUG" in os.environ: level = int(os.environ["BBDEBUG"]) - if level > configuration.debug: - configuration.debug = level + if level > configParams.debug: + configParams.debug = level - bb.msg.init_msgconfig(configParams.verbose, configuration.debug, - configuration.debug_domains) + bb.msg.init_msgconfig(configParams.verbose, configParams.debug, + configParams.debug_domains) server_connection, ui_module = setup_bitbake(configParams, configuration) # No server connection -- cgit 1.2.3-korg