[pacman-dev] [PATCH] makepkg: Log commands to logfile

Alain Kalker a.c.kalker at gmail.com
Tue Jul 2 15:40:13 EDT 2013


For debugging PKGBUILDs, and for reporting build failures upstream,
it is very important to know the exact commands that are executed
leading up to a problem.
By using `set -x` and an appropriate value for PS4, commands are
logged before they are executed.

Signed-off-by: Alain Kalker <a.c.kalker at gmail.com>
---
 scripts/makepkg.sh.in | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 2a39157..859159f 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1468,8 +1468,15 @@ run_function() {
 		tee "$BUILDLOG" < "$logpipe" &
 		local teepid=$!
 
+		local restoreps4=$PS4
+		PS4='$ '
+		set -x
+
 		$pkgfunc &>"$logpipe"
 
+		set +x
+		PS4=$restoreps4
+
 		wait $teepid
 		rm "$logpipe"
 	else
-- 
1.8.3.2



More information about the pacman-dev mailing list