r3531 - in jhalfs/trunk: . common/libs

thomasp at linuxfromscratch.org thomasp at linuxfromscratch.org
Thu Mar 11 19:32:26 PST 2010


Author: thomasp
Date: 2010-03-11 20:32:25 -0700 (Thu, 11 Mar 2010)
New Revision: 3531

Modified:
   jhalfs/trunk/Config.in
   jhalfs/trunk/common/libs/func_download_pkgs
   jhalfs/trunk/common/libs/func_validate_configs.sh
Log:
Add configuration options for retry on connection refused, number of times to attemp to download a file, and timeout for wget invocation. Thanks to Tim Sarbin for the patch, slightly modified by me to accomodate a second set of wget calls.
 


Modified: jhalfs/trunk/Config.in
===================================================================
--- jhalfs/trunk/Config.in	2009-10-23 15:53:53 UTC (rev 3530)
+++ jhalfs/trunk/Config.in	2010-03-12 03:32:25 UTC (rev 3531)
@@ -746,6 +746,30 @@
 			#   Any missing file will be downloaded and archived here,
 			#   if the user has the right priviledges.
 
+	config RETRYSRCDOWNLOAD
+		bool "Retry on 'connection refused' failure"
+		default n
+		depends GETPKG
+		help
+			#-- Attempt to download a source package again if it fails
+			#   with a 'connection refused' error. This can happen on
+			#   servers that are overloaded.
+
+	config RETRYDOWNLOADCNT
+		int "Number of retry attempts on download failures"
+		default 20
+		depends GETPKG
+		help
+			#-- Number of times to retry download a failed download.
+
+	config DOWNLOADTIMEOUT
+		int "Download timeout (in seconds)"
+		default 30
+		depends GETPKG
+		help
+			#-- Number of seconds to wait for a download to start before
+			#   timing out.
+
 	config SERVER
 		string "FTP mirror"
 		default "ftp://ftp.lfs-matrix.net"

Modified: jhalfs/trunk/common/libs/func_download_pkgs
===================================================================
--- jhalfs/trunk/common/libs/func_download_pkgs	2009-10-23 15:53:53 UTC (rev 3530)
+++ jhalfs/trunk/common/libs/func_download_pkgs	2010-03-12 03:32:25 UTC (rev 3531)
@@ -7,8 +7,15 @@
 get_sources() {              # Download file, write name to MISSING_FILES.DMP if an error
 #----------------------------#
   local saveIFS=$IFS
-  local IFS line URL1 URL2 FILE BOOKMD5 MD5 HAVEMD5 fromARCHIVE
+  local IFS line URL1 URL2 FILE BOOKMD5 MD5 HAVEMD5 fromARCHIVE WGETPARAM
 
+  WGETPARAM=""
+  if [[ "${RETRYSRCDOWNLOAD}" = "y" ]] ; then
+    WGETPARAM+="--retry-connrefused"
+  fi
+  WGETPARAM+=" --tries ${RETRYDOWNLOADCNT}"
+  WGETPARAM+=" --timeout ${DOWNLOADTIMEOUT}"
+
     # Test if the packages must be downloaded
   [ ! "$GETPKG" = "y" ] && return
 
@@ -68,7 +75,7 @@
       fromARCHIVE=0
       # If the file does not exist yet in /sources download a fresh one
       if [ ! -f $FILE ] ; then
-        if ! wget $URL1 && ! wget $URL2 ; then
+        if ! wget $URL1 $WGETPARAM && ! wget $URL2 $WGETPARAM ; then
           gs_wrt_message "$FILE not found in the SRC_ARCHIVE or on any server..SKIPPING"
           continue
         fi
@@ -88,7 +95,7 @@
         # Force storage in SRC_ARCHIVE
       fromARCHIVE=0;
         # Try to retrieve again the file. Servers in reverse order.
-      if ! wget $URL2 && ! wget $URL1 ; then
+      if ! wget $URL2 $WGETPARAM && ! wget $URL1 $WGETPARAM ; then
         gs_wrt_message "$FILE not found on the servers.. SKIPPING"
         continue
       fi

Modified: jhalfs/trunk/common/libs/func_validate_configs.sh
===================================================================
--- jhalfs/trunk/common/libs/func_validate_configs.sh	2009-10-23 15:53:53 UTC (rev 3530)
+++ jhalfs/trunk/common/libs/func_validate_configs.sh	2010-03-12 03:32:25 UTC (rev 3531)
@@ -23,7 +23,8 @@
   local -r     BOOK_common="BOOK CUSTOM_TOOLS"
   local -r      BOOK_clfsX="ARCH TARGET"
   local -r  GENERAL_common="LUSER LGROUP LHOME BUILDDIR CLEAN GETPKG SRC_ARCHIVE \
-                            SERVER GETKERNEL RUNMAKE"
+                            SERVER RETRYSRCDOWNLOAD RETRYDOWNLOADCNT DOWNLOADTIMEOUT \
+                            GETKERNEL RUNMAKE"
   local -r    BUILD_chroot="TEST BOMB_TEST STRIP"
   local -r    BUILD_common="FSTAB CONFIG TIMEZONE PAGE LANG INSTALL_LOG"
   local -r ADVANCED_chroot="COMPARE RUN_ICA RUN_FARCE ITERATIONS OPTIMIZE"
@@ -135,14 +136,17 @@
       GETKERNEL ) if [[ -z "$CONFIG" ]] && [[ -z "$BOOT_CONFIG" ]] ; then
                     [[ "$GETPKG" = "y" ]] && echo -e "`eval echo $PARAM_VALS`"
                   fi ;;
-      COMPARE)    [[ ! "$COMPARE" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
-      RUN_ICA)    [[ "$COMPARE" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
-      RUN_FARCE)  [[ "$COMPARE" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
-      ITERATIONS) [[ "$COMPARE" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
-      BOMB_TEST)  [[ ! "$TEST" = "0" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
-      TARGET32)   [[ -n "${TARGET32}" ]] &&  echo -e "`eval echo $PARAM_VALS`" ;;
-      MIPS_LEVEL) [[ "${ARCH}" = "mips" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
-      SERVER)     [[ "$GETPKG" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
+      COMPARE)          [[ ! "$COMPARE" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
+      RUN_ICA)          [[ "$COMPARE" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
+      RUN_FARCE)        [[ "$COMPARE" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
+      ITERATIONS)       [[ "$COMPARE" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
+      BOMB_TEST)        [[ ! "$TEST" = "0" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
+      TARGET32)         [[ -n "${TARGET32}" ]] &&  echo -e "`eval echo $PARAM_VALS`" ;;
+      MIPS_LEVEL)       [[ "${ARCH}" = "mips" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
+      SERVER)           [[ "$GETPKG" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
+      RETRYSRCDOWNLOAD) [[ "$GETPKG" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
+      RETRYDOWNLOADCNT) [[ "$GETPKG" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
+      DOWNLOADTIMEOUT)  [[ "$GETPKG" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
 
       # Envars that requires some validation
       LUSER)      echo -e "`eval echo $PARAM_VALS`"




More information about the alfs-log mailing list