From 5eb169bb6a83cb8827880290dbc727ef57fed4b7 Mon Sep 17 00:00:00 2001 From: Joshua Lock Date: Thu, 25 Mar 2010 16:13:29 +0000 Subject: python-urlgrabber: Update to 3.9.1 with extra patches from Fedora Add a couple of extra patches from Fedora to make the latest createrepo package work. Signed-off-by: Joshua Lock --- .../python/python-urlgrabber-native_3.1.0.bb | 7 - .../python/python-urlgrabber-native_3.9.1.bb | 7 + .../urlgrabber-3.0.0-cleanup.patch | 28 ++++ .../python/python-urlgrabber/urlgrabber-HEAD.patch | 142 +++++++++++++++++++++ .../python-urlgrabber/urlgrabber-reset.patch | 15 +++ meta/packages/python/python-urlgrabber_3.1.0.bb | 11 -- meta/packages/python/python-urlgrabber_3.9.1.bb | 16 +++ 7 files changed, 208 insertions(+), 18 deletions(-) delete mode 100644 meta/packages/python/python-urlgrabber-native_3.1.0.bb create mode 100644 meta/packages/python/python-urlgrabber-native_3.9.1.bb create mode 100644 meta/packages/python/python-urlgrabber/urlgrabber-3.0.0-cleanup.patch create mode 100644 meta/packages/python/python-urlgrabber/urlgrabber-HEAD.patch create mode 100644 meta/packages/python/python-urlgrabber/urlgrabber-reset.patch delete mode 100644 meta/packages/python/python-urlgrabber_3.1.0.bb create mode 100644 meta/packages/python/python-urlgrabber_3.9.1.bb (limited to 'meta/packages') diff --git a/meta/packages/python/python-urlgrabber-native_3.1.0.bb b/meta/packages/python/python-urlgrabber-native_3.1.0.bb deleted file mode 100644 index 353fd65307..0000000000 --- a/meta/packages/python/python-urlgrabber-native_3.1.0.bb +++ /dev/null @@ -1,7 +0,0 @@ -require python-urlgrabber_${PV}.bb -inherit native -DEPENDS = "python-native" -RDEPENDS = "" - -NATIVE_INSTALL_WORKS = "1" - diff --git a/meta/packages/python/python-urlgrabber-native_3.9.1.bb b/meta/packages/python/python-urlgrabber-native_3.9.1.bb new file mode 100644 index 0000000000..61c0f60d80 --- /dev/null +++ b/meta/packages/python/python-urlgrabber-native_3.9.1.bb @@ -0,0 +1,7 @@ +require python-urlgrabber_${PV}.bb +inherit native +DEPENDS = "python-native python-pycurl-native" +RDEPENDS = "" + +NATIVE_INSTALL_WORKS = "1" + diff --git a/meta/packages/python/python-urlgrabber/urlgrabber-3.0.0-cleanup.patch b/meta/packages/python/python-urlgrabber/urlgrabber-3.0.0-cleanup.patch new file mode 100644 index 0000000000..7a1ee059d1 --- /dev/null +++ b/meta/packages/python/python-urlgrabber/urlgrabber-3.0.0-cleanup.patch @@ -0,0 +1,28 @@ +diff -up urlgrabber-3.0.0/urlgrabber/grabber.py.cleanup urlgrabber-3.0.0/urlgrabber/grabber.py +--- urlgrabber-3.0.0/urlgrabber/grabber.py.cleanup 2007-11-29 10:25:13.000000000 +0000 ++++ urlgrabber-3.0.0/urlgrabber/grabber.py 2007-11-29 10:26:15.000000000 +0000 +@@ -1204,16 +1204,18 @@ class URLGrabberFileObject: + bs = 1024*8 + size = 0 + +- if amount is not None: bs = min(bs, amount - size) +- block = self.read(bs) +- size = size + len(block) +- while block: +- new_fo.write(block) ++ try: + if amount is not None: bs = min(bs, amount - size) + block = self.read(bs) + size = size + len(block) ++ while block: ++ new_fo.write(block) ++ if amount is not None: bs = min(bs, amount - size) ++ block = self.read(bs) ++ size = size + len(block) ++ finally: ++ new_fo.close() + +- new_fo.close() + try: + modified_tuple = self.hdr.getdate_tz('last-modified') + modified_stamp = rfc822.mktime_tz(modified_tuple) diff --git a/meta/packages/python/python-urlgrabber/urlgrabber-HEAD.patch b/meta/packages/python/python-urlgrabber/urlgrabber-HEAD.patch new file mode 100644 index 0000000000..90180d29a0 --- /dev/null +++ b/meta/packages/python/python-urlgrabber/urlgrabber-HEAD.patch @@ -0,0 +1,142 @@ +diff --git a/urlgrabber/grabber.py b/urlgrabber/grabber.py +index e090e90..a26880c 100644 +--- a/urlgrabber/grabber.py ++++ b/urlgrabber/grabber.py +@@ -439,6 +439,12 @@ try: + except: + __version__ = '???' + ++try: ++ # this part isn't going to do much - need to talk to gettext ++ from i18n import _ ++except ImportError, msg: ++ def _(st): return st ++ + ######################################################################## + # functions for debugging output. These functions are here because they + # are also part of the module initialization. +@@ -1052,7 +1058,8 @@ class PyCurlFileObject(): + self._reget_length = 0 + self._prog_running = False + self._error = (None, None) +- self.size = None ++ self.size = 0 ++ self._hdr_ended = False + self._do_open() + + +@@ -1085,9 +1092,14 @@ class PyCurlFileObject(): + return -1 + + def _hdr_retrieve(self, buf): ++ if self._hdr_ended: ++ self._hdr_dump = '' ++ self.size = 0 ++ self._hdr_ended = False ++ + if self._over_max_size(cur=len(self._hdr_dump), + max_size=self.opts.max_header_size): +- return -1 ++ return -1 + try: + self._hdr_dump += buf + # we have to get the size before we do the progress obj start +@@ -1104,7 +1116,17 @@ class PyCurlFileObject(): + s = parse150(buf) + if s: + self.size = int(s) +- ++ ++ if buf.lower().find('location') != -1: ++ location = ':'.join(buf.split(':')[1:]) ++ location = location.strip() ++ self.scheme = urlparse.urlsplit(location)[0] ++ self.url = location ++ ++ if len(self._hdr_dump) != 0 and buf == '\r\n': ++ self._hdr_ended = True ++ if DEBUG: DEBUG.info('header ended:') ++ + return len(buf) + except KeyboardInterrupt: + return pycurl.READFUNC_ABORT +@@ -1136,6 +1158,7 @@ class PyCurlFileObject(): + self.curl_obj.setopt(pycurl.PROGRESSFUNCTION, self._progress_update) + self.curl_obj.setopt(pycurl.FAILONERROR, True) + self.curl_obj.setopt(pycurl.OPT_FILETIME, True) ++ self.curl_obj.setopt(pycurl.FOLLOWLOCATION, True) + + if DEBUG: + self.curl_obj.setopt(pycurl.VERBOSE, True) +@@ -1291,7 +1314,12 @@ class PyCurlFileObject(): + raise err + + elif str(e.args[1]) == '' and self.http_code != 0: # fake it until you make it +- msg = 'HTTP Error %s : %s ' % (self.http_code, self.url) ++ if self.scheme in ['http', 'https']: ++ msg = 'HTTP Error %s : %s ' % (self.http_code, self.url) ++ elif self.scheme in ['ftp']: ++ msg = 'FTP Error %s : %s ' % (self.http_code, self.url) ++ else: ++ msg = "Unknown Error: URL=%s , scheme=%s" % (self.url, self.scheme) + else: + msg = 'PYCURL ERROR %s - "%s"' % (errcode, str(e.args[1])) + code = errcode +@@ -1299,6 +1327,12 @@ class PyCurlFileObject(): + err.code = code + err.exception = e + raise err ++ else: ++ if self._error[1]: ++ msg = self._error[1] ++ err = URLGRabError(14, msg) ++ err.url = self.url ++ raise err + + def _do_open(self): + self.curl_obj = _curl_cache +@@ -1532,11 +1566,14 @@ class PyCurlFileObject(): + def _over_max_size(self, cur, max_size=None): + + if not max_size: +- max_size = self.size +- if self.opts.size: # if we set an opts size use that, no matter what +- max_size = self.opts.size ++ if not self.opts.size: ++ max_size = self.size ++ else: ++ max_size = self.opts.size ++ + if not max_size: return False # if we have None for all of the Max then this is dumb +- if cur > max_size + max_size*.10: ++ ++ if cur > int(float(max_size) * 1.10): + + msg = _("Downloaded more than max size for %s: %s > %s") \ + % (self.url, cur, max_size) +@@ -1582,7 +1619,11 @@ class PyCurlFileObject(): + self.opts.progress_obj.end(self._amount_read) + self.fo.close() + +- ++ def geturl(self): ++ """ Provide the geturl() method, used to be got from ++ urllib.addinfourl, via. urllib.URLopener.* """ ++ return self.url ++ + _curl_cache = pycurl.Curl() # make one and reuse it over and over and over + + +diff --git a/urlgrabber/progress.py b/urlgrabber/progress.py +index dd07c6a..45eb248 100644 +--- a/urlgrabber/progress.py ++++ b/urlgrabber/progress.py +@@ -658,6 +658,8 @@ def format_time(seconds, use_hours=0): + if seconds is None or seconds < 0: + if use_hours: return '--:--:--' + else: return '--:--' ++ elif seconds == float('inf'): ++ return 'Infinite' + else: + seconds = int(seconds) + minutes = seconds / 60 diff --git a/meta/packages/python/python-urlgrabber/urlgrabber-reset.patch b/meta/packages/python/python-urlgrabber/urlgrabber-reset.patch new file mode 100644 index 0000000000..b63e7c33ac --- /dev/null +++ b/meta/packages/python/python-urlgrabber/urlgrabber-reset.patch @@ -0,0 +1,15 @@ +--- a/urlgrabber/grabber.py 2010-02-19 14:50:45.000000000 -0500 ++++ b/urlgrabber/grabber.py 2010-02-19 14:51:28.000000000 -0500 +@@ -1626,6 +1626,12 @@ + + _curl_cache = pycurl.Curl() # make one and reuse it over and over and over + ++def reset_curl_obj(): ++ """To make sure curl has reread the network/dns info we force a reload""" ++ global _curl_cache ++ _curl_cache.close() ++ _curl_cache = pycurl.Curl() ++ + + ##################################################################### + # DEPRECATED FUNCTIONS diff --git a/meta/packages/python/python-urlgrabber_3.1.0.bb b/meta/packages/python/python-urlgrabber_3.1.0.bb deleted file mode 100644 index a8ccf8ae57..0000000000 --- a/meta/packages/python/python-urlgrabber_3.1.0.bb +++ /dev/null @@ -1,11 +0,0 @@ -DESCRIPTION = "urlgrabber is a pure python package that drastically simplifies the fetching of files." -HOMEPAGE = "http://linux.duke.edu/projects/urlgrabber/" -SECTION = "devel/python" -PRIORITY = "optional" -LICENSE = "GPL" -PR = "r0" - -SRC_URI = "http://linux.duke.edu/projects/urlgrabber/download/urlgrabber-${PV}.tar.gz" -S = "${WORKDIR}/urlgrabber-${PV}" - -inherit distutils diff --git a/meta/packages/python/python-urlgrabber_3.9.1.bb b/meta/packages/python/python-urlgrabber_3.9.1.bb new file mode 100644 index 0000000000..9f3a4cc6a7 --- /dev/null +++ b/meta/packages/python/python-urlgrabber_3.9.1.bb @@ -0,0 +1,16 @@ +DESCRIPTION = "urlgrabber is a pure python package that drastically simplifies the fetching of files." + +HOMEPAGE = "http://urlgrabber.baseurl.org/" +SECTION = "devel/python" +PRIORITY = "optional" +LICENSE = "GPL" +PR = "r1" + +SRC_URI = "http://urlgrabber.baseurl.org/download/urlgrabber-${PV}.tar.gz \ + file://urlgrabber-HEAD.patch;patch=1 \ + file://urlgrabber-reset.patch;patch=1" +S = "${WORKDIR}/urlgrabber-${PV}" + +DEPENDS = "python-pycurl" + +inherit distutils \ No newline at end of file -- cgit v1.2.3