The way the log messages were interleaved made catching errors
difficult. Do something more complicated to make it work properly.
DSC = $dsc
FIRST = $first
REST = $rest
DSC = $dsc
FIRST = $first
REST = $rest
-SBUILD = t=\$@; sbuild \\
- --dist=\$\${t%-*} --arch=\$\${t\#*-} \\
- --chroot=\$@ --verbose
-TAGLINES = \\
- while IFS= read -r line; do printf "%s: %s\n" "\$@" "\$\$line"; done
+sbuild-wrap = \\
+ t=\$@; \\
+ { echo started >build-status.\$\$t; \\
+ sbuild \\
+ --dist=\$\${t%-*} --arch=\$\${t\#*-} \\
+ --chroot=\$@ --verbose \$1 \$(DSC); \\
+ rc=\$\$?; case \$\$rc in \\
+ 0) echo ok >build-status.\$\$t ;; \\
+ *) echo failed rc=\$\$rc >build-status.\$\$t ;; \\
+ esac; } | \\
+ while IFS= read -r line; do \\
+ printf "%s: %s\n" "\$\$t" "\$\$line"; \\
+ done; \\
+ read st _ <build-status.\$\$t && \\
+ case \$\$st in ok) exit 0 ;; *) exit 1 ;; esac
-\$(FIRST):; \$(SBUILD) $firstopt \$(DSC) | \$(TAGLINES)
-\$(REST):; \$(SBUILD) --no-arch-all \$(DSC) | \$(TAGLINES)
+\$(FIRST):; \$(call sbuild-wrap,$firstopt)
+\$(REST):; \$(call sbuild-wrap,--no-arch-all)
+ ## Make some marker files to say things are in progress.
+ for i in $first $rest; do echo "starting" >build-status.$i; done
+
## And we're ready to go.
mkfifo pipeout
cat pipeout& catpid=$!
set +e; make -fbuild.mk $parallel $makeopts -k all >pipeout
rc=$?; set -e
wait $!
## And we're ready to go.
mkfifo pipeout
cat pipeout& catpid=$!
set +e; make -fbuild.mk $parallel $makeopts -k all >pipeout
rc=$?; set -e
wait $!
+ rm build.mk pipeout build-status.*
find . -maxdepth 1 -type l -exec rm {} \;
exit $rc
;;
find . -maxdepth 1 -type l -exec rm {} \;
exit $rc
;;