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.
This commit is contained in:
parent
11d9a7d601
commit
e2838fbb50
@ -28,8 +28,13 @@ SRCDEST=/var/cache/distfiles
|
|||||||
# uncomment line below to store built packages in other location
|
# uncomment line below to store built packages in other location
|
||||||
# The package will be stored as $REPODEST/$repo/$pkgname-$pkgver-r$pkgrel.apk
|
# The package will be stored as $REPODEST/$repo/$pkgname-$pkgver-r$pkgrel.apk
|
||||||
# where $repo is the name of the parent directory of $startdir.
|
# where $repo is the name of the parent directory of $startdir.
|
||||||
#REPODEST=/var/lib/packages/
|
REPODEST=$HOME/packages/
|
||||||
|
|
||||||
# PACKAGER is used to create new aports with 'newapkbuild ...'
|
# PACKAGER is used to create new aports with 'newapkbuild ...'
|
||||||
#PACKAGER="Your Name <your@email.address>"
|
#PACKAGER="Your Name <your@email.address>"
|
||||||
|
|
||||||
|
# what to clean up after a successful build
|
||||||
|
CLEANUP="srcdir pkgdir deps"
|
||||||
|
|
||||||
|
# what to cleanup after a failed build
|
||||||
|
ERROR_CLEANUP="deps"
|
||||||
|
21
abuild.in
21
abuild.in
@ -105,19 +105,29 @@ set_xterm_title() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
|
local i=
|
||||||
set_xterm_title ""
|
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
|
if [ -n "$CLEANUP_FILES" ]; then
|
||||||
rm -f $CLEANUP_FILES
|
rm -f $CLEANUP_FILES
|
||||||
fi
|
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() {
|
die() {
|
||||||
error "$@"
|
error "$@"
|
||||||
cleanup
|
cleanup $ERROR_CLEANUP
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1210,6 +1220,7 @@ build_abuildrepo() {
|
|||||||
logcmd "building $pkgname"
|
logcmd "building $pkgname"
|
||||||
sanitycheck && builddeps && clean && fetch && unpack \
|
sanitycheck && builddeps && clean && fetch && unpack \
|
||||||
&& prepare && mkusers && $_build && rootpkg \
|
&& prepare && mkusers && $_build && rootpkg \
|
||||||
|
&& cleanup $CLEANUP \
|
||||||
|| return 1
|
|| return 1
|
||||||
fi
|
fi
|
||||||
update_abuildrepo_index
|
update_abuildrepo_index
|
||||||
|
Loading…
x
Reference in New Issue
Block a user