[U-Boot] [PATCH] MAKEALL: Fix return value
Mike Frysinger
vapier at gentoo.org
Sun Dec 6 08:45:16 CET 2009
On Sunday 06 December 2009 02:09:34 Peter Tyser wrote:
> ${MAKE} ${JOBS} all 2>&1 >${LOG_DIR}/$target.MAKELOG \
> | tee ${LOG_DIR}/$target.ERR
you could rewrite this to keep POSIX compliance:
# need to maintain exit value ourselves as pipes eat it
fail=${LOG_DIR}/$target.failed
rm -f ${fail}
(${MAKE} ${JOBS} all 2>&1 >${LOG_DIR}/$target.MAKELOG \
|| touch ${fail}) | tee ${LOG_DIR}/$target.ERR
[ -e ${fail} ] && : $(( RC += 1 ))
rm -f ${fail}
> + # Keep a running total of all 'make' return values
> + RC=$((RC + ${PIPESTATUS[0]}))
this might be more natural:
: $(( RC += ${PIPESTATUS[0]} ))
> + # Return how many board compiles failed, assuming 'make' returns 2
> + # for builds which failed
> + exit $(((RC + 1) / 2))
the problem here is that exit statuses have a range of 256 values. so as soon
as more than 255 boards fail, this wont work. maybe i'm being overly paranoid
though ?
$ (exit 256); echo $?
0
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091206/42d33a07/attachment.pgp
More information about the U-Boot
mailing list