[pacman-dev] [PATCH] Ensure build failure if a single build() command fails

Jürgen Hötzel juergen at hoetzel.info
Fri Jun 12 17:49:11 EDT 2009


Hi,

I doubt this was by intention:

errors in build() functions are only fatal, if "--log" is enabled. 

I just made a buggy pkg because some "install ..." commands
where not handled by "|| return 1".

Our PKGBUILDs are cluttert full of "|| return 1". Failing commands in
build functions should always result in an build error.
 
Signed-off-by: Juergen Hoetzel <juergen at archlinux.org>
---
 scripts/makepkg.sh.in |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index f46b7f8..84d4599 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -703,6 +703,7 @@ run_build() {
 	local ret=0
 	if [ "$LOGGING" -eq 1 ]; then
 		BUILDLOG="${startdir}/${pkgbase}-${pkgver}-${pkgrel}-${CARCH}-build.log"
+		BUILDLOG_CMD="tee $BUILDLOG"
 		if [ -f "$BUILDLOG" ]; then
 			local i=1
 			while true; do
@@ -714,11 +715,11 @@ run_build() {
 			done
 			mv "$BUILDLOG" "$BUILDLOG.$i"
 		fi
-
-		build 2>&1 | tee "$BUILDLOG"; ret=${PIPESTATUS[0]}
 	else
-		build 2>&1 || ret=$?
+		BUILDLOG_CMD="cat -"
 	fi
+
+	build 2>&1 | ${BUILDLOG_CMD}; ret=${PIPESTATUS[0]}
 	# reset our shell options
 	eval "$shellopts"
 
-- 
1.6.3.2



More information about the pacman-dev mailing list