summaryrefslogtreecommitdiff
path: root/abuild.in
diff options
context:
space:
mode:
Diffstat (limited to 'abuild.in')
-rw-r--r--abuild.in32
1 files changed, 28 insertions, 4 deletions
diff --git a/abuild.in b/abuild.in
index 2b2d23b..aa1fe09 100644
--- a/abuild.in
+++ b/abuild.in
@@ -66,6 +66,12 @@ cross_compiling() {
test "$CBUILD" != "$CHOST" -a -n "$CBUILDROOT"
}
+want_check() {
+ cross_compiling && return 1
+ options_has "!check" && return 1
+ return 0
+}
+
cleanup() {
local i=
[ -z "$subpkgdir" ] && set_xterm_title ""
@@ -199,6 +205,7 @@ default_sanitycheck() {
[ -n "$pkguser" ] && spell_error pkguser pkgusers
[ -n "$pkggroup" ] && spell_error pkggroup pkggroups
[ -n "$subpackage" ] && spell_error subpackage subpackages
+ [ -n "$checkdepend" ] && spell_error checkdepend checkdepends
check_maintainer || die "Provide a valid RFC822 maintainer address"
@@ -1365,18 +1372,21 @@ create_apks() {
}
build_abuildrepo() {
- local d apk _build=build
+ local d apk _build=build _check=check
if ! is_function package; then
# if package() is missing then build is called from rootpkg
_build=true
fi
+ if ! want_check; then
+ _check=true
+ fi
if ! apk_up2date || [ -n "$force" ]; then
# check early if we have abuild key
abuild-sign --installed || return 1
logcmd "building $repo/$pkgname-$pkgver-r$pkgrel"
sanitycheck && builddeps && clean && fetch && unpack \
- && prepare && mkusers && $_build && rootpkg \
- && cleanup $CLEANUP \
+ && prepare && mkusers && $_build && $_check \
+ && rootpkg && cleanup $CLEANUP \
|| return 1
fi
update_abuildrepo_index
@@ -1417,6 +1427,15 @@ update_abuildrepo_index() {
done
}
+# predefined function check
+default_check() {
+ warning "APKBUILD does not run any tests - define a check() function!"
+}
+
+check() {
+ default_check
+}
+
# predefined splitfunc doc
default_doc() {
depends="$depends_doc"
@@ -1715,11 +1734,14 @@ parse_aports_makedepends() {
subpackages=
depends=
makedepends=
+ checkdepends=
. $i
dir=${i%/APKBUILD}
deps=
# filter out conflicts from deps and version info
- for j in $depends $makedepends; do
+ wantdepends="$depends $makedepends"
+ want_check && wantdepends="$wantdepends $checkdepends"
+ for j in $wantdepends; do
case "$j" in
!*) continue;;
esac
@@ -1792,6 +1814,7 @@ calcdeps() {
done
else
[ -z "$makedepends" ] && makedepends="$makedepends_build $makedepends_host"
+ want_check && makedepends="$makedepends $checkdepends"
for i in $1 $depends $makedepends; do
[ "$pkgname" = "${i%%[<>=]*}" ] && continue
list_has $i $builddeps && continue
@@ -2147,6 +2170,7 @@ usage() {
Commands:
build Compile and install package into \$pkgdir
+ check Run any defined tests concerning the package
checksum Generate checksum to be included in APKBUILD
clean Remove temp build and install dirs
cleancache Remove downloaded files from \$SRCDEST