diff options
author | Holger Levsen <holger@layer-acht.org> | 2015-10-03 02:01:38 +0200 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2015-10-03 02:01:38 +0200 |
commit | 00f973b9c84f16b2099f5204023267a1d1585d03 (patch) | |
tree | 24bdf3f403188b47ddfeec3772403042f0e7adcb /bin | |
parent | 9cf52a56bad505f6f5a15ae41935f47a1ac0d8e3 (diff) | |
download | jenkins.debian.net-00f973b9c84f16b2099f5204023267a1d1585d03.tar.xz |
reproducible: refactor, try harder to download sources
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/reproducible_build.sh | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh index b3855ac8..648cf362 100755 --- a/bin/reproducible_build.sh +++ b/bin/reproducible_build.sh @@ -427,7 +427,7 @@ choose_package() { echo "The jenkins build log is/was available at ${BUILD_URL}console" | tee -a ${RBUILDLOG} } -get_source_package() { +download_source() { set +e local TMPLOG=$(mktemp --tmpdir=$TMPDIR) if [ "$MODE" != "master" ] ; then @@ -438,24 +438,28 @@ get_source_package() { fi 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} + rm ${TMPLOG} + set -e +} + +download_again_if_needed() { 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} + echo "$(date -u ) - download of ${SRCPACKAGE} sources (for ${SUITE}) failed." | tee -a ${RBUILDLOG} ls -l ${SRCPACKAGE}* | tee -a ${RBUILDLOG} 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 ${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 2>&1 | tee ${TMPLOG} - fi - 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}) + download_source fi - set -e - cat ${TMPLOG} >> ${RBUILDLOG} - rm ${TMPLOG} +} + +get_source_package() { + PARSED_RESULT="" + download_source + download_again_if_needed + download_again_if_needed + download_again_if_needed # yes, this is called three times. this should really not happen if [ "$(ls ${SRCPACKAGE}_*.dsc 2> /dev/null)" = "" ] || [ ! -z "$PARSED_RESULT" ] ; then if [ "$MODE" = "master" ] ; then handle_404 |