-packaging_options=('strip' 'docs' 'libtool' 'emptydirs' 'zipman' 'purge')
+packaging_options=('strip' 'docs' 'libtool' 'emptydirs' 'zipman' 'purge' 'check')
other_options=('ccache' 'distcc' 'makeflags' 'force')
splitpkg_overrides=('pkgver' 'pkgrel' 'pkgdesc' 'arch' 'license' 'groups'
'depends' 'optdepends' 'provides' 'conflicts' 'replaces'
@@ -71,6 +71,7 @@ SOURCEONLY=0
IGNOREARCH=0
HOLDVER=0
BUILDFUNC=0
+CHECKFUNC=0
PKGFUNC=0
SPLITPKG=0
PKGLIST=""
@@ -143,6 +144,9 @@ clean_up() {
if (( BUILDFUNC )); then
rm -f "${pkgbase}-${pkgver}-${pkgrel}-${CARCH}-build.log"*
fi
+ if (( CHECKFUNC )); then
+ rm -f "${pkgbase}-${pkgver}-${pkgrel}-${CARCH}-check.log"*
+ fi
if (( PKGFUNC )); then
rm -f "${pkgbase}-${pkgver}-${pkgrel}-${CARCH}-package.log"*
elif (( SPLITPKG )); then
@@ -735,7 +739,11 @@ run_function() {
fi
msg "$(gettext "Starting %s()...")" "$pkgfunc"
- cd "$srcdir"
+ if [[ -d "$srcdir"/"$pkgname"-"$pkgver" ]]; then
+ cd "$srcdir"/"$pkgname"-"$pkgver"
+ else
+ cd "$srcdir"
+ fi
+run_check() {
+ [[ $(check_option check) = "y" ]] && run_function "check"
+}
+
run_package() {
if [[ -z $1 ]]; then
pkgfunc="package"
@@ -1772,6 +1784,9 @@ fi
if [[ $(type -t build) = "function" ]]; then
BUILDFUNC=1
fi
+if [[ $(type -t check) = "function" ]]; then
+ CHECKFUNC=1
+fi
if [[ $(type -t package) = "function" ]]; then
PKGFUNC=1
elif [[ $SPLITPKG -eq 0 && $(type -t package_${pkgname}) = "function" ]]; then
@@ -1835,6 +1850,9 @@ if (( INFAKEROOT )); then
if (( ! REPKG )); then
if (( BUILDFUNC )); then
run_build
+ if (( CHECKFUNC )); then
+ run_check
+ fi
tidy_install
fi
else
@@ -1960,6 +1978,7 @@ else
if (( ! REPKG )); then
devel_update
(( BUILDFUNC )) && run_build
+ (( CHECKFUNC )) && run_check
fi
if (( ! SPLITPKG )); then
if (( PKGFUNC )); then
@@ -1991,6 +2010,7 @@ else
if (( ! REPKG && ( PKGFUNC || SPLITPKG ) )); then
devel_update
(( BUILDFUNC )) && run_build
+ (( CHECKFUNC )) && run_check
cd "$startdir"
fi
--
1.7.1
06-19-2010, 04:41 AM
Allan McRae
Add check() function for testsuites.
On 19/06/10 08:04, Jeff wrote:
If this is an accepted feature, I can resend the patch with manpage
updates.
Signed-off-by: Jeff C<jeff@kcaccess.com>
This is a feature that is acceptable. But I do not like using an
option=() value to decide whether to run it. I would prefer a "--check"
option to be added. Then people can choose to run the check function
or not without requiring to edit the PKGBUILD. If they always want
check() to be run, an alias for makepkg can be used.
Also,
@@ -735,7 +739,11 @@ run_function() {
fi
msg "$(gettext "Starting %s()...")" "$pkgfunc"
- cd "$srcdir"
+ if [[ -d "$srcdir"/"$pkgname"-"$pkgver" ]]; then
+ cd "$srcdir"/"$pkgname"-"$pkgver"
+ else
+ cd "$srcdir"
+ fi
# ensure all necessary build variables are exported
export CFLAGS CXXFLAGS LDFLAGS MAKEFLAGS CHOST
That is unrelated to the patch...
Allan
06-20-2010, 08:00 PM
Jeff
Add check() function for testsuites.
On Sat, Jun 19, 2010 at 02:41:02PM +1000, Allan McRae wrote:
>
> This is a feature that is acceptable. But I do not like using an
> option=() value to decide whether to run it. I would prefer a "--check"
> option to be added. Then people can choose to run the check function
> or not without requiring to edit the PKGBUILD. If they always want
> check() to be run, an alias for makepkg can be used.
Actually, I never envisioned this to be used in the PKGBUILDs other than
for a very few critical packages (toolchain) where it doesn't make sense
to not test. IMO, this would better be suited as an edited value in
makepkg.conf per the builders's desire the same as whether he wants the
doc directory wiped. The use of an alias in this case would serve
nothing more than to override a global directive, which ISTM is what
~/.makepkg.conf is for.
> That is unrelated to the patch...
Oops, slipped in by accident. Thanks for the notice.
--
Jeff
My other computer is an abacus.
06-22-2010, 05:09 AM
"Allan McRae"
Add check() function for testsuites.
On 21/06/10 06:00, Jeff wrote:
On Sat, Jun 19, 2010 at 02:41:02PM +1000, Allan McRae wrote:
This is a feature that is acceptable. But I do not like using an
option=() value to decide whether to run it. I would prefer a "--check"
option to be added. Then people can choose to run the check function
or not without requiring to edit the PKGBUILD. If they always want
check() to be run, an alias for makepkg can be used.
Actually, I never envisioned this to be used in the PKGBUILDs other than
for a very few critical packages (toolchain) where it doesn't make sense
to not test. IMO, this would better be suited as an edited value in
makepkg.conf per the builders's desire the same as whether he wants the
doc directory wiped. The use of an alias in this case would serve
nothing more than to override a global directive, which ISTM is what
~/.makepkg.conf is for.
I do not see the option as being the same as removing docs. All the
values in OPTIONS affect the files in the final package. The "check"
option would not.
If check() is designed to be only used in cases where it is important to
always run the test suite, then I suggest we make running check() to be
the default and that it can only be disabled with a --nocheck command
line flag.