summaryrefslogtreecommitdiff
path: root/abuild.in
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2013-08-01 12:16:57 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2013-08-01 12:16:57 +0000
commite2838fbb50e831fbd102ad32fcfb8bd294372bac (patch)
treeaf8eef00086ffacec102562c0b9a6e964b5146ca /abuild.in
parent11d9a7d6018fd13587259edd1030a608e9f85449 (diff)
downloadabuild-e2838fbb50e831fbd102ad32fcfb8bd294372bac.tar.gz
abuild-e2838fbb50e831fbd102ad32fcfb8bd294372bac.tar.bz2
abuild-e2838fbb50e831fbd102ad32fcfb8bd294372bac.tar.xz
abuild-e2838fbb50e831fbd102ad32fcfb8bd294372bac.zip
abuild: make it configurable what to cleanup and when
allow user specify if they want uninstall deps, remove srcdir and/or pkgdir on failure or success. We introduce CLEANUP and ERROR_CLEANUP config options in /etc/abuild.conf. Valid values are: pkgdir srcdir deps.
Diffstat (limited to 'abuild.in')
-rwxr-xr-xabuild.in21
1 files changed, 16 insertions, 5 deletions
diff --git a/abuild.in b/abuild.in
index 1da5d92..1428945 100755
--- a/abuild.in
+++ b/abuild.in
@@ -105,19 +105,29 @@ set_xterm_title() {
}
cleanup() {
+ local i=
set_xterm_title ""
- if [ -z "$install_after" ] && [ -n "$uninstall_after" ]; then
- msg "Uninstalling dependencies..."
- $SUDO_APK del --quiet $apk_opt_wait $uninstall_after
- fi
if [ -n "$CLEANUP_FILES" ]; then
rm -f $CLEANUP_FILES
fi
+ for i; do
+ case $i in
+ pkgdir) msg "Cleaning up pkgdir"; rm -rf "$pkgbasedir";;
+ srcdir) msg "Cleaning up srcdir"; rm -rf "$srcdir";;
+ deps)
+ if [ -z "$install_after" ] && [ -n "$uninstall_after" ]; then
+ msg "Uninstalling dependencies..."
+ $SUDO_APK del --quiet $apk_opt_wait \
+ $uninstall_after
+ fi
+ ;;
+ esac
+ done
}
die() {
error "$@"
- cleanup
+ cleanup $ERROR_CLEANUP
exit 1
}
@@ -1210,6 +1220,7 @@ build_abuildrepo() {
logcmd "building $pkgname"
sanitycheck && builddeps && clean && fetch && unpack \
&& prepare && mkusers && $_build && rootpkg \
+ && cleanup $CLEANUP \
|| return 1
fi
update_abuildrepo_index