abuild: dont run 'build' from rootpkg

we want be able to run build and rootpkg separately. so you can stop
in the process, fix things, and then continue with 'abuild rootpkg' to
generate the package manually.
This commit is contained in:
Natanael Copa 2013-07-26 09:18:55 +00:00
parent bfee7b63f9
commit 728ce0e6de

View File

@ -143,6 +143,7 @@ default_sanitycheck() {
if [ $(echo "$pkgdesc" | wc -c) -gt 128 ]; then if [ $(echo "$pkgdesc" | wc -c) -gt 128 ]; then
die "pkgdesc is too long" die "pkgdesc is too long"
fi fi
is_function package || warning "Missing package() function in APKBUILD"
if [ -n "$replaces_priority" ] \ if [ -n "$replaces_priority" ] \
&& ! echo $replaces_priority | egrep -q '^[0-9]+$'; then && ! echo $replaces_priority | egrep -q '^[0-9]+$'; then
@ -1196,11 +1197,16 @@ mklinks_abuildrepo() {
} }
build_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 if ! apk_up2date || [ -n "$force" ]; then
logcmd "building $pkgname" logcmd "building $pkgname"
sanitycheck && builddeps && clean && fetch && unpack \ sanitycheck && builddeps && clean && fetch && unpack \
&& post_unpack && prepare && mkusers && rootpkg \ && post_unpack && prepare && mkusers && $_build \
&& rootpkg \
|| return 1 || return 1
fi fi
update_abuildrepo_index update_abuildrepo_index
@ -1324,15 +1330,17 @@ do_fakeroot() {
# build and package in fakeroot # build and package in fakeroot
rootpkg() { rootpkg() {
local do_build=build local _package=package
cd "$startdir" if ! is_function package; then
if is_function package; then # if package() is missing then run 'build' in fakeroot instead
build || return 1 warning "No package() function in APKBUILD"
do_build=package _package=build
fi fi
cd "$startdir" cd "$startdir"
rm -rf "$pkgdir"
[ -n "$FAKEROOT" ] && msg "Entering fakeroot..." [ -n "$FAKEROOT" ] && msg "Entering fakeroot..."
do_fakeroot "$abuild_path" $color_opt $do_build \ do_fakeroot "$abuild_path" $color_opt \
$_package \
prepare_subpackages \ prepare_subpackages \
prepare_language_packs \ prepare_language_packs \
prepare_package \ prepare_package \
@ -1814,7 +1822,7 @@ usage() {
echo " build Compile and install package into \$pkgdir" echo " build Compile and install package into \$pkgdir"
echo " listpkg List target packages" echo " listpkg List target packages"
echo " package Create package in \$PKGDEST" 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 " clean Remove temp build and install dirs"
echo " cleanoldpkg Remove binary packages except current version" echo " cleanoldpkg Remove binary packages except current version"
echo " cleanpkg Remove already built binary and source package" echo " cleanpkg Remove already built binary and source package"