Skip to content

Commit 6ede37d

Browse files
committed
[scripts] Retry download ten times before failing
1 parent c1a8fdb commit 6ede37d

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

scripts/config.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ CACERTFILE="$ABLDDIR/security/cacerts"
2323
# hg tarball
2424
JAVA_BZ2="$BUILDDIR/tip.tar.bz2"
2525
JAVA_TMP="$BUILDDIR/jdk_tmp"
26+
TARBALL_MAX_DOWNLOADS=10
2627

2728
##
2829
## Version-specific configuration

scripts/fetch.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,22 @@ if [ ! -d "$JDKDIR" ]; then
2727

2828
# download bz2
2929
echo "[FETCH] Downloading Java tarball from Mercurial"
30+
3031
wget -nv -N "$JAVA_REPO"
32+
status=$?
33+
tries=1
34+
while [[ "$status" -ne "0" ]]; do
35+
36+
if [[ "$tries" -gt "$TARBALL_MAX_DOWNLOADS" ]]; then
37+
echo "$TARBALL_MAX_DOWNLOADS download failed, giving up." 1>&2
38+
exit 1
39+
fi
40+
41+
wget -nv -N "$JAVA_REPO"
42+
status=$?
43+
tries=$(($tries+1))
44+
done
45+
3146

3247
# extract
3348
echo "[FETCH] Extracting tarball"

0 commit comments

Comments
 (0)