[oe-commits] Patrick Ohly : logging.bbclass: avoid bashism in bbdebug()

git at git.openembedded.org git at git.openembedded.org
Tue Jun 23 10:55:40 UTC 2015


Module: openembedded-core.git
Branch: master-next
Commit: 25cb71799e72d4e0c4fe39653d8b84280d087372
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=25cb71799e72d4e0c4fe39653d8b84280d087372

Author: Patrick Ohly <patrick.ohly at intel.com>
Date:   Mon Jun 15 10:20:49 2015 +0200

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.

Signed-off-by: Patrick Ohly <patrick.ohly at intel.com>
Signed-off-by: Ross Burton <ross.burton at intel.com>

---

 meta/classes/logging.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/classes/logging.bbclass b/meta/classes/logging.bbclass
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
 



More information about the Openembedded-commits mailing list