makepkg: don't print status for run_function when in a subshell

It's most likely a case where output is being captured, so we shouldn't
be interleaving status messages with function output regardless. Setting
the pkgver() status message (the one time we use it in a subshell)
separately also makes it safe to change whether message.sh functions write
to stdout or stderr.

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-29 01:10:21 -04:00 committed by Allan McRae
parent 16f6aae330
commit 5b2ff51c39

View file

@ -187,6 +187,7 @@ enter_fakeroot() {
# Automatically update pkgver variable if a pkgver() function is provided # Automatically update pkgver variable if a pkgver() function is provided
# 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() {
msg "$(gettext "Starting %s()...")" "pkgver"
newpkgver=$(run_function_safe pkgver) newpkgver=$(run_function_safe pkgver)
if (( $? != 0 )); then if (( $? != 0 )); then
error_function pkgver error_function pkgver
@ -447,7 +448,9 @@ run_function() {
fi fi
local pkgfunc="$1" local pkgfunc="$1"
msg "$(gettext "Starting %s()...")" "$pkgfunc" if (( ! BASH_SUBSHELL )); then
msg "$(gettext "Starting %s()...")" "$pkgfunc"
fi
cd_safe "$srcdir" cd_safe "$srcdir"
local ret=0 local ret=0