[packages/rpm-build-tools] --retry-distfiles for use on cvs builder (in case if build request is faster than distfiles processi

arekm arekm at pld-linux.org
Sun Apr 5 19:27:28 CEST 2026


commit 848271e94b2199965166004c59fd19dbd44a02aa
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sun Apr 5 19:27:19 2026 +0200

    --retry-distfiles for use on cvs builder (in case if build request is faster than distfiles processing)

 builder.sh | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
---
diff --git a/builder.sh b/builder.sh
index 8cca057..e44c4a6 100755
--- a/builder.sh
+++ b/builder.sh
@@ -58,6 +58,8 @@ DEBUG=""
 NOURLS=""
 NOCVSSPEC=""
 NODIST=""
+DISTFILES_RETRY_COUNT=0
+DISTFILES_RETRY_DELAY=0
 NOINIT=""
 PREFMIRRORS=""
 UPDATE=""
@@ -392,6 +394,8 @@ Usage: builder [--all-branches] [-D|--debug] [-V|--version] [--short-version]  [
                     - log all to file,
 -ncs, --no-cvs-specs
                     - don't pull from PLD repo
+--retry-distfiles TRIES,SECONDS
+                    - retry distfiles fetch TRIES times with SECONDS delay between retries
 -nd, --no-distfiles - don't download from distfiles
 -nm, --no-mirrors   - don't download from mirror, if source URL is given,
 -nu, --no-urls      - don't try to download from FTP/HTTP location,
@@ -1382,6 +1386,9 @@ get_files() {
 					fi
 
 					url_attic=$(distfiles_attic_url "$i")
+
+					local df_try=0
+					while true; do
 					FROM_DISTFILES=1
 					# is $url local file?
 					if [[ "$url" = [./]* ]]; then
@@ -1414,10 +1421,18 @@ get_files() {
 
 					if [ -s "$target" ]; then
 						cvsignore_df $target
+						break
+					elif [ "$DISTFILES_RETRY_DELAY" -gt 0 ] 2>/dev/null && [ "$df_try" -lt "$DISTFILES_RETRY_COUNT" ]; then
+						rm -f "$target"
+						df_try=$((df_try + 1))
+						echo "Distfiles fetch failed for $(nourl "$i"), retry ${df_try}/${DISTFILES_RETRY_COUNT} with ${DISTFILES_RETRY_DELAY}s delay..."
+						sleep "$DISTFILES_RETRY_DELAY"
 					else
 						rm -f "$target"
 						FROM_DISTFILES=0
+						break
 					fi
+					done
 				fi
 
 				if [ -z "$NOURLS" ] && [ ! -f "$fp" -o -n "$UPDATE" ] && [ "`echo $i | grep -E 'ftp://|http://|https://'`" ]; then
@@ -2230,6 +2245,10 @@ while [ $# -gt 0 ]; do
 			COMMAND="mr-proper"; shift ;;
 		-ncs | --no-cvs-specs )
 			NOCVSSPEC="yes"; shift ;;
+		--retry-distfiles )
+			DISTFILES_RETRY_COUNT=${2%%,*}
+			DISTFILES_RETRY_DELAY=${2#*,}
+			shift 2 ;;
 		-nd | --no-distfiles )
 			NODIST="yes"; shift ;;
 		-nm | --no-mirrors )
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rpm-build-tools.git/commitdiff/848271e94b2199965166004c59fd19dbd44a02aa



More information about the pld-cvs-commit mailing list