summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorHolger Levsen <holger@layer-acht.org>2015-09-26 11:01:35 +0200
committerHolger Levsen <holger@layer-acht.org>2015-09-26 11:01:35 +0200
commit47ca228a19af9a467202862065a972358f14975b (patch)
tree72d94a886a0fd5f171f37ce74f5122f8ec11289e /bin
parent49e5633927fd3d05a3063a0faf26272c6c71c8e5 (diff)
downloadjenkins.debian.net-47ca228a19af9a467202862065a972358f14975b.tar.xz
reproducible: always parse the output as we cannot rely on the exit code, as due to using /usr/bin/tee it will always be 0
Diffstat (limited to 'bin')
-rwxr-xr-xbin/reproducible_build.sh25
1 files changed, 12 insertions, 13 deletions
diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh
index a212b93f..6428baca 100755
--- a/bin/reproducible_build.sh
+++ b/bin/reproducible_build.sh
@@ -453,17 +453,16 @@ init_package_build() {
get_source_package() {
set +e
- local RESULT
+ local TMPLOG=$(mktemp --tmpdir=$TMPDIR)
if [ "$MODE" != "master" ] ; then
- schroot --directory $TMPDIR -c source:jenkins-reproducible-$SUITE apt-get -- --download-only --only-source source ${SRCPACKAGE} 2>&1 | tee -a ${RBUILDLOG}
- RESULT=$?
+ schroot --directory $TMPDIR -c source:jenkins-reproducible-$SUITE apt-get -- --download-only --only-source source ${SRCPACKAGE} 2>&1 | tee ${TMPLOG}
else
# the build master only needs to the the .dsc file
- schroot --directory $TMPDIR -c source:jenkins-reproducible-$SUITE apt-get -- --download-only --only-source --print-uris source ${SRCPACKAGE} | grep \.dsc|cut -d " " -f1|xargs -r wget --timeout=180 --tries=3
- RESULT=$?
+ schroot --directory $TMPDIR -c source:jenkins-reproducible-$SUITE apt-get -- --download-only --only-source --print-uris source ${SRCPACKAGE} | grep \.dsc|cut -d " " -f1|xargs -r wget --timeout=180 --tries=3 2>&1 | tee ${TMPLOG}
fi
- PARSED_RESULT=$(egrep 'E: Failed to fetch.*(Unable to connect to|Connection failed|Size mismatch|Cannot initiate the connection to|Bad Gateway)' ${RBUILDLOG} || true)
- if [ $RESULT != 0 ] || [ "$(ls ${SRCPACKAGE}_*.dsc 2> /dev/null)" = "" ] || [ ! -z "$PARSED_RESULT" ] ; then
+ PARSED_RESULT=$(egrep 'E: (Unable to find a source package for|Failed to fetch.*(Unable to connect to|Connection failed|Size mismatch|Cannot initiate the connection to|Bad Gateway))' ${TMPLOG})
+ cat ${TMPLOG} >> ${RBUILDLOG}
+ if [ "$(ls ${SRCPACKAGE}_*.dsc 2> /dev/null)" = "" ] || [ ! -z "$PARSED_RESULT" ] ; then
# sometimes apt-get cannot download a package for whatever reason.
# if so, wait some time and try again. only if that fails, give up.
echo "$(date -u ) - download of ${SRCPACKAGE} sources from ${SUITE} failed." | tee -a ${RBUILDLOG}
@@ -471,17 +470,17 @@ get_source_package() {
echo "$(date -u ) - sleeping 5m before re-trying..." | tee -a ${RBUILDLOG}
sleep 5m
if [ "$MODE" != "master" ] ; then
- schroot --directory $TMPDIR -c source:jenkins-reproducible-$SUITE apt-get -- --download-only --only-source source ${SRCPACKAGE} 2>&1 | tee -a ${RBUILDLOG}
- RESULT=$?
+ schroot --directory $TMPDIR -c source:jenkins-reproducible-$SUITE apt-get -- --download-only --only-source source ${SRCPACKAGE} 2>&1 | tee ${TMPLOG}
else
# the build master only needs to the the .dsc file
- schroot --directory $TMPDIR -c source:jenkins-reproducible-$SUITE apt-get -- --download-only --only-source --print-uris source ${SRCPACKAGE} | grep \.dsc|cut -d " " -f1|xargs -r wget --timeout=180 --tries=3
- RESULT=$?
+ schroot --directory $TMPDIR -c source:jenkins-reproducible-$SUITE apt-get -- --download-only --only-source --print-uris source ${SRCPACKAGE} | grep \.dsc|cut -d " " -f1|xargs -r wget --timeout=180 --tries=3 2>&1 | tee ${TMPLOG}
fi
- PARSED_RESULT=$(egrep 'E: Failed to fetch.*(Unable to connect to|Connection failed|Size mismatch|Cannot initiate the connection to|Bad Gateway)' ${RBUILDLOG} || true)
+ PARSED_RESULT=$(egrep 'E: (Unable to find a source package for|Failed to fetch.*(Unable to connect to|Connection failed|Size mismatch|Cannot initiate the connection to|Bad Gateway))' ${TMPLOG})
fi
set -e
- if [ $RESULT != 0 ] || [ "$(ls ${SRCPACKAGE}_*.dsc 2> /dev/null)" = "" ] || [ ! -z "$PARSED_RESULT" ] ; then
+ cat ${TMPLOG} >> ${RBUILDLOG}
+ rm ${TMPLOG}
+ if [ "$(ls ${SRCPACKAGE}_*.dsc 2> /dev/null)" = "" ] || [ ! -z "$PARSED_RESULT" ] ; then
if [ "$MODE" = "master" ] ; then
handle_404
else