Jürgen Hötzel wrote:
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 <[email protected]>
---
 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"

Seems fine. We will want to do the "cat -" thing in run_package too to catch packaging errors. In fact, as the tee mechanism is so different there, we will need to check that it actually catches errors...

Allan




_______________________________________________
pacman-dev mailing list
[email protected]
http://www.archlinux.org/mailman/listinfo/pacman-dev

Reply via email to