diff options
author | Christian Ruppert <idl0r@gentoo.org> | 2010-08-01 20:12:24 +0000 |
---|---|---|
committer | Christian Ruppert <idl0r@gentoo.org> | 2010-08-01 20:12:24 +0000 |
commit | fa9947e055e91b94bb1cbe9b74f3c793c7efca6d (patch) | |
tree | 9b4c6c81c0cfceb2a3d03e8390ac3846e9a42f73 | |
parent | x86 stable wrt bug #330703 (diff) | |
download | gentoo-2-fa9947e055e91b94bb1cbe9b74f3c793c7efca6d.tar.gz gentoo-2-fa9947e055e91b94bb1cbe9b74f3c793c7efca6d.tar.bz2 gentoo-2-fa9947e055e91b94bb1cbe9b74f3c793c7efca6d.zip |
Check for a valid mirrorselect-test file, fixes bug 330611, thanks to Soren Harward <stharward@gmail.com>.
(Portage version: 2.2_rc67/cvs/Linux x86_64)
3 files changed, 141 insertions, 1 deletions
diff --git a/app-portage/mirrorselect/ChangeLog b/app-portage/mirrorselect/ChangeLog index 6c991eef2421..0fc3baa28487 100644 --- a/app-portage/mirrorselect/ChangeLog +++ b/app-portage/mirrorselect/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for app-portage/mirrorselect # Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/app-portage/mirrorselect/ChangeLog,v 1.95 2010/05/08 15:01:00 armin76 Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-portage/mirrorselect/ChangeLog,v 1.96 2010/08/01 20:12:24 idl0r Exp $ + +*mirrorselect-2.1.0-r2 (01 Aug 2010) + + 01 Aug 2010; Christian Ruppert <idl0r@gentoo.org> + +files/0002-Check-for-a-valid-mirrorselect-test-file.patch, + +mirrorselect-2.1.0-r2.ebuild: + Check for a valid mirrorselect-test file, fixes bug 330611, thanks to + Soren Harward <stharward@gmail.com>. 08 May 2010; Raúl Porcel <armin76@gentoo.org> mirrorselect-2.1.0-r1.ebuild: diff --git a/app-portage/mirrorselect/files/0002-Check-for-a-valid-mirrorselect-test-file.patch b/app-portage/mirrorselect/files/0002-Check-for-a-valid-mirrorselect-test-file.patch new file mode 100644 index 000000000000..864aaa7aa03d --- /dev/null +++ b/app-portage/mirrorselect/files/0002-Check-for-a-valid-mirrorselect-test-file.patch @@ -0,0 +1,82 @@ +From 88521c86907819486e0e18bffcb1674ae180341e Mon Sep 17 00:00:00 2001 +From: Christian Ruppert <idl0r@gentoo.org> +Date: Sun, 1 Aug 2010 21:35:11 +0200 +Subject: [PATCH] Check for a valid mirrorselect-test file, fixes bug 330611, thanks to Soren Harward <stharward@gmail.com>. + +--- + main.py | 17 +++++++---------- + 1 files changed, 7 insertions(+), 10 deletions(-) + +diff --git a/main.py b/main.py +index dd3386e..f5f35be 100755 +--- a/main.py ++++ b/main.py +@@ -36,6 +36,7 @@ import sys + import time + import urllib + import urlparse ++import hashlib + from optparse import IndentedHelpFormatter, OptionParser + from mirrorselect.mirrorparser3 import MirrorParser3, MIRRORS_3_XML, MIRRORS_RSYNC_DATA + import codecs +@@ -336,8 +337,6 @@ class Shallow(object): + class Deep(object): + """handles deep mode mirror selection.""" + +- _bufsize = 4096 +- + def __init__(self, hosts, options): + self.urls = [] + self._hosts = hosts +@@ -457,10 +456,9 @@ class Deep(object): + + for ip in ips: + try: +- ip_url = url.replace(url_parts.hostname, ip, 1) + try: + signal.alarm(self._connect_timeout) +- f = urllib.urlopen(ip_url) ++ f = urllib.urlopen(url) + break + finally: + signal.alarm(0) +@@ -480,14 +478,12 @@ class Deep(object): + return (None, True) + + try: +- + # Close the initial "wake up" connection. + try: + signal.alarm(self._connect_timeout) + f.close() + finally: + signal.alarm(0) +- + except EnvironmentError, e: + output.write(('deeptime(): close connection to host %s ' + \ + 'failed for ip %s: %s\n') % \ +@@ -498,16 +494,17 @@ class Deep(object): + (url_parts.hostname, ip), 2) + + try: +- + # The first connection serves to "wake up" the route between + # the local and remote machines. A second connection is used + # for the timed run. + try: + signal.alarm(int(math.ceil(maxtime))) + stime = time.time() +- f = urllib.urlopen(ip_url) +- while f.read(self._bufsize): +- pass ++ f = urllib.urlopen(url) ++ ++ if hashlib.md5(f.read()).hexdigest() != "bdf077b2e683c506bf9e8f2494eeb044": ++ return (None, True) ++ + delta = time.time() - stime + f.close() + finally: +-- +1.7.1 + diff --git a/app-portage/mirrorselect/mirrorselect-2.1.0-r2.ebuild b/app-portage/mirrorselect/mirrorselect-2.1.0-r2.ebuild new file mode 100644 index 000000000000..3a04c512b25e --- /dev/null +++ b/app-portage/mirrorselect/mirrorselect-2.1.0-r2.ebuild @@ -0,0 +1,50 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-portage/mirrorselect/mirrorselect-2.1.0-r2.ebuild,v 1.1 2010/08/01 20:12:24 idl0r Exp $ + +EAPI="2" +SUPPORT_PYTHON_ABIS="1" + +inherit eutils python + +DESCRIPTION="Tool to help select distfiles mirrors for Gentoo" +HOMEPAGE="http://www.gentoo.org/" +SRC_URI="mirror://gentoo/${P}.tar.bz2" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd" +IUSE="" + +RDEPEND="dev-lang/python[xml] + dev-util/dialog + net-analyzer/netselect" + +RESTRICT_PYTHON_ABIS="3*" + +src_prepare() { + # bug 312753 + epatch "${FILESDIR}/0001-Fix-rsync-mirror-selectection.patch" + # bug 330611 + epatch "${FILESDIR}/0002-Check-for-a-valid-mirrorselect-test-file.patch" +} + +src_install() { + newsbin main.py ${PN} || die + + installation() { + insinto $(python_get_sitedir) + doins -r ${PN}/ + } + python_execute_function installation + + doman ${PN}.8 || die +} + +pkg_postinst() { + python_mod_optimize ${PN} +} + +pkg_postrm() { + python_mod_cleanup ${PN} +} |