The attached patch is against 2.0.7 that's from Freshrpms.net. It adds the command-line options --use-wget or --wget which causes downloading to be done with wget. Positives: * Wget will do retries and continuing * Fast (much faster than other downlading methods) Negatives: * Won't delete damaged RPMs (you'll have to rerun yum without the --wget option or delete the RPM by hand) * Won't attempt alternate repositories Comments? -Paul This patch results retries like this (the progess bars were editted to 75 character E-mail width): I will do the following: [update: neon 0.24.7-2.1.i386] Downloading Packages error: rpmts_HdrFromFdno: MD5 digest: BAD Expected(bad61115ea3fffe85d996a4bc8b681a8) != (78f87b0e43737bd5d322b8aae1b6587a) Damaged RPM /var/cache/yum/fc2-updates/packages/neon-0.24.7-2.1.i386.rpm, removing. Getting neon-0.24.7-2.1.i386.rpm --10:05:01-- http://download.fedora.redhat.com/pub/fedora/linux/core/updates/2/i386/neon-0.24.7-2.1.i386.rpm => `/var/cache/yum/fc2-updates/packages/neon-0.24.7-2.1.i386.rpm' Resolving download.fedora.redhat.com... 66.187.224.20, 209.132.176.20, 209.132.176.220, ... Connecting to download.fedora.redhat.com[66.187.224.20]:80... connected. HTTP request sent, awaiting response... 200 OK Length: 87,606 [application/x-rpm] 76% [==========================> ] 66,672 1.93K/s ETA 00:08 --10:10:21-- http://download.fedora.redhat.com/pub/fedora/linux/core/updates/2/i386/neon-0.24.7-2.1.i386.rpm => `/var/cache/yum/fc2-updates/packages/neon-0.24.7-2.1.i386.rpm' Resolving download.fedora.redhat.com... 66.187.224.20, 209.132.176.20, 209.132.176.220, ... Connecting to download.fedora.redhat.com[66.187.224.20]:80... connected. HTTP request sent, awaiting response... 206 Partial Content Length: 87,606 (20,934 to go) [application/x-rpm] 100%[++++++++++++++++++++++++++========>] 87,606 3.54K/s ETA 00:00 10:10:28 (3.53 KB/s) - `/var/cache/yum/fc2-updates/packages/neon-0.24.7-2.1.i386.rpm' saved [87606/87606] Running test transaction: -Paul -------------- next part -------------- diff -ur --exclude='*.diff' --exclude='*.pyc' --exclude='*~' /usr/share/yum/clientStuff.py ./clientStuff.py --- /usr/share/yum/clientStuff.py 2004-07-23 05:21:09.000000000 -0700 +++ ./clientStuff.py 2004-07-27 12:11:06.050651726 -0700 @@ -1180,6 +1180,7 @@ pkghdr = tsInfo.getHeader(name, arch) rpmloc = tsInfo.localRpmPath(name, arch) serverid = tsInfo.serverid(name, arch) + exists_and_valid = 1 # this should be just like the hdr getting # check it out- if it is good, move along # otherwise, download, check, wash, rinse, repeat @@ -1188,8 +1189,11 @@ if os.path.exists(rpmloc): log(4, 'Checking cached RPM %s' % (os.path.basename(rpmloc))) if not rpmUtils.checkRpmMD5(rpmloc): - errorlog(0, _('Damaged RPM %s, removing.') % (rpmloc)) - os.unlink(rpmloc) + if conf.usewget: + exists_and_valid = 0 + else: + errorlog(0, _('Damaged RPM %s, removing.') % (rpmloc)) + os.unlink(rpmloc) else: rpmobj = rpmUtils.RPM_Work(rpmloc) hdre = pkghdr['epoch'] @@ -1202,20 +1206,36 @@ # gotten rid of the bad ones # now lets download things - if os.path.exists(rpmloc): + if os.path.exists(rpmloc) and exists_and_valid: pass else: log(2, _('Getting %s') % (os.path.basename(rpmloc))) remoterpmurl = tsInfo.remoteRpmUrl(name, arch) - try: - localrpmpath = grab(serverid, remoterpmurl, rpmloc, copy_local=0, - checkfunc=(rpmUtils.checkRpmMD5, (), {'urlgraberror':1})) - except URLGrabError, e: - errorlog(0, _('Error getting file %s') % remoterpmurl) - errorlog(0, '%s' % e) - sys.exit(1) + + if conf.usewget: + retry_range = range(2) + for error_count in retry_range: + # A try:...except: block won't catch anything from a subshell + e = os.system("%s --continue --output-document=%s %s" + % (conf.usewget, rpmloc, remoterpmurl)) + # e == (0, 1, or 2) => (Ok, Retryable Error, Big Error) + if e in [0, 2]: + tsInfo.setlocalrpmpath(name, arch, rpmloc) + break + if e in [1, 2]: + errorlog(0, _('\nError getting file %s') % remoterpmurl) + sys.exit(1) + else: - tsInfo.setlocalrpmpath(name, arch, localrpmpath) + try: + localrpmpath = grab(serverid, remoterpmurl, rpmloc, copy_local=0, + checkfunc=(rpmUtils.checkRpmMD5, (), {'urlgraberror':1})) + except URLGrabError, e: + errorlog(0, _('Error getting file %s') % remoterpmurl) + errorlog(0, '%s' % e) + sys.exit(1) + else: + tsInfo.setlocalrpmpath(name, arch, localrpmpath) # get the real location (for file:// repos) rpmloc = tsInfo.localRpmPath(name, arch) diff -ur --exclude='*.diff' --exclude='*.pyc' --exclude='*~' /usr/share/yum/config.py ./config.py --- /usr/share/yum/config.py 2004-07-23 05:21:09.000000000 -0700 +++ ./config.py 2004-07-27 08:39:33.000000000 -0700 @@ -90,6 +90,7 @@ self.cachedb = '/usr/lib/rpmdb/%s-redhat-linux/redhat/' % self.yumvar['basearch'] self.usecachedb = 1 self.downloadonly = 0 + self.usewget = "" self.bandwidth = None self.throttle = None self.retries = 6 diff -ur --exclude='*.diff' --exclude='*.pyc' --exclude='*~' /usr/share/yum/yummain.py ./yummain.py --- /usr/share/yum/yummain.py 2004-07-23 05:21:09.000000000 -0700 +++ ./yummain.py 2004-07-27 10:06:29.000000000 -0700 @@ -51,7 +51,8 @@ gopts, cmds = getopt.getopt(args, 'tCc:hR:e:d:y', ['help', 'version', 'installroot=', 'exclude=', - 'download-only']) + 'download-only', + 'use-wget', 'wget']) except getopt.error, e: errorlog(0, _('Options Error: %s') % e) usage() @@ -112,12 +113,15 @@ conf.excludes.append(a) if o == '--download-only': conf.downloadonly=1 - - + if o == '--use-wget' or o == '--wget': + conf.usewget="/usr/bin/wget" + if not os.path.exists(conf.usewget): conf.usewget = "" + + except ValueError, e: errorlog(0, _('Options Error: %s') % e) usage() - + # if we're below 2 on the debug level we don't need to be outputting # progress bars - this is hacky - I'm open to other options if conf.debuglevel < 2: