makepkg: abort on missing or non-writable PKGDEST

When PKGDEST pointed to a non-writable location, makepkg would fail
after completing the build process. This patch makes it abort as
soon as PKGDEST is parsed.

Also, move the SRCDEST check to the same point rather than right
before downloading sources (which was after dependency checks).

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Allan McRae 2010-03-07 17:31:26 +10:00 committed by Dan McGee
parent a4e3fd1847
commit 65d43fbb84

View file

@ -451,12 +451,6 @@ remove_deps() {
download_sources() { download_sources() {
msg "$(gettext "Retrieving Sources...")" msg "$(gettext "Retrieving Sources...")"
if [[ ! -w $SRCDEST ]] ; then
error "$(gettext "You do not have write permission to store downloads in %s.")" "$SRCDEST"
plain "$(gettext "Aborting...")"
exit 1
fi
pushd "$SRCDEST" &>/dev/null pushd "$SRCDEST" &>/dev/null
local netfile local netfile
@ -1612,8 +1606,20 @@ readonly ALL_OFF BOLD BLUE GREEN RED YELLOW
# override settings with an environment variable for batch processing # override settings with an environment variable for batch processing
PKGDEST=${_PKGDEST:-$PKGDEST} PKGDEST=${_PKGDEST:-$PKGDEST}
PKGDEST=${PKGDEST:-$startdir} #default to $startdir if undefined PKGDEST=${PKGDEST:-$startdir} #default to $startdir if undefined
if [[ ! -w $PKGDEST ]]; then
error "$(gettext "You do not have write permission to store packages in %s.")" "$PKGDEST"
plain "$(gettext "Aborting...")"
exit 1
fi
SRCDEST=${_SRCDEST:-$SRCDEST} SRCDEST=${_SRCDEST:-$SRCDEST}
SRCDEST=${SRCDEST:-$startdir} #default to $startdir if undefined SRCDEST=${SRCDEST:-$startdir} #default to $startdir if undefined
if [[ ! -w $SRCDEST ]] ; then
error "$(gettext "You do not have write permission to store downloads in %s.")" "$SRCDEST"
plain "$(gettext "Aborting...")"
exit 1
fi
SRCPKGDEST=${_SRCPKGDEST:-$SRCPKGDEST} SRCPKGDEST=${_SRCPKGDEST:-$SRCPKGDEST}
SRCPKGDEST=${SRCPKGDEST:-$PKGDEST} #default to $PKGDEST if undefined SRCPKGDEST=${SRCPKGDEST:-$PKGDEST} #default to $PKGDEST if undefined