Fix download retry helper (#1110)

* Fix download helper

* Fix download helper

* Add compressed flag to helper

* Minor fix

* Minor fix
This commit is contained in:
Vladimir Safonkin
2020-07-01 13:31:41 +00:00
committed by GitHub
parent 4d685f4b01
commit c1ee9d8bc6
2 changed files with 9 additions and 2 deletions

View File

@@ -11,12 +11,19 @@ download_with_retries() {
local URL="$1" local URL="$1"
local DEST="${2:-.}" local DEST="${2:-.}"
local NAME="${3:-${URL##*/}}" local NAME="${3:-${URL##*/}}"
local COMPRESSED="$4"
if [ $COMPRESSED == "compressed" ]; then
COMMAND="curl $URL -4 -s --compressed -o '$DEST/$NAME'"
else
COMMAND="curl $URL -4 -s -o '$DEST/$NAME'"
fi
echo "Downloading $URL..." echo "Downloading $URL..."
i=20 i=20
while [ $i -gt 0 ]; do while [ $i -gt 0 ]; do
((i--)) ((i--))
curl $URL -4 -s -compressed -o "$DEST/$NAME" eval $COMMAND
if [ $? != 0 ]; then if [ $? != 0 ]; then
sleep 30 sleep 30
else else

View File

@@ -72,7 +72,7 @@ function InstallPyPy
# Installation PyPy # Installation PyPy
uri="https://downloads.python.org/pypy/" uri="https://downloads.python.org/pypy/"
download_with_retries $uri "/tmp" "pypyUrls.html" download_with_retries $uri "/tmp" "pypyUrls.html" compressed
pypyVersions="$(cat /tmp/pypyUrls.html | grep 'linux64' | awk -v uri="$uri" -F'>|<' '{print uri$5}')" pypyVersions="$(cat /tmp/pypyUrls.html | grep 'linux64' | awk -v uri="$uri" -F'>|<' '{print uri$5}')"
toolsetJson="$INSTALLER_SCRIPT_FOLDER/toolset.json" toolsetJson="$INSTALLER_SCRIPT_FOLDER/toolset.json"