[bitbake-devel,1/2] tinfoil: fix duplication of log messages

Submitted by Paul Eggleton on June 7, 2017, 7:04 p.m. | Patch ID: 140561

Details

Message ID 17a9d9b7ac782a82ebe518ba724b7f531c111ca3.1496862217.git.paul.eggleton@linux.intel.com
State New
Headers show

Commit Message

Paul Eggleton June 7, 2017, 7:04 p.m.
Adding an additional logger in setup_bitbake() interacts poorly with the
logger we have added by default in tinfoil's constructor, with the
result that messages may be doubled or even tripled in tinfoil-using
scripts. Disable adding this one when calling setup_bitbake() from
tinfoil to avoid this problem.

Part of the fix for [YOCTO #11275].

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 lib/bb/main.py    | 4 ++--
 lib/bb/tinfoil.py | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/lib/bb/main.py b/lib/bb/main.py
index 8c948c2..29e3911 100755
--- a/lib/bb/main.py
+++ b/lib/bb/main.py
@@ -477,10 +477,10 @@  def bitbake_main(configParams, configuration):
 
     return 1
 
-def setup_bitbake(configParams, configuration, extrafeatures=None):
+def setup_bitbake(configParams, configuration, extrafeatures=None, setup_logging=True):
     # Ensure logging messages get sent to the UI as events
     handler = bb.event.LogHandler()
-    if not configParams.status_only:
+    if setup_logging and not configParams.status_only:
         # In status only mode there are no logs and no UI
         logger.addHandler(handler)
 
diff --git a/lib/bb/tinfoil.py b/lib/bb/tinfoil.py
index 563c0c4..fb0da62 100644
--- a/lib/bb/tinfoil.py
+++ b/lib/bb/tinfoil.py
@@ -245,7 +245,8 @@  class Tinfoil:
 
         server, self.server_connection, ui_module = setup_bitbake(config_params,
                             cookerconfig,
-                            extrafeatures)
+                            extrafeatures,
+                            setup_logging=False)
 
         self.ui_module = ui_module