summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xabuild.in26
1 files changed, 17 insertions, 9 deletions
diff --git a/abuild.in b/abuild.in
index 91f0a00..aad6b23 100755
--- a/abuild.in
+++ b/abuild.in
@@ -143,6 +143,7 @@ default_sanitycheck() {
if [ $(echo "$pkgdesc" | wc -c) -gt 128 ]; then
die "pkgdesc is too long"
fi
+ is_function package || warning "Missing package() function in APKBUILD"
if [ -n "$replaces_priority" ] \
&& ! echo $replaces_priority | egrep -q '^[0-9]+$'; then
@@ -1196,11 +1197,16 @@ mklinks_abuildrepo() {
}
build_abuildrepo() {
- local d apk
+ local d apk _build=build
+ if ! is_function package; then
+ # if package() is missing then build is called from rootpkg
+ _build=true
+ fi
if ! apk_up2date || [ -n "$force" ]; then
logcmd "building $pkgname"
sanitycheck && builddeps && clean && fetch && unpack \
- && post_unpack && prepare && mkusers && rootpkg \
+ && post_unpack && prepare && mkusers && $_build \
+ && rootpkg \
|| return 1
fi
update_abuildrepo_index
@@ -1324,15 +1330,17 @@ do_fakeroot() {
# build and package in fakeroot
rootpkg() {
- local do_build=build
- cd "$startdir"
- if is_function package; then
- build || return 1
- do_build=package
+ local _package=package
+ if ! is_function package; then
+ # if package() is missing then run 'build' in fakeroot instead
+ warning "No package() function in APKBUILD"
+ _package=build
fi
cd "$startdir"
+ rm -rf "$pkgdir"
[ -n "$FAKEROOT" ] && msg "Entering fakeroot..."
- do_fakeroot "$abuild_path" $color_opt $do_build \
+ do_fakeroot "$abuild_path" $color_opt \
+ $_package \
prepare_subpackages \
prepare_language_packs \
prepare_package \
@@ -1814,7 +1822,7 @@ usage() {
echo " build Compile and install package into \$pkgdir"
echo " listpkg List target packages"
echo " package Create package in \$PKGDEST"
- echo " rootpkg Run '$0 build package' as fakeroot"
+ echo " rootpkg Run 'package', the split functions and create apks as fakeroot"
echo " clean Remove temp build and install dirs"
echo " cleanoldpkg Remove binary packages except current version"
echo " cleanpkg Remove already built binary and source package"