* [PATCH 0/3] logging updates
@ 2011-04-25 19:36 Darren Hart
2011-04-25 19:36 ` [PATCH 1/3] logging: fix oedebug loglevel test Darren Hart
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Darren Hart @ 2011-04-25 19:36 UTC (permalink / raw)
To: poky; +Cc: Chris Larson, Darren Hart
The first two patches fix issues in the existing bash logging infrastructure.
The third proposes a new bash logging mechanism.
Pull URL: git://git.pokylinux.org/poky-contrib.git
Branch: dvhart/logging
Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=dvhart/logging
Thanks,
Darren Hart <dvhart@linux.intel.com>
---
Darren Hart (3):
logging: fix oedebug loglevel test
logging: remove unused BBDEBUG from local.conf.sample
logging: add bb* logging mechanisms for bash recipe functions
meta-yocto/conf/local.conf.sample | 2 -
meta/classes/base.bbclass | 9 +++--
meta/classes/logging.bbclass | 72 +++++++++++++++++++++++++++++++++++++
3 files changed, 77 insertions(+), 6 deletions(-)
create mode 100644 meta/classes/logging.bbclass
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 1/3] logging: fix oedebug loglevel test 2011-04-25 19:36 [PATCH 0/3] logging updates Darren Hart @ 2011-04-25 19:36 ` Darren Hart 2011-04-25 19:36 ` [PATCH 2/3] logging: remove unused BBDEBUG from local.conf.sample Darren Hart ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: Darren Hart @ 2011-04-25 19:36 UTC (permalink / raw) To: poky; +Cc: Chris Larson, Darren Hart When the existing test for loglevel fails, the syntax used results in the recipe exiting with a silent failure. Performing any bash command after the test block resolves the problem, such as "shift" or "echo ''". Rewriting with 'if []; then' blocks provides a cleaner syntax and also resolves the failure. Signed-off-by: Darren Hart <dvhart@linux.intel.com> --- meta/classes/base.bbclass | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass index 2157fe9..374ca04 100644 --- a/meta/classes/base.bbclass +++ b/meta/classes/base.bbclass @@ -53,15 +53,15 @@ oefatal() { } oedebug() { - test $# -ge 2 || { + if [ $# -lt 2]; then echo "Usage: oedebug level \"message\"" exit 1 - } + fi - test ${OEDEBUG:-0} -ge $1 && { + if [ ${OEDEBUG:-0} -ge $1 ]; then shift echo "DEBUG:" $* - } + fi } oe_runmake() { -- 1.7.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] logging: remove unused BBDEBUG from local.conf.sample 2011-04-25 19:36 [PATCH 0/3] logging updates Darren Hart 2011-04-25 19:36 ` [PATCH 1/3] logging: fix oedebug loglevel test Darren Hart @ 2011-04-25 19:36 ` Darren Hart 2011-04-25 19:36 ` [PATCH 3/3] logging: add bb* logging mechanisms for bash recipe functions Darren Hart 2011-05-06 22:37 ` [PATCH 0/3] logging updates Saul Wold 3 siblings, 0 replies; 5+ messages in thread From: Darren Hart @ 2011-04-25 19:36 UTC (permalink / raw) To: poky; +Cc: Chris Larson, Darren Hart The boolean BBDEBUG described in local.conf.sample is no longer referenced by any other sources. It also conflicts with the OS environment variable of the same name which maps to the debug log level also specified by the -D[D[D]] argument. Remove the boolean BBDEBUG from local.conf.sample. Signed-off-by: Darren Hart <dvhart@linux.intel.com> Cc: Chris Larson <clarson@kergoth.com> --- meta-yocto/conf/local.conf.sample | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/meta-yocto/conf/local.conf.sample b/meta-yocto/conf/local.conf.sample index c739127..740f542 100644 --- a/meta-yocto/conf/local.conf.sample +++ b/meta-yocto/conf/local.conf.sample @@ -145,8 +145,6 @@ PACKAGE_DEBUG_SPLIT_STYLE = '.debug' # SELECTED_OPTIMIZATION = "${PROFILE_OPTIMIZATION}" # LDFLAGS =+ "-pg" -# Uncomment this if you want BitBake to emit debugging output -# BBDEBUG = "yes" # Uncomment this if you want BitBake to emit the log if a build fails. BBINCLUDELOGS = "yes" -- 1.7.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] logging: add bb* logging mechanisms for bash recipe functions 2011-04-25 19:36 [PATCH 0/3] logging updates Darren Hart 2011-04-25 19:36 ` [PATCH 1/3] logging: fix oedebug loglevel test Darren Hart 2011-04-25 19:36 ` [PATCH 2/3] logging: remove unused BBDEBUG from local.conf.sample Darren Hart @ 2011-04-25 19:36 ` Darren Hart 2011-05-06 22:37 ` [PATCH 0/3] logging updates Saul Wold 3 siblings, 0 replies; 5+ messages in thread From: Darren Hart @ 2011-04-25 19:36 UTC (permalink / raw) To: poky; +Cc: Chris Larson, Darren Hart The following logging mechanisms are to be used in bash functions of recipes. They are intended to map one to one in intention and output format with the python recipe logging functions of a similar naming convention: bb.plain(), bb.note(), etc. For the time being, all of these print only to the task logs. Future enhancements may integrate these calls with the bitbake logging infrastructure, allowing for printing to the console as appropriate. The interface and intention statements reflect that future goal. Once it is in place, no changes will be necessary to recipes using these logging mechanisms. I opted to write new functions instead of modifying the oe* logging functions from base.bbclass (and utils.bbclass in oe) for a couple reasons. First, one of my goals was to generate a uniform logging API between bash and python in recipes. Second, there are no users of oe* logging in meta (oe-core) or meta-yocto, while several oe recipes do use them. I wanted to make a clean start with the freedom to change behavior without forcing the oe recipes to change or experience unexpected logging changes. Eventually, the oe recipes can be migrated to the new bb* logging routines and the existing oe* routines can be retired (deleted). Signed-off-by: Darren Hart <dvhart@linux.intel.com> Cc: Chris Larson <clarson@kergoth.com> --- meta/classes/base.bbclass | 1 + meta/classes/logging.bbclass | 72 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 0 deletions(-) create mode 100644 meta/classes/logging.bbclass diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass index 374ca04..73900cd 100644 --- a/meta/classes/base.bbclass +++ b/meta/classes/base.bbclass @@ -8,6 +8,7 @@ inherit utils inherit utility-tasks inherit metadata_scm inherit buildstats +inherit logging python sys_path_eh () { if isinstance(e, bb.event.ConfigParsed): diff --git a/meta/classes/logging.bbclass b/meta/classes/logging.bbclass new file mode 100644 index 0000000..78d65bd --- /dev/null +++ b/meta/classes/logging.bbclass @@ -0,0 +1,72 @@ +# The following logging mechanisms are to be used in bash functions of recipes. +# They are intended to map one to one in intention and output format with the +# python recipe logging functions of a similar naming convention: bb.plain(), +# bb.note(), etc. +# +# For the time being, all of these print only to the task logs. Future +# enhancements may integrate these calls with the bitbake logging +# infrastructure, allowing for printing to the console as appropriate. The +# interface and intention statements reflect that future goal. Once it is +# in place, no changes will be necessary to recipes using these logging +# mechanisms. + +# Print the output exactly as it is passed in. Typically used for output of +# tasks that should be seen on the console. Use sparingly. +# Output: logs console +# NOTE: console output is not currently implemented. +bbplain() { + echo "$*" +} + +# Notify the user of a noteworthy condition. +# Output: logs console +# NOTE: console output is not currently implemented. +bbnote() { + echo "NOTE: $*" +} + +# Print a warning to the log. Warnings are non-fatal, and do not +# indicate a build failure. +# Output: logs +bbwarn() { + echo "WARNING: $*" +} + +# Print an error to the log. Errors are non-fatal in that the build can +# continue, but they do indicate a build failure. +# Output: logs +bberror() { + echo "ERROR: $*" +} + +# Print a fatal error to the log. Fatal errors indicate build failure +# and halt the build, exiting with an error code. +# Output: logs +bbfatal() { + echo "ERROR: $*" + exit 1 +} + +# Print debug messages. These are appropriate for progress checkpoint +# messages to the logs. Depending on the debug log level, they may also +# go to the console. +# Output: logs console +# Usage: bbdebug 1 "first level debug message" +# bbdebug 2 "second level debug message" +# NOTE: console output is not currently implemented. +bbdebug() { + USAGE='Usage: bbdebug [123] "message"' + if [ $# -lt 2 ]; then + bbfatal "$USAGE" + fi + + # Strip off the debug level and ensure it is an integer + DBGLVL=$1; shift + if ! [[ "$DBGLVL" =~ ^[0-9]+ ]]; then + bbfatal "$USAGE" + fi + + # All debug output is printed to the logs + echo "DEBUG: $*" +} + -- 1.7.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] logging updates 2011-04-25 19:36 [PATCH 0/3] logging updates Darren Hart ` (2 preceding siblings ...) 2011-04-25 19:36 ` [PATCH 3/3] logging: add bb* logging mechanisms for bash recipe functions Darren Hart @ 2011-05-06 22:37 ` Saul Wold 3 siblings, 0 replies; 5+ messages in thread From: Saul Wold @ 2011-05-06 22:37 UTC (permalink / raw) To: Darren Hart; +Cc: Chris Larson, poky On 04/25/2011 12:36 PM, Darren Hart wrote: > The first two patches fix issues in the existing bash logging infrastructure. > The third proposes a new bash logging mechanism. > > Pull URL: git://git.pokylinux.org/poky-contrib.git > Branch: dvhart/logging > Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=dvhart/logging > > Thanks, > Darren Hart<dvhart@linux.intel.com> > --- > > > Darren Hart (3): > logging: fix oedebug loglevel test > logging: remove unused BBDEBUG from local.conf.sample > logging: add bb* logging mechanisms for bash recipe functions > > meta-yocto/conf/local.conf.sample | 2 - > meta/classes/base.bbclass | 9 +++-- > meta/classes/logging.bbclass | 72 +++++++++++++++++++++++++++++++++++++ > 3 files changed, 77 insertions(+), 6 deletions(-) > create mode 100644 meta/classes/logging.bbclass > > _______________________________________________ > poky mailing list > poky@yoctoproject.org > https://lists.yoctoproject.org/listinfo/poky > Pulled int Master Thanks Sau! ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-05-06 22:37 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-04-25 19:36 [PATCH 0/3] logging updates Darren Hart 2011-04-25 19:36 ` [PATCH 1/3] logging: fix oedebug loglevel test Darren Hart 2011-04-25 19:36 ` [PATCH 2/3] logging: remove unused BBDEBUG from local.conf.sample Darren Hart 2011-04-25 19:36 ` [PATCH 3/3] logging: add bb* logging mechanisms for bash recipe functions Darren Hart 2011-05-06 22:37 ` [PATCH 0/3] logging updates Saul Wold
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.