makepkg: fix pkgver() function not aborting on errors

`run_function_safe pkgver` is evaluated in a subshell and therefore does
not abort when it should. Explicitly check the return outside of the
subshell and abort if necessary.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Eli Schwartz 2018-08-13 21:20:58 -04:00 committed by Allan McRae
parent 48c8f9f2a2
commit 16f6aae330

View file

@ -188,6 +188,9 @@ enter_fakeroot() {
# Re-sources the PKGBUILD afterwards to allow for other variables that use $pkgver # Re-sources the PKGBUILD afterwards to allow for other variables that use $pkgver
update_pkgver() { update_pkgver() {
newpkgver=$(run_function_safe pkgver) newpkgver=$(run_function_safe pkgver)
if (( $? != 0 )); then
error_function pkgver
fi
if ! check_pkgver "$newpkgver"; then if ! check_pkgver "$newpkgver"; then
error "$(gettext "pkgver() generated an invalid version: %s")" "$newpkgver" error "$(gettext "pkgver() generated an invalid version: %s")" "$newpkgver"
exit $E_PKGBUILD_ERROR exit $E_PKGBUILD_ERROR