[OE-core] [PATCH] logging.bbclass: avoid bashism in bbdebug()

Patrick Ohly patrick.ohly at intel.com
Mon Jun 15 08:20:49 UTC 2015


Checking the bbdebug() debug level parameter with a regular
test expression only works in bash. Using tr to filter out
digits and then checking whether anything is left achieves
the same result and is more portable.

Signed-off-by: Patrick Ohly <patrick.ohly at intel.com>
---
 meta/classes/logging.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/classes/logging.bbclass b/
index 78d65bd..f6648b2 100644
--- a/meta/classes/logging.bbclass
+++ b/meta/classes/logging.bbclass
@@ -62,7 +62,8 @@ bbdebug() {
 	
 	# Strip off the debug level and ensure it is an integer
 	DBGLVL=$1; shift
-	if ! [[ "$DBGLVL" =~ ^[0-9]+ ]]; then
+	NONDIGITS=$(echo "$DBGLVL" | tr -d [:digit:])
+	if [ "$NONDIGITS" ]; then
 		bbfatal "$USAGE"
 	fi
 
-- 
2.1.4




More information about the Openembedded-core mailing list