> I think the idea behind both of these patches are ok, but I'm not 100% > sure ... how much/what testing have you done?
Checked that 'yum clean all' + 'yum update' runs fine. (downloads metalinks, repomds, and primary metadata). This does not cover the _getFile() with url != None case, in fact I have never seen that being used.. > This last bit is wrong though, as a bunch of the things passed to > URLGrabber are local variables: Yes, I've later noticed that as well.. kwargs should be moved to self.grabfunc.urlgrab() call, not just removed. Fixed that. Zdenek
From ee1f80ee722b03804ec98781eda42d08fd1b4775 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zden=C4=9Bk=20Pavlas?= <zpav...@redhat.com> Date: Thu, 15 Sep 2011 17:18:39 +0200 Subject: [PATCH] getMetalink, getFile: Use grabfunc getMetalink and getFile (with absolute url) create a function local URLGrabber instance. This didn't work with 3rd party plugins that override .grab and .grabfunc with custom objects. --- yum/yumRepo.py | 31 +++++++++++++------------------ 1 files changed, 13 insertions(+), 18 deletions(-) diff --git a/yum/yumRepo.py b/yum/yumRepo.py index 8ef14a4..a71fce1 100644 --- a/yum/yumRepo.py +++ b/yum/yumRepo.py @@ -714,10 +714,8 @@ class YumRepository(Repository, config.RepoConf): local = self.metalink_filename + '.tmp' if not self._metalinkCurrent(): url = misc.to_utf8(self.metalink) - ugopts = self._default_grabopts() try: - ug = URLGrabber(progress_obj = self.callback, **ugopts) - result = ug.urlgrab(url, local, text=self.id + "/metalink") + result = self.grabfunc.urlgrab(url, local, text=self.id + "/metalink") except urlgrabber.grabber.URLGrabError, e: if not os.path.exists(self.metalink_filename): @@ -806,24 +804,21 @@ Insufficient space in download directory %s * needed %s''' ) % (os.path.dirname(local), format_number(avail), format_number(long(size))) + print 'XXX', url, relative if url and scheme != "media": - ugopts = self._default_grabopts(cache=cache) - ug = URLGrabber(progress_obj = self.callback, - copy_local = copy_local, - reget = reget, - failure_callback = self.failure_obj, - interrupt_callback=self.interrupt_callback, - checkfunc=checkfunc, - size=size, - **ugopts) - remote = url + '/' + relative - try: - result = ug.urlgrab(misc.to_utf8(remote), local, - text=misc.to_utf8(text), - range=(start, end), - ) + result = self.grabfunc.urlgrab( + misc.to_utf8(remote), local, + text=misc.to_utf8(text), + range=(start, end), + cache=cache, + copy_local=copy_local, + reget=reget, + checkfunc=checkfunc, + size=size, + ) + except URLGrabError, e: errstr = "failed to retrieve %s from %s\nerror was %s" % (relative, self.id, e) if self.mirrorurls: -- 1.7.4.4
_______________________________________________ Yum-devel mailing list Yum-devel@lists.baseurl.org http://lists.baseurl.org/mailman/listinfo/yum-devel