Patchwork [bitbake-devel] event: temporarily disable verbose logs

login
register
mail settings
Submitter Enrico Scholz
Date Dec. 13, 2012, 5:18 p.m.
Message ID <1355419104-24901-1-git-send-email-enrico.scholz@sigma-chemnitz.de>
Download mbox | patch
Permalink /patch/40921/
State New
Headers show

Comments

Enrico Scholz - Dec. 13, 2012, 5:18 p.m.
Because stderr of event handlers is directly printed to the console,
this will pollute output when using e.g. 'buildhistory' which calls a
shell function.

Patch disables 'set -x' temporarily while executing the event handler.

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
---
 lib/bb/event.py | 3 +++
 1 file changed, 3 insertions(+)

Patch

diff --git a/lib/bb/event.py b/lib/bb/event.py
index e41455d..7712822 100644
--- a/lib/bb/event.py
+++ b/lib/bb/event.py
@@ -64,7 +64,9 @@  bb.utils._context["Handled"] = Handled
 
 def execute_handler(name, handler, event, d):
     event.data = d
+    old_verbose = bb.msg.loggerVerboseLogs
     try:
+        bb.msg.loggerVerboseLogs = False
         ret = handler(event)
     except bb.parse.SkipPackage:
         raise
@@ -78,6 +80,7 @@  def execute_handler(name, handler, event, d):
             logger.error("Execution of event handler '%s' failed" % name)
         raise
     finally:
+        bb.msg.loggerVerboseLogs = old_verbose
         del event.data
 
     if ret is not None: