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>
This commit is contained in:
parent
b312c820c8
commit
621aa26e26
1 changed files with 5 additions and 3 deletions
|
@ -718,8 +718,10 @@ run_build() {
|
||||||
|
|
||||||
build 2>&1 | tee "$BUILDLOG"; ret=${PIPESTATUS[0]}
|
build 2>&1 | tee "$BUILDLOG"; ret=${PIPESTATUS[0]}
|
||||||
else
|
else
|
||||||
build 2>&1 || ret=$?
|
# piping to cat ensures makepkg fails on any build error
|
||||||
|
build 2>&1 | cat -; ret=${PIPESTATUS[0]}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# reset our shell options
|
# reset our shell options
|
||||||
eval "$shellopts"
|
eval "$shellopts"
|
||||||
|
|
||||||
|
@ -772,12 +774,12 @@ run_package() {
|
||||||
exec 3>&1
|
exec 3>&1
|
||||||
tee "$BUILDLOG" < "$logpipe" &
|
tee "$BUILDLOG" < "$logpipe" &
|
||||||
exec 1>"$logpipe" 2>"$logpipe"
|
exec 1>"$logpipe" 2>"$logpipe"
|
||||||
$pkgfunc 2>&1 || ret=$?
|
$pkgfunc 2>&1 | cat -; ret=${PIPESTATUS[0]}
|
||||||
sync
|
sync
|
||||||
exec 1>&3 2>&3 3>&-
|
exec 1>&3 2>&3 3>&-
|
||||||
rm "$logpipe"
|
rm "$logpipe"
|
||||||
else
|
else
|
||||||
$pkgfunc 2>&1 || ret=$?
|
$pkgfunc 2>&1 | cat -; ret=${PIPESTATUS[0]}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $ret -gt 0 ]; then
|
if [ $ret -gt 0 ]; then
|
||||||
|
|
Loading…
Add table
Reference in a new issue