[pacman-dev] [patch] makepkg3 -- makepkg doesn't stop on build failure.
Hi Found a small bug. When running 'makepkg --log' makepkg doesn't stop if build() fails. Patch attached, see the header for an example. Andrew ------------------------------------------------------------ revno: 3 committer: Andrew Fyfe <andrew@neptune-one.net> branch nick: bug_log_pipe timestamp: Sun 2007-03-25 16:39:45 +0100 message: * Fix bug where 'makepkg -L' doesn't stop on build failure. To test... PKGBUILD>> pkgname=test-package pkgver=1 pkgrel=1 arch=(i686) build() { false; } run makepkg -L build() will fail and makepkg carries on trying to create the package. === modified file 'scripts/makepkg' --- old/scripts/makepkg 2007-03-24 03:49:27 +0000 +++ new/scripts/makepkg 2007-03-25 15:39:45 +0000 @@ -899,10 +899,10 @@ #use 'errexit' to bail on syntax error [ $set_e -eq 1 ] && set -e - build 2>&1 | tee "$BUILDLOG" + build 2>&1 | tee "$BUILDLOG"; ret=${PIPESTATUS[0]} [ $set_e -eq 1 ] && set +e - if [ ${PIPESTATUS[0]} -gt 0 ]; then + if [ $ret -gt 0 ]; then error "Build Failed. Aborting..." removedeps exit 2
Andrew Fyfe wrote:
Hi
Found a small bug. When running 'makepkg --log' makepkg doesn't stop if build() fails. Patch attached, see the header for an example.
Andrew
------------------------------------------------------------------------
_______________________________________________ pacman-dev mailing list pacman-dev@archlinux.org http://www.archlinux.org/mailman/listinfo/pacman-dev
Sorry wrong patch attached, this one fixes. Without '-L' it fails but doesn't print the error message. Andrew ------------------------------------------------------------ revno: 3 committer: Andrew Fyfe <andrew@neptune-one.net> branch nick: bug_log_pipe timestamp: Sun 2007-03-25 16:39:45 +0100 message: * Fix bug where 'makepkg -L' doesn't stop on build failure. To test... PKGBUILD>> pkgname=test-package pkgver=1 pkgrel=1 arch=(i686) build() { false; } run makepkg -L build() will fail and makepkg carries on trying to create the package. === modified file 'scripts/makepkg' --- old/scripts/makepkg 2007-03-25 15:39:45 +0000 +++ new/scripts/makepkg 2007-03-25 15:57:34 +0000 @@ -883,6 +883,7 @@ echo $SHELLOPTS | grep errexit 2>&1 >/dev/null set_e=$? + ret=0 if [ "$LOGGING" = "1" ]; then BUILDLOG="${startdir}/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.log" if [ -f "$BUILDLOG" ]; then @@ -910,9 +911,9 @@ else #use 'errexit' to bail on syntax error [ $set_e -eq 1 ] && set -e - build 2>&1 + build 2>&1 || ret=$? [ $set_e -eq 1 ] && set +e - if [ $? -gt 0 ]; then + if [ $ret -gt 0 ]; then error "Build Failed. Aborting..." removedeps exit 2
Dan McGee wrote:
On 3/25/07, Andrew Fyfe <andrew@neptune-one.net> wrote:
Andrew Fyfe wrote:
Hi
Found a small bug. When running 'makepkg --log' makepkg doesn't stop if build() fails. Patch attached, see the header for an example.
Andrew
So should I be applying both patches?
-Dan
_______________________________________________ pacman-dev mailing list pacman-dev@archlinux.org http://www.archlinux.org/mailman/listinfo/pacman-dev No just the second one.
Andrew
On 3/25/07, Andrew Fyfe <andrew@neptune-one.net> wrote:
Dan McGee wrote:
On 3/25/07, Andrew Fyfe <andrew@neptune-one.net> wrote:
Andrew Fyfe wrote:
Hi
Found a small bug. When running 'makepkg --log' makepkg doesn't stop if build() fails. Patch attached, see the header for an example.
Andrew
So should I be applying both patches?
-Dan
_______________________________________________ pacman-dev mailing list pacman-dev@archlinux.org http://www.archlinux.org/mailman/listinfo/pacman-dev No just the second one.
Andrew
I applied both and don't know why I shouldn't. It also allowed me to simplify the code a bit, I'll put my current diff below. On a side note, do you have jabber or get on IRC much? If so, feel free to add my jabber (dpmcgee@gmail.com) and/or join us on freenode at #archlinux-pacman. -Dan Index: makepkg =================================================================== RCS file: /home/cvs-pacman/pacman-lib/scripts/makepkg,v retrieving revision 1.64 diff -u -u -r1.64 makepkg --- makepkg 24 Mar 2007 17:11:18 -0000 1.64 +++ makepkg 25 Mar 2007 17:10:25 -0000 @@ -883,6 +883,7 @@ echo $SHELLOPTS | grep errexit 2>&1 >/dev/null set_e=$? + ret=0 if [ "$LOGGING" = "1" ]; then BUILDLOG="${startdir}/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.log" if [ -f "$BUILDLOG" ]; then @@ -899,24 +900,18 @@ #use 'errexit' to bail on syntax error [ $set_e -eq 1 ] && set -e - build 2>&1 | tee "$BUILDLOG" + build 2>&1 | tee "$BUILDLOG"; ret=${PIPESTATUS[0]} [ $set_e -eq 1 ] && set +e - - if [ ${PIPESTATUS[0]} -gt 0 ]; then - error "Build Failed. Aborting..." - removedeps - exit 2 - fi else #use 'errexit' to bail on syntax error [ $set_e -eq 1 ] && set -e - build 2>&1 + build 2>&1; ret=$? [ $set_e -eq 1 ] && set +e - if [ $? -gt 0 ]; then - error "Build Failed. Aborting..." - removedeps - exit 2 - fi + fi + if [ $ret -gt 0 ]; then + error "Build Failed. Aborting..." + removedeps + exit 2 fi fi
participants (2)
-
Andrew Fyfe
-
Dan McGee