Patchwork [32/52] logging: fix oedebug loglevel test

login
register
mail settings
Submitter Saul Wold
Date April 27, 2011, 7:29 a.m.
Message ID <bd147a11cf2ec545d29e3e1b190b5219535d9d8a.1303889119.git.sgw@linux.intel.com>
Download mbox | patch
Permalink /patch/2959/
State New, archived
Headers show

Comments

Saul Wold - April 27, 2011, 7:29 a.m.
From: Darren Hart <dvhart@linux.intel.com>

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

Patch

diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 44fab53..7ca396d 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() {