]> code.ossystems Code Review - openembedded-core.git/commitdiff
logging.bbclass: avoid bashism in bbdebug()
authorPatrick Ohly <patrick.ohly@intel.com>
Mon, 15 Jun 2015 08:20:49 +0000 (10:20 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 23 Jun 2015 10:38:10 +0000 (11:38 +0100)
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@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/classes/logging.bbclass

index 78d65bda3af40d6b362638dabd505ae89c309ca7..f6648b211906c8ab0b319d2a4eeb0599edb81d63 100644 (file)
@@ -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