ptest: add cleandirs flag and fix error on ubuntu host
v2 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 | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-)
Signature · 1 line
1.7.9.5
PATCH v2 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.
The same problem also applies to the do_configure_ptest_base and the do_compile_ptest_base functions.
This patch fixes this problem by avoiding using the 'type' builtin command.
[YOCTO #5128]
--- meta/classes/ptest.bbclass | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-)
meta/classes/ptest.bbclass +15 -9
@@ -16,22 +16,30 @@ RDEPENDS_${PN}-ptest_virtclass-nativesdk = "" PACKAGES =+ "${@base_contains('DISTRO_FEATURES', 'ptest', '${PN}-ptest', '', d)}" +do_configure_ptest() { + : +} + do_configure_ptest_base() { if [ ${PTEST_ENABLED} = 1 ]; then - if [ a$(type -t do_configure_ptest) = afunction ]; then - do_configure_ptest - fi + do_configure_ptest fi } +do_compile_ptest() { + : +} + do_compile_ptest_base() { if [ ${PTEST_ENABLED} = 1 ]; then - if [ a$(type -t do_compile_ptest) = afunction ]; then - do_compile_ptest - fi + do_compile_ptest fi } +do_install_ptest() { + : +} + do_install_ptest_base() { if [ ${PTEST_ENABLED} = 1 ]; then if [ -f ${WORKDIR}/run-ptest ]; then
@@ -39,9 +47,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 v2 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
@@ -52,6 +52,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