build-package: fast builds (-i/-I): retry if release file download fails

As termux_download.sh retries only on transient errors now, we need a
loop when downloading Release{,.gpg} as they may be temporarily unavailable
when metadata is being rebuilt in repository.
This commit is contained in:
Leonid Pliushch 2020-08-13 13:50:47 +00:00
parent b484310ef5
commit 6100e0caf4

View File

@ -25,11 +25,14 @@ termux_get_repo_files() {
local TERMUX_REPO_NAME=$(echo ${TERMUX_REPO_URL[$idx-1]} | sed -e 's%https://%%g' -e 's%http://%%g' -e 's%/%-%g') local TERMUX_REPO_NAME=$(echo ${TERMUX_REPO_URL[$idx-1]} | sed -e 's%https://%%g' -e 's%http://%%g' -e 's%/%-%g')
local RELEASE_FILE=${TERMUX_COMMON_CACHEDIR}/${TERMUX_REPO_NAME}-${TERMUX_REPO_DISTRIBUTION[$idx-1]}-Release local RELEASE_FILE=${TERMUX_COMMON_CACHEDIR}/${TERMUX_REPO_NAME}-${TERMUX_REPO_DISTRIBUTION[$idx-1]}-Release
local attempt
for attempt in {1..5}; do
termux_download "${TERMUX_REPO_URL[$idx-1]}/dists/${TERMUX_REPO_DISTRIBUTION[$idx-1]}/Release" \ termux_download "${TERMUX_REPO_URL[$idx-1]}/dists/${TERMUX_REPO_DISTRIBUTION[$idx-1]}/Release" \
"$RELEASE_FILE" SKIP_CHECKSUM "$RELEASE_FILE" SKIP_CHECKSUM || sleep 30 && continue
termux_download "${TERMUX_REPO_URL[$idx-1]}/dists/${TERMUX_REPO_DISTRIBUTION[$idx-1]}/Release.gpg" \ termux_download "${TERMUX_REPO_URL[$idx-1]}/dists/${TERMUX_REPO_DISTRIBUTION[$idx-1]}/Release.gpg" \
"${RELEASE_FILE}.gpg" SKIP_CHECKSUM "${RELEASE_FILE}.gpg" SKIP_CHECKSUM || sleep 30 && continue
break
done
gpg --verify "${RELEASE_FILE}.gpg" "$RELEASE_FILE" gpg --verify "${RELEASE_FILE}.gpg" "$RELEASE_FILE"