abuild: require package() function

make a missing function for package() a hard error.

this means we never run build in fakeroot.
This commit is contained in:
Natanael Copa 2018-10-03 11:10:55 +00:00
parent 015f0f69a8
commit def219994d

View File

@ -134,7 +134,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" is_function package || die "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
@ -1502,11 +1502,7 @@ create_apks() {
} }
build_abuildrepo() { build_abuildrepo() {
local d apk _build=build _check=check_fakeroot local d apk _check=check_fakeroot
if ! is_function package; then
# if package() is missing then build is called from rootpkg
_build=true
fi
if options_has "!checkroot"; then if options_has "!checkroot"; then
_check=check _check=check
fi fi
@ -1525,7 +1521,6 @@ build_abuildrepo() {
unpack unpack
prepare prepare
mkusers mkusers
$_build
$_check $_check
rootpkg rootpkg
cleanup $CLEANUP cleanup $CLEANUP
@ -1764,17 +1759,11 @@ check_fakeroot() {
# build and package in fakeroot # build and package in fakeroot
rootpkg() { rootpkg() {
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" cd "$startdir"
rm -rf "$pkgdir" rm -rf "$pkgdir"
[ -n "$FAKEROOT" ] && msg "Entering fakeroot..." [ -n "$FAKEROOT" ] && msg "Entering fakeroot..."
do_fakeroot "$abuild_path" $color_opt $keep_build \ do_fakeroot "$abuild_path" $color_opt $keep_build \
$_package \ package \
prepare_subpackages \ prepare_subpackages \
prepare_language_packs \ prepare_language_packs \
prepare_package \ prepare_package \
@ -2129,18 +2118,14 @@ checksum() {
} }
rootbld_actions() { rootbld_actions() {
local part _build=build _check=check_fakeroot local part _check=check_fakeroot
if ! is_function package; then
# if package() is missing then build is called from rootpkg
_build=true
fi
if options_has "!checkroot"; then if options_has "!checkroot"; then
_check=check _check=check
fi fi
if ! want_check; then if ! want_check; then
_check=true _check=true
fi fi
for part in symlinksrc unpack prepare $_build $_check rootpkg; do for part in symlinksrc unpack prepare $_check rootpkg; do
runpart $part runpart $part
done done
} }