xbps-src: cleanups for -E and -t.

-E also detect noarch binpkgs.
-t make sure to cleanup the temporary masterdirs.
This commit is contained in:
Juan RP 2015-03-01 16:06:30 +01:00
parent 6e448362cb
commit 2f524cf66a
3 changed files with 22 additions and 14 deletions

View File

@ -34,6 +34,15 @@ error_func() {
exit 2 exit 2
} }
exit_and_cleanup() {
local rval=$1
if [ -n "$XBPS_TEMP_MASTERDIR" ]; then
rm -rf "$XBPS_MASTERDIR"
fi
exit ${rval:=0}
}
msg_red() { msg_red() {
# error messages in bold/red # error messages in bold/red
[ -n "$NOCOLORS" ] || printf >&2 "\033[1m\033[31m" [ -n "$NOCOLORS" ] || printf >&2 "\033[1m\033[31m"
@ -200,7 +209,7 @@ get_subpkgs() {
setup_pkg() { setup_pkg() {
local pkg="$1" cross="$2" local pkg="$1" cross="$2"
local val _vars f dbgflags local val _vars f dbgflags _arch
[ -z "$pkg" ] && return 1 [ -z "$pkg" ] && return 1
@ -322,8 +331,13 @@ setup_pkg() {
makejobs="-j$XBPS_MAKEJOBS" makejobs="-j$XBPS_MAKEJOBS"
fi fi
if [ -n "$XBPS_BINPKG_EXISTS" -a -f "$XBPS_REPOSITORY/${pkgver}.${XBPS_TARGET_MACHINE}.xbps" ]; then if [ -n "$noarch" ]; then
exit 0 _arch="noarch"
else
_arch="$XBPS_TARGET_MACHINE"
fi
if [ -n "$XBPS_BINPKG_EXISTS" -a -f "${XBPS_REPOSITORY}/${pkgver}.${_arch}.xbps" ]; then
exit_and_cleanup
fi fi
if [ -z "$XBPS_DEBUG_PKGS" -o "$repository" = "nonfree" ]; then if [ -z "$XBPS_DEBUG_PKGS" -o "$repository" = "nonfree" ]; then

View File

@ -116,12 +116,11 @@ install_pkg() {
if [ "$XBPS_TARGET_PKG" = "$sourcepkg" ]; then if [ "$XBPS_TARGET_PKG" = "$sourcepkg" ]; then
if [ "$XBPS_TARGET" = "bootstrap" ]; then if [ "$XBPS_TARGET" = "bootstrap" ]; then
return 0 return 0
else
# Package built successfully. Exit directly due to nested install_pkg
# and install_pkg_deps functions.
remove_cross_pkg $cross
exit 0
fi fi
# Package built successfully. Exit directly due to nested install_pkg
# and install_pkg_deps functions.
remove_cross_pkg $cross
exit_and_cleanup
fi fi
} }

View File

@ -679,9 +679,4 @@ case "$XBPS_TARGET" in
;; ;;
esac esac
rval=$? exit_and_cleanup $?
[ -n "$XBPS_TEMP_MASTERDIR" ] && rm -rf "$XBPS_MASTERDIR"
# Agur
exit $rval