ptest: add cleandirs flag and fix error on ubuntu host
cover ptest: add cleandirs flag and fix error on ubuntu host
From: Chen Qi <[email protected]>
The following changes since commit f41b7a7d4d0463a0dfafe6621d01680b81798019:
bitbake: hob: remove PACKAGE_INSTALL variable setting from hob (2013-09-04 14:18:49 +0100)
are available in the git repository at:
git://git.pokylinux.org/poky-contrib ChenQi/ptest-dash
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/ptest-dash
Chen Qi (2):
ptest.bbclass: fix error on ubuntu host ptest.bbclass: add cleandirs flag to do_install_ptest_base
meta/classes/ptest.bbclass | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
Signature · 1 line
1.7.9.5
PATCH 1/2 ptest.bbclass: fix error on ubuntu host
From: Chen Qi <[email protected]>
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]
--- meta/classes/ptest.bbclass | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
meta/classes/ptest.bbclass +5 -3
@@ -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 }
Signature · 1 line
1.7.9.5
PATCH 2/2 ptest.bbclass: add cleandirs flag to do_install_ptest_base
In reply to [email protected]From: Chen Qi <[email protected]>
The do_install_ptest_base task should have cleandirs flag, just like the do_install task. The ${D}${PTEST_PATH} directory should be cleaned, Otherwise, there would be similar errors like below if the do_install_ptest_base task is rerun.
ln: failed to create symbolic link `xxx': File exists
[YOCTO #5129]
--- meta/classes/ptest.bbclass | 2 ++ 1 file changed, 2 insertions(+)
meta/classes/ptest.bbclass +2 -0
@@ -48,6 +48,8 @@ do_install_ptest_base() { fi } +do_install_ptest_base[cleandirs] = "${D}${PTEST_PATH}" + addtask configure_ptest_base after do_configure before do_compile addtask compile_ptest_base after do_compile before do_install addtask install_ptest_base after do_install before do_package
Signature · 1 line
1.7.9.5
Re: [PATCH 1/2] ptest.bbclass: fix error on ubuntu host
In reply to [email protected]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
Quoted 47 lines · On 09/05/2013 08:49 PM, [email protected] wrote:
From: Chen Qi <[email protected]>
The
do_install_ptest_basefunction uses 'type -t' command to check whetherdo_install_ptestis 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_ptestfunction, 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 <[email protected]>--- meta/classes/ptest.bbclass | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)meta/classes/ptest.bbclass +5
-3@@ -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 }