retrying CVS
Jasper Huijsmans
jasper at moongroup.com
Thu May 29 09:30:29 GMT 2003
Hi all,
The patch below implements the NUM_RETRY setting for CVS downloads. It
significantly increases the chance of getting a proper update from
SourceForge repositories ;)
What do you think?
Jasper
Index: download.lunar
===================================================================
RCS file: /var/cvs/theedge/var/lib/lunar/functions/download.lunar,v
retrieving revision 1.14
diff -u -r1.14 download.lunar
--- download.lunar 30 Apr 2003 22:46:06 -0000 1.14
+++ download.lunar 29 May 2003 07:22:41 -0000
@@ -78,13 +78,26 @@
verbose_msg "CVSROOT=\"$CVSROOT\""
- if [[ -d $CVSMODULE/CVS ]]; then
- verbose_msg "cvs -qz3 up -PAd $CVSRELEASE $CVSMODULE"
- cvs -qz3 up -PAd $CVSRELEASE $CVSMODULE && GOT_CVS="yes"
- elif ! [[ -d CVS ]]; then
- verbose_msg "cvs -qz3 co $CVSRELEASE $CVSMODULE"
- cvs -qz3 co $CVSRELEASE $CVSMODULE && GOT_CVS="yes"
- fi
+ NUM_RETRY=${NUM_RETRY:=5}
+
+ for (( TRY=1 ; $TRY<$NUM_RETRY+1 ; TRY++ ))
+ do
+ verbose_msg "${MESSAGE_COLOR}Try: ${TRY}${DEFAULT_COLOR}"
+
+ if [[ -d $CVSMODULE/CVS ]]; then
+ verbose_msg "cvs -qz3 up -PAd $CVSRELEASE $CVSMODULE"
+ cvs -qz3 up -PAd $CVSRELEASE $CVSMODULE && GOT_CVS="yes"
+ elif ! [[ -d CVS ]]; then
+ verbose_msg "cvs -qz3 co $CVSRELEASE $CVSMODULE"
+ cvs -qz3 co $CVSRELEASE $CVSMODULE && GOT_CVS="yes"
+ fi
+
+ if [[ "$?" == "0" ]]; then
+ break
+ fi
+
+ sleep 2
+ done
if [[ "$GOT_CVS" == "yes" ]]; then
message "${MESSAGE_COLOR}Creating
${FILE_COLOR}${SOURCE}${DEFAULT_COLOR}"
--
More information about the Lunar-dev
mailing list