Skip to contentSkip to conversation

logging updates

PATCH In review Darren Hart 2 participants 5 messages Apr 25, 2011 – May 6, 2011

lore
Share & tools
lore
#0 lore raw

cover logging updates

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 <[email protected]>
---

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
#1 lore raw

PATCH 1/3 logging: fix oedebug loglevel test

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.

---
 meta/classes/base.bbclass |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
meta/classes/base.bbclass +4 -4
index 2157fe9..374ca04 100644
@@ -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() {
Signature · 1 line
1.7.1
#3 lore raw

PATCH 3/3 logging: add bb* logging mechanisms for bash recipe functions

In reply to 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).

---
 meta/classes/base.bbclass    |    1 +
 meta/classes/logging.bbclass |   72 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+), 0 deletions(-)
 create mode 100644 meta/classes/logging.bbclass
meta/classes/base.bbclass +1 -0
index 374ca04..73900cd 100644
@@ -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):
meta/classes/logging.bbclass new file +72 -0

72 lines not on this page · raw message

Signature · 1 line
1.7.1
#2 lore raw

PATCH 2/3 logging: remove unused BBDEBUG from local.conf.sample

In reply to 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.

---
 meta-yocto/conf/local.conf.sample |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
meta-yocto/conf/local.conf.sample +0 -2
index c739127..740f542 100644
@@ -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"
 
Signature · 1 line
1.7.1
#4 lore raw
In reply to Darren Hart
Quoted 21 lines · 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<[email protected]>
---

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(-)
Quoted 7 lines

create mode 100644 meta/classes/logging.bbclass

_______________________________________________
poky mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/poky

Pulled int Master

Thanks
Sau!