Skip to contentSkip to conversation

Allow set +x for shell functions to be configured

PATCH In review Paul Eggleton 1 participant 3 messages Feb 27, 2012

lore
Share & tools
lore
#0 lore raw

cover Allow set +x for shell functions to be configured

A patch to allow the addition of "set +x" to be controlled via configuration.

The patch (against Poky, but applies cleanly with -p2 against bitbake master) is available in the git repository at:
git://git.yoctoproject.org/poky-contrib paule/bbverboselogs
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=paule/bbverboselogs

Paul Eggleton (1):
bitbake: implement BB_VERBOSE_LOGS

 bitbake/lib/bb/build.py  |    3 ++-
 bitbake/lib/bb/cooker.py |    4 ++++
 bitbake/lib/bb/msg.py    |    5 ++++-
 3 files changed, 10 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/1 bitbake: implement BB_VERBOSE_LOGS

Enable configuring whether "set +x" is added to all shell tasks rather than forcing it; this is enabled by setting BB_VERBOSE_LOGS to 1.

---
 bitbake/lib/bb/build.py  |    3 ++-
 bitbake/lib/bb/cooker.py |    4 ++++
 bitbake/lib/bb/msg.py    |    5 ++++-
 3 files changed, 10 insertions(+), 2 deletions(-)
bitbake/lib/bb/build.py +2 -1
index e85d7c4..37686f8 100644
@@ -221,9 +221,10 @@ def exec_func_shell(function, d, runfile, cwd=None):
 
     with open(runfile, 'w') as script:
         script.write('#!/bin/sh -e\n')
+        if bb.msg.loggerVerboseLogs:
+            script.write("set -x\n")
         data.emit_func(function, script, d)
 
-        script.write("set -x\n")
         if cwd:
             script.write("cd %s\n" % cwd)
         script.write("%s\n" % function)
bitbake/lib/bb/cooker.py +4 -0
index 12b526b..d3bdd17 100644
@@ -206,6 +206,10 @@ class BBCooker:
 
     def parseConfiguration(self):
 
+        # Set log file verbosity
+        verboselogs = bb.utils.to_boolean(self.configuration.data.getVar("BB_VERBOSE_LOGS", "0"))
+        if verboselogs:
+            bb.msg.loggerVerboseLogs = True
 
         # Change nice level if we're asked to
         nice = self.configuration.data.getVar("BB_NICE_LEVEL", True)
bitbake/lib/bb/msg.py +4 -1
index 20d9bdd..94865ee 100644
@@ -100,14 +100,17 @@ class BBLogFilter(object):
 
 loggerDefaultDebugLevel = 0
 loggerDefaultVerbose = False
+loggerVerboseLogs = False
 loggerDefaultDomains = []
 
-def init_msgconfig(verbose, debug, debug_domains = []):
+def init_msgconfig(verbose, debug, debug_domains = [], verboselogsonly = False):
     """
     Set default verbosity and debug levels config the logger
     """
     bb.msg.loggerDefaultDebugLevel = debug
     bb.msg.loggerDefaultVerbose = verbose
+    if verbose:
+        bb.msg.loggerVerboseLogs = True
     bb.msg.loggerDefaultDomains = debug_domains
 
 def addDefaultlogFilter(handler):
Signature · 1 line
1.7.5.4
#2 lore raw

Re: [PATCH 1/1] bitbake: implement BB_VERBOSE_LOGS

Quoted 55 lines · On Monday 27 February 2012 14:06:18 Paul Eggleton wrote:

Enable configuring whether "set +x" is added to all shell tasks rather than forcing it; this is enabled by setting BB_VERBOSE_LOGS to 1.

---
 bitbake/lib/bb/build.py  |    3 ++-
 bitbake/lib/bb/cooker.py |    4 ++++
 bitbake/lib/bb/msg.py    |    5 ++++-
 3 files changed, 10 insertions(+), 2 deletions(-)
bitbake/lib/bb/build.py +2 -1
index e85d7c4..37686f8 100644
@@ -221,9 +221,10 @@ def exec_func_shell(function, d, runfile, cwd=None):
 
     with open(runfile, 'w') as script:
         script.write('#!/bin/sh -e\n')
+        if bb.msg.loggerVerboseLogs:
+            script.write("set -x\n")
         data.emit_func(function, script, d)
 
-        script.write("set -x\n")
         if cwd:
             script.write("cd %s\n" % cwd)
         script.write("%s\n" % function)
bitbake/lib/bb/cooker.py +4 -0
index 12b526b..d3bdd17 100644
@@ -206,6 +206,10 @@ class BBCooker:
 
     def parseConfiguration(self):
 
+        # Set log file verbosity
+        verboselogs =
 bb.utils.to_boolean(self.configuration.data.getVar("BB_VERBOSE_LOGS", "0"))
+        if verboselogs:
+            bb.msg.loggerVerboseLogs = True
 
         # Change nice level if we're asked to

nice = self.configuration.data.getVar("BB_NICE_LEVEL", True)

bitbake/lib/bb/msg.py +2 -1
index 20d9bdd..94865ee 100644
@@ -100,14 +100,17 @@ class BBLogFilter(object):
 
 loggerDefaultDebugLevel = 0
 loggerDefaultVerbose = False
+loggerVerboseLogs = False
 loggerDefaultDomains = []
 
-def init_msgconfig(verbose, debug, debug_domains = []):
+def init_msgconfig(verbose, debug, debug_domains = [], verboselogsonly =
Quoted 1 line

False): """

Whoops, this crept in from an earlier version. v2 on the way.

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre