[pacman-dev] [PATCH] makepkg: don't print status for run_function when in a subshell

Eli Schwartz eschwartz at archlinux.org
Wed Aug 29 05:10:21 UTC 2018


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 at archlinux.org>
---
 scripts/makepkg.sh.in | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 2545487a..da68d2a7 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -187,6 +187,7 @@ enter_fakeroot() {
 # Automatically update pkgver variable if a pkgver() function is provided
 # Re-sources the PKGBUILD afterwards to allow for other variables that use $pkgver
 update_pkgver() {
+	msg "$(gettext "Starting %s()...")" "pkgver"
 	newpkgver=$(run_function_safe pkgver)
 	if (( $? )); then
 		error_function pkgver
@@ -447,7 +448,9 @@ run_function() {
 	fi
 	local pkgfunc="$1"
 
-	msg "$(gettext "Starting %s()...")" "$pkgfunc"
+	if (( ! BASH_SUBSHELL )); then
+		msg "$(gettext "Starting %s()...")" "$pkgfunc"
+	fi
 	cd_safe "$srcdir"
 
 	if (( LOGGING )); then
-- 
2.18.0


More information about the pacman-dev mailing list