summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2017-02-21 17:44:15 +0200
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2017-03-07 12:29:38 +0200
commit36d5193776180385a39626a83241822736a5f6b8 (patch)
tree01c7ae0c9e3baa9d304a2ffdc6a1a22cf3b5cf22
parentd8174e4f3a8fe1c133c15ccdac8be190190db1a1 (diff)
downloadabuild-36d5193776180385a39626a83241822736a5f6b8.tar.gz
abuild-36d5193776180385a39626a83241822736a5f6b8.tar.bz2
abuild-36d5193776180385a39626a83241822736a5f6b8.tar.xz
abuild-36d5193776180385a39626a83241822736a5f6b8.zip
abuild: enable -e shell option
-rw-r--r--abuild.in69
1 files changed, 42 insertions, 27 deletions
diff --git a/abuild.in b/abuild.in
index a7ff2e6..1eede20 100644
--- a/abuild.in
+++ b/abuild.in
@@ -1,4 +1,4 @@
-#!/bin/ash
+#!/bin/ash -e
# abuild - build apk packages (light version of makepkg)
# Copyright (c) 2008-2015 Natanael Copa <ncopa@alpinelinux.org>
@@ -240,8 +240,7 @@ sumcheck() {
endreturnval=0
for src in $sums; do
origin=$1; shift
- echo "$src" | ${algo}sum -c
- if [ $? -ne 0 ]; then
+ if ! echo "$src" | ${algo}sum -c; then
endreturnval=1
is_remote $origin || continue
@@ -567,7 +566,9 @@ update_config_guess() {
runpart() {
local part=$1
[ -n "$DEBUG" ] && msg "$part"
- $part || die "$part failed"
+ abuild_function=$part "$abuild_path" \
+ $color_opt $nodeps $force $forceroot $keep $quiet \
+ $install_deps $recursive $upgrade || die "$part failed"
}
# override those in your build script
@@ -1409,12 +1410,19 @@ build_abuildrepo() {
fi
if ! apk_up2date || [ -n "$force" ]; then
# check early if we have abuild key
- abuild-sign --installed || return 1
+ abuild-sign --installed
logcmd "building $repo/$pkgname-$pkgver-r$pkgrel"
- sanitycheck && builddeps && clean && fetch && unpack \
- && prepare && mkusers && $_build && $_check \
- && rootpkg && cleanup $CLEANUP \
- || return 1
+ sanitycheck
+ builddeps
+ clean
+ fetch
+ unpack
+ prepare
+ mkusers
+ $_build
+ $_check
+ rootpkg
+ cleanup $CLEANUP
fi
update_abuildrepo_index
}
@@ -1515,9 +1523,7 @@ default_doc() {
rm -f "$subpkgdir/usr/share/info/dir"
# remove if empty, ignore error (not empty)
- rmdir "$pkgdir/usr/share" "$pkgdir/usr" 2>/dev/null
-
- return 0
+ rmdir "$pkgdir/usr/share" "$pkgdir/usr" 2>/dev/null || :
}
doc() {
@@ -1573,7 +1579,7 @@ default_dev() {
d="$subpkgdir/${i%/*}" # dirname $i
mkdir -p "$d"
mv "$pkgdir/$i" "$d"
- rmdir "$pkgdir/${i%/*}" 2>/dev/null
+ rmdir "$pkgdir/${i%/*}" 2>/dev/null || :
fi
done
# move *.so links needed when linking the apps to -dev packages
@@ -1996,7 +2002,9 @@ stripbin() {
| while read filename; do
local XATTR=$(getfattr --match="" --dump "${filename}")
"${stripcmd}" "${filename}"
- [ -n "$XATTR" ] && { echo "$XATTR" | setfattr --restore=-; }
+ if [ -n "$XATTR" ]; then
+ echo "$XATTR" | setfattr --restore=-
+ fi
done
}
@@ -2099,12 +2107,11 @@ deps() {
undeps() {
local _quiet="$@"
- $SUDO_APK del $_quiet $apk_opt_wait .makedepends-$pkgname
+ $SUDO_APK del $_quiet $apk_opt_wait .makedepends-$pkgname || :
if [ -n "$CBUILDROOT" ]; then
$SUDO_APK del $_quiet --root "$CBUILDROOT" --arch "$CTARGET_ARCH" $apk_opt_wait \
- --no-scripts .makedepends-$pkgname
+ --no-scripts .makedepends-$pkgname || :
fi
- return 0
}
# compat
@@ -2248,7 +2255,7 @@ while getopts "AcdfFhkKimnp:P:qrRs:u" opt; do
'A') echo "$CARCH"; exit 0;;
'c') enable_colors
color_opt="-c";;
- 'd') nodeps=1;;
+ 'd') nodeps="-d";;
'f') force="-f";;
'F') forceroot="-F";;
'h') usage;;
@@ -2304,7 +2311,7 @@ if [ -z "$REPODEST" ]; then
fi
# for recursive action
-export REPODEST
+export REPODEST SRCDEST
# if we want build debug package
if [ -n "$DEBUG" ] || subpackage_types_has "dbg"; then
@@ -2332,15 +2339,23 @@ fi
controldir="$pkgbasedir"/.control.${subpkgname:-$pkgname}
trap 'die "Aborted by user"' INT
-[ -z "$subpkgdir" ] && set_xterm_title "abuild${CROSS_COMPILE+-$CARCH}: $pkgname"
-if [ -z "$1" ]; then
- set all
-fi
+if [ "$abuild_function" ]; then
+ _function=$abuild_function
+ abuild_function=
+ $_function
-while [ $# -gt 0 ]; do
- runpart $1
- shift
-done
+else
+ [ -z "$subpkgdir" ] && set_xterm_title "abuild${CROSS_COMPILE+-$CARCH}: $pkgname"
+
+ if [ -z "$1" ]; then
+ set all
+ fi
+
+ while [ $# -gt 0 ]; do
+ runpart $1
+ shift
+ done
+fi
cleanup