Skip to contentSkip to conversation

logging.bbclass: avoid bashism in bbdebug()

PATCH New Patrick Ohly 1 participant 1 message Jun 15, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 logging.bbclass: avoid bashism in bbdebug()

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.

---
 meta/classes/logging.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/classes/logging.bbclass +2 -1
index 78d65bd..f6648b2 100644
@@ -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
 
Signature · 1 line
2.1.4