Patchwork [1/2] ptest.bbclass: fix error on ubuntu host

login
register
mail settings
Submitter Qi.Chen@windriver.com
Date Sept. 5, 2013, 12:49 p.m.
Message ID <c425dc883150a2c69a92feae459545086e264ac9.1378385266.git.Qi.Chen@windriver.com>
Download mbox | patch
Permalink /patch/57465/
State New
Headers show

Comments

Qi.Chen@windriver.com - Sept. 5, 2013, 12:49 p.m.
From: Chen Qi <Qi.Chen@windriver.com>

The do_install_ptest_base function uses 'type -t' command to check
whether do_install_ptest is a function and acts correspondingly.

However, the 'type' command is a shell builtin and its behavior is
not all the same across Linux distros. On ubuntu, if we use #!/bin/sh
as the interpreter for the scripts, as in the case of our intermediate
scripts, the '-t' option for the 'type' command is not supported. So
the check always fails and the do_install_ptest function, even if defined,
is not run.

This patch fixes this problem by avoiding using the 'type' builtin command.

[YOCTO #5128]

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/classes/ptest.bbclass |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
Qi.Chen@windriver.com - Sept. 5, 2013, 1:41 p.m.
Just noticed the do_configure_ptest_base and do_compile_ptest_base also 
have this problem.

I'll send out a new patchset.

//Chen Qi

On 09/05/2013 08:49 PM, Qi.Chen@windriver.com wrote:
> From: Chen Qi <Qi.Chen@windriver.com>
>
> The do_install_ptest_base function uses 'type -t' command to check
> whether do_install_ptest is a function and acts correspondingly.
>
> However, the 'type' command is a shell builtin and its behavior is
> not all the same across Linux distros. On ubuntu, if we use #!/bin/sh
> as the interpreter for the scripts, as in the case of our intermediate
> scripts, the '-t' option for the 'type' command is not supported. So
> the check always fails and the do_install_ptest function, even if defined,
> is not run.
>
> This patch fixes this problem by avoiding using the 'type' builtin command.
>
> [YOCTO #5128]
>
> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> ---
>   meta/classes/ptest.bbclass |    8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/meta/classes/ptest.bbclass b/meta/classes/ptest.bbclass
> index 37357e8..71183af 100644
> --- a/meta/classes/ptest.bbclass
> +++ b/meta/classes/ptest.bbclass
> @@ -32,6 +32,10 @@ do_compile_ptest_base() {
>       fi
>   }
>   
> +do_install_ptest() {
> +    :
> +}
> +
>   do_install_ptest_base() {
>       if [ ${PTEST_ENABLED} = 1 ]; then
>           if [ -f ${WORKDIR}/run-ptest ]; then
> @@ -39,9 +43,7 @@ do_install_ptest_base() {
>               if grep -q install-ptest: Makefile; then
>                   oe_runmake DESTDIR=${D}${PTEST_PATH} install-ptest
>               fi
> -            if [ a$(type -t do_install_ptest) = afunction ]; then
> -                do_install_ptest
> -            fi
> +            do_install_ptest
>           fi
>       fi
>   }

Patch

diff --git a/meta/classes/ptest.bbclass b/meta/classes/ptest.bbclass
index 37357e8..71183af 100644
--- a/meta/classes/ptest.bbclass
+++ b/meta/classes/ptest.bbclass
@@ -32,6 +32,10 @@  do_compile_ptest_base() {
     fi
 }
 
+do_install_ptest() {
+    :
+}
+
 do_install_ptest_base() {
     if [ ${PTEST_ENABLED} = 1 ]; then
         if [ -f ${WORKDIR}/run-ptest ]; then
@@ -39,9 +43,7 @@  do_install_ptest_base() {
             if grep -q install-ptest: Makefile; then
                 oe_runmake DESTDIR=${D}${PTEST_PATH} install-ptest
             fi
-            if [ a$(type -t do_install_ptest) = afunction ]; then
-                do_install_ptest
-            fi
+            do_install_ptest
         fi
     fi
 }