From 621aa26e26fcf578221051e896d6440a0095b8a3 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Sat, 4 Jul 2009 01:52:28 +1000 Subject: makepkg: Exit on failure within build() or package() functions Errors in build() functions were only fatal, if "--log" was enabled. Errors in package() functions were never fatal. Piping these functions through "cat -" triggers error trapping. This prevents the need for "|| return 1" usage in PKGBUILDs. Original-patch-by: Juergen Hoetzel Signed-off-by: Allan McRae --- scripts/makepkg.sh.in | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index f931a65a..e9bd57cf 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -718,8 +718,10 @@ run_build() { build 2>&1 | tee "$BUILDLOG"; ret=${PIPESTATUS[0]} else - build 2>&1 || ret=$? + # piping to cat ensures makepkg fails on any build error + build 2>&1 | cat -; ret=${PIPESTATUS[0]} fi + # reset our shell options eval "$shellopts" @@ -772,12 +774,12 @@ run_package() { exec 3>&1 tee "$BUILDLOG" < "$logpipe" & exec 1>"$logpipe" 2>"$logpipe" - $pkgfunc 2>&1 || ret=$? + $pkgfunc 2>&1 | cat -; ret=${PIPESTATUS[0]} sync exec 1>&3 2>&3 3>&- rm "$logpipe" else - $pkgfunc 2>&1 || ret=$? + $pkgfunc 2>&1 | cat -; ret=${PIPESTATUS[0]} fi if [ $ret -gt 0 ]; then -- cgit v1.2.3-54-g00ecf