Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTasos Sahanidis <tasos@tasossah.com>2024-03-05 23:45:03 +0200
committerTasos Sahanidis <tasos@tasossah.com>2024-03-05 23:45:03 +0200
commit19435139a539d47d7cac2a464dbd80fb173b3a52 (patch)
treebf773729357d6612284f8a1686441018dd5f43e3
parentf101d028a7463632a701e767a7d36e45a1ed7f3a (diff)
lib/common-functions: Retry the curl command if empty gz is returned
-rwxr-xr-xlib/common-functions25
1 files changed, 17 insertions, 8 deletions
diff --git a/lib/common-functions b/lib/common-functions
index da5ddc1..f13b1f2 100755
--- a/lib/common-functions
+++ b/lib/common-functions
@@ -476,14 +476,23 @@ extract_source_directory() {
pkgbase_translated=$(gitlab_project_name_to_path "${pkgbase}")
tmptarfile=$(mktemp "${tmp_dir}"'/tmp.upstream-package.XXXXXXXXXX')
url="https://buildmaster.archlinux32.org/upstream-packages/${pkgbase_translated}-${revision}.tar.gz"
- curl -o "$tmptarfile" -fLSs "${url}"
- res=$?
- if [ "$res" -ne 0 ]; then
- >&2 printf 'Download upstream-package "%s" from upstream via buildmaster cache failed. Curl exit code was %s.' \
- "${url}" \
- "${res}"
- return 1
- fi
+ for i in {1..4}; do
+ curl -o "$tmptarfile" -fLSs "${url}"
+ res=$?
+ if [ "$res" -ne 0 ]; then
+ >&2 printf 'Download upstream-package "%s" from upstream via buildmaster cache failed. Curl exit code was %s.' \
+ "${url}" \
+ "${res}"
+ return 1
+ fi
+
+ # If zero bytes, try again
+ if [ -s "${tmptarfile}" ]; then
+ break
+ fi
+
+ sleep 5
+ done
if [ -f "${tmptarfile}" ]; then
tar -xz -f "${tmptarfile}" --strip-components=1 -C "${output}" -- "${pkgbase_translated}-${revision}"
printf '\n' >> \