diff options
author | Allan McRae <allan@archlinux.org> | 2009-07-03 17:52:28 +0200 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2009-07-10 08:29:58 +0200 |
commit | 621aa26e26fcf578221051e896d6440a0095b8a3 (patch) | |
tree | 59a22d9d8fe7d19e865d70e2570d5c26331ff064 | |
parent | b312c820c8c8ed98a8b8f927b948bca8a3a22632 (diff) | |
download | pacman-621aa26e26fcf578221051e896d6440a0095b8a3.tar.gz pacman-621aa26e26fcf578221051e896d6440a0095b8a3.tar.xz |
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 <juergen@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r-- | scripts/makepkg.sh.in | 8 |
1 files 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 |