[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: 55402ec0df846a42dba44c295b5761a770724ce8 Author: Michał Górny gentoo org> AuthorDate: Mon May 27 18:47:13 2024 + Commit: Sam James gentoo org> CommitDate: Tue May 28 03:48:00 2024 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=55402ec0 extractor.py: Replace sslfetch with plain requests sslfetch was a thin NIH wrapper around requests, and it is unmaintained. Closes: https://bugs.gentoo.org/932145 Signed-off-by: Michał Górny gentoo.org> Closes: https://github.com/gentoo/mirrorselect/pull/1 Signed-off-by: Sam James gentoo.org> mirrorselect/extractor.py | 26 ++ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/mirrorselect/extractor.py b/mirrorselect/extractor.py index 4598b8b..7326c86 100644 --- a/mirrorselect/extractor.py +++ b/mirrorselect/extractor.py @@ -27,8 +27,9 @@ Distributed under the terms of the GNU General Public License v2 import os +import requests + from mirrorselect.mirrorparser3 import MirrorParser3 -from sslfetch.connections import Connector from mirrorselect.version import version USERAGENT = "Mirrorselect-" + version @@ -103,21 +104,14 @@ class Extractor: self.output.print_info("Downloading a list of mirrors...\n") -# setup the ssl-fetch ouptut map -connector_output = { -"info": self.output.write, -"debug": self.output.write, -"error": self.output.print_err, -"kwargs-info": {"level": 2}, -"kwargs-debug": {"level": 2}, -"kwargs-error": {"level": 0}, -} - -fetcher = Connector(connector_output, self.proxies, USERAGENT) -success, mirrorlist, timestamp = fetcher.fetch_content(url, climit=60) -parser.parse(mirrorlist) - -if (not mirrorlist) or len(parser.tuples()) == 0: +response = requests.get(url, +timeout=60, +proxies=self.proxies, +headers={"User-Agent": USERAGENT}) +if response: +parser.parse(response.text) + +if len(parser.tuples()) == 0: self.output.print_err( "Could not get mirror list. " "Check your internet connection." )
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: 1c44e110a44341f72ea056132dcaf3c4bfff9273 Author: Sam James gentoo org> AuthorDate: Mon Aug 7 00:21:20 2023 + Commit: Sam James gentoo org> CommitDate: Mon Aug 7 00:21:20 2023 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=1c44e110 Rerun `autopep8` with `--aggressive Signed-off-by: Sam James gentoo.org> mirrorselect/configs.py | 4 ++-- mirrorselect/output.py| 2 +- mirrorselect/selectors.py | 15 +-- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/mirrorselect/configs.py b/mirrorselect/configs.py index 39dcdab..c7935d7 100644 --- a/mirrorselect/configs.py +++ b/mirrorselect/configs.py @@ -164,7 +164,7 @@ def get_filesystem_mirrors(output, config_path): lex.wordchars = string.digits + letters + r"~!@#$%*_\:;?,./-+{}" lex.quotes = "\"'" p = re.compile("rsync://|http://|https://|ftp://";, re.IGNORECASE) -while 1: +while True: key = get_token(lex) # output.write('get_filesystem_mirrors(): processing key = %s\n' % key, 2) @@ -181,7 +181,7 @@ def get_filesystem_mirrors(output, config_path): mirrorlist = val.rsplit() output.write("get_filesystem_mirrors(): mirrorlist = %s\n" % mirrorlist, 2) for mirror in mirrorlist: -if p.match(mirror) == None: +if p.match(mirror) is None: if os.access(mirror, os.F_OK): output.write( "get_filesystem_mirrors(): found file system mirror = %s\n" diff --git a/mirrorselect/output.py b/mirrorselect/output.py index 8b33cff..87a83b2 100644 --- a/mirrorselect/output.py +++ b/mirrorselect/output.py @@ -53,7 +53,7 @@ def decode_selection(selection): def get_encoding(output): -if hasattr(output, "encoding") and output.encoding != None: +if hasattr(output, "encoding") and output.encoding is not None: return output.encoding else: encoding = locale.getpreferredencoding() diff --git a/mirrorselect/selectors.py b/mirrorselect/selectors.py index 60956d4..7f9fddb 100644 --- a/mirrorselect/selectors.py +++ b/mirrorselect/selectors.py @@ -168,8 +168,7 @@ class Shallow: % (number, block_size, block_index, len(host_blocks)) ) -host_ranking_keys = list(ret_hosts.keys()) -host_ranking_keys.sort() +host_ranking_keys = sorted(ret_hosts.keys()) for rank in host_ranking_keys[:number]: top_hosts.append(ret_hosts[rank]) @@ -283,8 +282,7 @@ class Deep: # can't just return the dict.values, # because we want the fastest mirror first... -keys = list(top_hosts.keys()) -keys.sort() +keys = sorted(top_hosts.keys()) rethosts = [] for key in keys: @@ -521,8 +519,7 @@ class Deep: ) host_dict.update(dict([time_host])) -times = list(host_dict.keys()) -times.sort() +times = sorted(host_dict.keys()) else: # We need to make room in the dict before we add. Kill the slowest. self.output.write( @@ -530,14 +527,12 @@ class Deep: % (time_host[1], time_host[0]), 2, ) -times = list(host_dict.keys()) -times.sort() +times = sorted(host_dict.keys()) self.output.write("_list_add(): removing %s\n" % host_dict[times[-1]], 2) del host_dict[times[-1]] host_dict.update(dict([time_host])) # done adding. now return the appropriate time -times = list(host_dict.keys()) -times.sort() +times = sorted(host_dict.keys()) if len(host_dict) < maxlen: # check again to choose new timeout self.output.write(
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: 816c1882de41dcf4a2fc65e455f95f8d8197883e Author: Sam James gentoo org> AuthorDate: Mon Aug 7 00:09:58 2023 + Commit: Sam James gentoo org> CommitDate: Mon Aug 7 00:12:28 2023 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=816c1882 Run `autopep8` Signed-off-by: Sam James gentoo.org> mirrorselect/mirrorparser3.py | 4 +++- mirrorselect/selectors.py | 17 - 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/mirrorselect/mirrorparser3.py b/mirrorselect/mirrorparser3.py index 37245ff..3e32880 100644 --- a/mirrorselect/mirrorparser3.py +++ b/mirrorselect/mirrorparser3.py @@ -86,7 +86,9 @@ class MirrorParser3: if __name__ == "__main__": import sys -import urllib.request, urllib.parse, urllib.error +import urllib.request +import urllib.parse +import urllib.error parser = MirrorParser3() parser.parse(urllib.request.urlopen(MIRRORS_3_XML).read()) diff --git a/mirrorselect/selectors.py b/mirrorselect/selectors.py index 4ec4474..60956d4 100644 --- a/mirrorselect/selectors.py +++ b/mirrorselect/selectors.py @@ -27,6 +27,8 @@ Distributed under the terms of the GNU General Public License v2 """ +from mirrorselect.output import encoder, get_encoding, decode_selection +import http.client import math import signal import socket @@ -36,16 +38,15 @@ import sys import time import hashlib -import urllib.request, urllib.parse, urllib.error +import urllib.request +import urllib.parse +import urllib.error url_parse = urllib.parse.urlparse url_unparse = urllib.parse.urlunparse url_open = urllib.request.urlopen url_request = urllib.request.Request HTTPError = urllib.error.HTTPError -import http.client - -from mirrorselect.output import encoder, get_encoding, decode_selection # The netselect --ipv4 and --ipv6 options are supported only @@ -251,7 +252,6 @@ class Deep: self.dl_failures = 0 for host in hosts: - prog += 1 if self.test_file != "mirrorselect-test": self.output.print_info( @@ -289,7 +289,7 @@ class Deep: rethosts = [] for key in keys: # self.output.write('deeptest(): adding rethost ' -#'%s, %s' % (key, top_hosts[key]), 2) +# '%s, %s' % (key, top_hosts[key]), 2) rethosts.append(top_hosts[key]) self.output.write("deeptest(): final rethost %s\n" % (rethosts), 2) @@ -514,7 +514,6 @@ class Deep: or the slowest host. """ if len(host_dict) < maxlen: # still have room, and host is fast. add it. - self.output.write( "_list_add(): added host %s. with a time of %s\n" % (time_host[1], time_host[0]), @@ -609,7 +608,7 @@ class Interactive: dialog.extend(["20", "110", "14"]) -for (url, args) in sorted( +for url, args in sorted( hosts, key=lambda x: (x[1]["country"].lower(), x[1]["name"].lower()) ): marker = "" @@ -623,7 +622,7 @@ class Interactive: continue # dialog.append('"%s" "%s%s: %s" "OFF"' -#% ( url, marker, args['country'], args['name'])) +# % ( url, marker, args['country'], args['name'])) dialog.extend( [ "%s" % url,
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: 1c6189be723e5048737f45cf531e35ec8725b727 Author: Sam James gentoo org> AuthorDate: Mon Aug 7 00:01:10 2023 + Commit: Sam James gentoo org> CommitDate: Mon Aug 7 00:04:33 2023 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=1c6189be Drop Python 2 support Signed-off-by: Sam James gentoo.org> mirrorselect/mirrorparser3.py | 15 +-- mirrorselect/selectors.py | 27 +++ 2 files changed, 12 insertions(+), 30 deletions(-) diff --git a/mirrorselect/mirrorparser3.py b/mirrorselect/mirrorparser3.py index f89c61e..133420a 100644 --- a/mirrorselect/mirrorparser3.py +++ b/mirrorselect/mirrorparser3.py @@ -1,9 +1,9 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """Mirrorselect 2.x Tool for selecting Gentoo source and rsync mirrors. -Copyright 2009-2012 Gentoo Foundation +Copyright 2009-2023 Gentoo Authors Copyright (C) 2009 Sebastian Pipping Copyright (C) 2009 Christian Ruppert @@ -81,14 +81,9 @@ class MirrorParser3: if __name__ == '__main__': import sys - if sys.version_info[0] >= 3: - import urllib.request, urllib.parse, urllib.error - parser = MirrorParser3() - parser.parse(urllib.request.urlopen(MIRRORS_3_XML).read()) - else: - import urllib - parser = MirrorParser3() - parser.parse(urllib.urlopen(MIRRORS_3_XML).read()) + import urllib.request, urllib.parse, urllib.error + parser = MirrorParser3() + parser.parse(urllib.request.urlopen(MIRRORS_3_XML).read()) print('= tuples') print(parser.tuples()) print('= uris') diff --git a/mirrorselect/selectors.py b/mirrorselect/selectors.py index a17a646..df66cc4 100644 --- a/mirrorselect/selectors.py +++ b/mirrorselect/selectors.py @@ -37,26 +37,13 @@ import sys import time import hashlib -if sys.version_info[0] >= 3: - import urllib.request, urllib.parse, urllib.error - url_parse = urllib.parse.urlparse - url_unparse = urllib.parse.urlunparse - url_open = urllib.request.urlopen - url_request = urllib.request.Request - HTTPError = urllib.error.HTTPError - import http.client - IncompleteRead = http.client.IncompleteRead -else: - import urllib2 - import urlparse - url_parse = urlparse.urlparse - url_unparse = urlparse.urlunparse - url_open = urllib2.urlopen - url_request = urllib2.Request - HTTPError = urllib2.HTTPError - import httplib - IncompleteRead = httplib.IncompleteRead - +import urllib.request, urllib.parse, urllib.error +url_parse = urllib.parse.urlparse +url_unparse = urllib.parse.urlunparse +url_open = urllib.request.urlopen +url_request = urllib.request.Request +HTTPError = urllib.error.HTTPError +import http.client from mirrorselect.output import encoder, get_encoding, decode_selection
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/, bin/, /
commit: 69f8aa0ea5bd6744e509251b8d9e150bf62b00ad Author: Sam James gentoo org> AuthorDate: Mon Aug 7 00:02:35 2023 + Commit: Sam James gentoo org> CommitDate: Mon Aug 7 00:04:33 2023 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=69f8aa0e Modernise shebang Signed-off-by: Sam James gentoo.org> bin/mirrorselect | 5 ++--- mirrorselect/main.py | 5 ++--- mirrorselect/output.py| 4 ++-- mirrorselect/selectors.py | 5 ++--- mirrorselect/version.py | 6 ++ setup.py | 4 +--- 6 files changed, 11 insertions(+), 18 deletions(-) diff --git a/bin/mirrorselect b/bin/mirrorselect index 3474935..7f019e3 100755 --- a/bin/mirrorselect +++ b/bin/mirrorselect @@ -1,10 +1,9 @@ -#!/usr/bin/env python - +#!/usr/bin/env python3 """Mirrorselect 2.x Tool for selecting Gentoo source and rsync mirrors. -Copyright 2005-2012 Gentoo Foundation +Copyright 2005-2023 Gentoo Authors Copyright (C) 2005 Colin Kingsley Copyright (C) 2008 Zac Medico diff --git a/mirrorselect/main.py b/mirrorselect/main.py index 21f7e24..f003b8c 100755 --- a/mirrorselect/main.py +++ b/mirrorselect/main.py @@ -1,10 +1,9 @@ -#!/usr/bin/env python - +#!/usr/bin/env python3 """Mirrorselect 2.x Tool for selecting Gentoo source and rsync mirrors. -Copyright 2005-2012 Gentoo Foundation +Copyright 2005-2023 Gentoo Authors Copyright (C) 2005 Colin Kingsley Copyright (C) 2008 Zac Medico diff --git a/mirrorselect/output.py b/mirrorselect/output.py index c2fdd12..aa679cb 100644 --- a/mirrorselect/output.py +++ b/mirrorselect/output.py @@ -1,9 +1,9 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """Mirrorselect 2.x Tool for selecting Gentoo source and rsync mirrors. -Copyright 2005-2012 Gentoo Foundation +Copyright 2005-2023 Gentoo Authors Copyright (C) 2005 Colin Kingsley Copyright (C) 2008 Zac Medico diff --git a/mirrorselect/selectors.py b/mirrorselect/selectors.py index df66cc4..9647e56 100644 --- a/mirrorselect/selectors.py +++ b/mirrorselect/selectors.py @@ -1,10 +1,9 @@ -#!/usr/bin/env python -#-*- coding:utf-8 -*- +#!/usr/bin/env python3 """Mirrorselect 2.x Tool for selecting Gentoo source and rsync mirrors. -Copyright 2005-2012 Gentoo Foundation +Copyright 2005-2023 Gentoo Authors Copyright (C) 2005 Colin Kingsley Copyright (C) 2008 Zac Medico diff --git a/mirrorselect/version.py b/mirrorselect/version.py index c8216df..dadd00b 100644 --- a/mirrorselect/version.py +++ b/mirrorselect/version.py @@ -1,11 +1,9 @@ -#!/usr/bin/env python -#-*- coding:utf-8 -*- - +#!/usr/bin/env python3 """Mirrorselect 2.x Tool for selecting Gentoo source and rsync mirrors. -Copyright 2012-2019 Gentoo Authors +Copyright 2012-2023 Gentoo Authors Copyright (C) 2012 Brian Dolbec diff --git a/setup.py b/setup.py index 3c701a1..770d93d 100755 --- a/setup.py +++ b/setup.py @@ -1,6 +1,4 @@ -#!/usr/bin/env python -# coding: utf-8 - +#!/usr/bin/env python3 import logging import re
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: 1a2eb56c27f0b1c284a13400fa9ee864575e8ba1 Author: Sam James gentoo org> AuthorDate: Mon Aug 7 00:01:45 2023 + Commit: Sam James gentoo org> CommitDate: Mon Aug 7 00:04:33 2023 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=1a2eb56c Drop old URLs Signed-off-by: Sam James gentoo.org> mirrorselect/mirrorparser3.py | 5 - 1 file changed, 5 deletions(-) diff --git a/mirrorselect/mirrorparser3.py b/mirrorselect/mirrorparser3.py index 133420a..4023973 100644 --- a/mirrorselect/mirrorparser3.py +++ b/mirrorselect/mirrorparser3.py @@ -28,11 +28,6 @@ Distributed under the terms of the GNU General Public License v2 from xml.etree import ElementTree as ET -# old url's -#MIRRORS_3_XML = 'http://www.gentoo.org/main/en/mirrors3.xml' -#MIRRORS_RSYNC_DATA = 'http://www.gentoo.org/main/en/mirrors-rsync-data.xml' - -# new urls MIRRORS_3_XML = 'https://api.gentoo.org/mirrors/distfiles.xml' MIRRORS_RSYNC_DATA = 'https://api.gentoo.org/mirrors/rsync.xml'
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: ac250b126b8de24276cd4e9bdc4afab14a9c41e7 Author: Sam James gentoo org> AuthorDate: Sun Aug 6 23:29:25 2023 + Commit: Sam James gentoo org> CommitDate: Sun Aug 6 23:29:42 2023 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=ac250b12 extractor.py: cleanup py2 compat Bug: https://bugs.gentoo.org/911183 Signed-off-by: Sam James gentoo.org> mirrorselect/mirrorparser3.py | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/mirrorselect/mirrorparser3.py b/mirrorselect/mirrorparser3.py index 444bc11..9bca3e9 100644 --- a/mirrorselect/mirrorparser3.py +++ b/mirrorselect/mirrorparser3.py @@ -48,13 +48,8 @@ class MirrorParser3: if not uri: # Don't parse if empty return None; try: - import sys; - if sys.version_info[0] >= 3: - from urllib.parse import urlparse - return urlparse(uri).scheme - else: - from urllib2 import Request - return Request(uri).get_type() + from urllib.parse import urlparse + return urlparse(uri).scheme except Exception as e: # Add general exception to catch errors from mirrorselect.output import Output Output.write(('_get_proto(): Exception while parsing the protocol '
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: fe715a306754a4df2d05a3a24034d015c16377bf Author: Peter Levine gmail com> AuthorDate: Mon Jul 24 22:40:02 2023 + Commit: Sam James gentoo org> CommitDate: Sun Aug 6 23:28:34 2023 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=fe715a30 extractor.py: parse proto from the uri The protocol can be parsed from the URI so we can get rid of the protocol tag altogether. Bug: https://bugs.gentoo.org/911183 Suggested-by: Florian Schmaus gentoo.org> Suggested-by: Sam James gentoo.org> Signed-off-by: Peter Levine gmail.com> Signed-off-by: Sam James gentoo.org> mirrorselect/mirrorparser3.py | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/mirrorselect/mirrorparser3.py b/mirrorselect/mirrorparser3.py index 089f949..444bc11 100644 --- a/mirrorselect/mirrorparser3.py +++ b/mirrorselect/mirrorparser3.py @@ -44,6 +44,22 @@ class MirrorParser3: def _reset(self): self._dict = {} + def _get_proto(self, uri=None): + if not uri: # Don't parse if empty + return None; + try: + import sys; + if sys.version_info[0] >= 3: + from urllib.parse import urlparse + return urlparse(uri).scheme + else: + from urllib2 import Request + return Request(uri).get_type() + except Exception as e: # Add general exception to catch errors + from mirrorselect.output import Output + Output.write(('_get_proto(): Exception while parsing the protocol ' + 'for URI %s: %s\n')% (uri, e), 2) + def parse(self, text): self._reset() for mirrorgroup in ET.XML(text): @@ -60,7 +76,7 @@ class MirrorParser3: "region": mirrorgroup.get("region"), "ipv4": e.get("ipv4"), "ipv6": e.get("ipv6"), - "proto": e.get("protocol"), + "proto": e.get("protocol") or self._get_proto(uri), } def tuples(self):
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: e0fbc2fb33762211aa5e64175d525e66f4c257d4 Author: Sam James gentoo org> AuthorDate: Thu Jul 6 08:04:42 2023 + Commit: Sam James gentoo org> CommitDate: Thu Jul 6 08:04:42 2023 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=e0fbc2fb main: Fix --all option parsing Avoid --all erroring out with "ERROR: Choose at most one of -s or -a". Bug: https://bugs.gentoo.org/872218 Fixes: 7caac017833b01e13028658effc502430c56d770 Thanks-to: gmail.com> Signed-off-by: Sam James gentoo.org> mirrorselect/main.py | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mirrorselect/main.py b/mirrorselect/main.py index 31f8e7b..7780bb7 100755 --- a/mirrorselect/main.py +++ b/mirrorselect/main.py @@ -145,6 +145,11 @@ class MirrorSelect(object): self.output.white(" interactive:"), "# mirrorselect -i -r", )) + + def set_servers(option, opt_str, value, parser): + set_servers.user_configured = True + setattr(parser.values, option.dest, value) + parser = OptionParser( formatter=ColoredFormatter(self.output), description=desc, version='Mirrorselect version: %s' % version) @@ -236,8 +241,8 @@ class MirrorSelect(object): "-q", "--quiet", action="store_const", const=0, dest="verbosity", help="Quiet mode") group.add_option( - "-s", "--servers", action="store", type="int", default=1, - help="Specify Number of servers for Automatic Mode " + "-s", "--servers", action="callback", callback=set_servers, + type="int", default=1, help="Specify Number of servers for Automatic Mode " "to select. this is only valid for download mirrors. " "If this is not specified, a default of 1 is used.") group.add_option( @@ -271,7 +276,7 @@ class MirrorSelect(object): if options.rsync and not (options.interactive or options.all_mirrors): self.output.print_err('rsync servers can only be selected with -i or -a') - if options.servers and options.all_mirrors: + if options.all_mirrors and hasattr(set_servers, 'user_configured'): self.output.print_err('Choose at most one of -s or -a') if options.interactive and (
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/, tests/
commit: a09b4d302e4cee79254d3ff4a5ac9f080b958acf Author: Brian Dolbec gentoo org> AuthorDate: Tue May 31 17:58:14 2022 + Commit: Brian Dolbec gentoo org> CommitDate: Tue May 31 17:58:14 2022 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=a09b4d30 main.py: Add indented backslash capability to multilne GENTOO_MIRRORS For multiple mirrors, use backslashes list additional mirrors with indents for clarity. Gentoo-bug-url: https://bugs.gentoo.org/543814 Signed-off-by: Brian Dolbec gentoo.org> mirrorselect/main.py | 2 +- tests/test_write_make_conf.py | 59 ++- 2 files changed, 37 insertions(+), 24 deletions(-) diff --git a/mirrorselect/main.py b/mirrorselect/main.py old mode 100644 new mode 100755 index 8a3094e..31f8e7b --- a/mirrorselect/main.py +++ b/mirrorselect/main.py @@ -109,7 +109,7 @@ class MirrorSelect(object): if var == "sync-uri" and out: mirror_string = '%s = %s' % (var, ' '.join(hosts)) else: - mirror_string = '%s="%s"' % (var, ' '.join(hosts)) + mirror_string = '%s="%s"' % (var, ' \\\n '.join(hosts)) if out: self.write_to_output(mirror_string) diff --git a/tests/test_write_make_conf.py b/tests/test_write_make_conf.py index fb84978..5d13bf5 100644 --- a/tests/test_write_make_conf.py +++ b/tests/test_write_make_conf.py @@ -12,31 +12,44 @@ from mirrorselect.output import Output class WriteMakeConfTestCase(unittest.TestCase): def test_write_make_conf(self): + def __do_it(var, mirror_string, make_conf, expected_result): + tempdir = tempfile.mkdtemp() + status_output = open(os.devnull, 'w') + #print("--make_conf", make_conf, "--") + #print("*expect*\n", expected_result, "***") + try: + config_path = os.path.join(tempdir, 'make.conf') + with open(config_path, 'wt') as f: + f.write(make_conf) + write_make_conf(Output(out=status_output), config_path, var, mirror_string) + with open(config_path, 'rt') as f: + result = f.read() + #print("!!!result!!!\n", result, "!!\n") + self.assertEqual(result, "{}".format(expected_result).format(mirror_string)) + finally: + shutil.rmtree(tempdir) + status_output.close() + var = 'GENTOO_MIRRORS' - mirror_string = '{}="a b"'.format(var) + mirrors = ( + ('{}="a"'.format(var)), + ('{}="a b"'.format(var)), + ('{}="a b c"'.format(var)), + ) cases = ( - ('{}="foo\nbar"\n'.format(var), '{}\n'.format(mirror_string)), - ('\n{}="foo\nbar"\n'.format(var), '\n{}\n'.format(mirror_string)), - ('\n{}="foo bar"\n'.format(var), '\n{}\n'.format(mirror_string)), - ('\n{}="foo bar"\n\n'.format(var), '\n\n{}\n'.format(mirror_string)), - ('\n{}="foo \\\nbar"\n'.format(var), '\n{}\n'.format(mirror_string)), - ('\n\n{}="foo \\\nbar"\n'.format(var), '\n\n{}\n'.format(mirror_string)), - ('\n\n{}="foo \\\nbar"\na="b"\n'.format(var), '\n\na="b"\n{}\n'.format(mirror_string)), - ('', '{}\n'.format(mirror_string)), + ('{}="foo\nbar"\n'.format(var), '{}\n'), + ('\n{}="foo\nbar"\n'.format(var), '\n{}\n'), + ('\n{}="foo bar"\n'.format(var), '\n{}\n'), + ('\n{}="foo bar"\n\n'.format(var), '\n\n{}\n'), + ('\n{}="foo \\\nbar"\n'.format(var), '\n{}\n'), + ('\n\n{}="foo \\\nbar"\n'.format(var), '\n\n{}\n'), + ('\n\n{}="foo \\\nbar"\na="b"\n'.format(var), '\n\na="b"\n{}\n'), + ('\n\n{}="foo \\\nbar"\na="b"\n'.format(var), '\n\na="b"\n{}\n'), + ('\n\n{}="foo \\\nbar\\\n baz"\na="b"\n'.format(var), '\n\na="b"\n{}\n'), + ('', '{}\n'), ) - for make_conf, expected_result in cases: - tempdir = tempfile.mkdtemp() - status_output = open(os.devnull, 'w') - try: -
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: c9552deb2d4b50b26e493e4a04b6adc5c65ed4df Author: Brian Dolbec gentoo org> AuthorDate: Tue May 31 15:01:15 2022 + Commit: Brian Dolbec gentoo org> CommitDate: Tue May 31 15:01:15 2022 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=c9552deb selectors.py: Change general exception output to print_warn Signed-off-by: Brian Dolbec gentoo.org> mirrorselect/selectors.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mirrorselect/selectors.py b/mirrorselect/selectors.py index 1b1312c..8b5e28b 100644 --- a/mirrorselect/selectors.py +++ b/mirrorselect/selectors.py @@ -461,10 +461,10 @@ class Deep(object): self.output.write(('deeptime(): connection to host %s ' 'timed out for ip %s\n') % (url_parts.hostname, ip), 2) except Exception as e: # Add general exception to catch any other errors - self.output.write(('deeptime(): connection to host %s ' + self.output.print_warn(('deeptime(): connection to host %s ' 'errored for ip %s\n%s\n' ' Please file a bug for this error at bugs.gentoo.org') - % (url_parts.hostname, ip, e), 2) + % (url_parts.hostname, ip, e), 0) return f, test_url, early_out
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: 889a9ce7e114a453447d120dbea864899bfaae8e Author: Brian Dolbec gentoo org> AuthorDate: Tue May 31 17:52:26 2022 + Commit: Brian Dolbec gentoo org> CommitDate: Tue May 31 17:52:26 2022 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=889a9ce7 configs.py: Remove py2 code Signed-off-by: Brian Dolbec gentoo.org> mirrorselect/configs.py | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mirrorselect/configs.py b/mirrorselect/configs.py index 93b2108..d72ddf3 100644 --- a/mirrorselect/configs.py +++ b/mirrorselect/configs.py @@ -37,10 +37,7 @@ import string import sys -try: # py2 - letters = string.letters -except AttributeError: # py3 - letters = string.ascii_letters +letters = string.ascii_letters def get_make_conf_path(EPREFIX):
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: c32caece8690c2a88bd12d4aa30cb27d8bdf25ef Author: Brian Dolbec gentoo org> AuthorDate: Tue May 31 17:51:17 2022 + Commit: Brian Dolbec gentoo org> CommitDate: Tue May 31 17:51:17 2022 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=c32caece Remove remaining SYNC code Signed-off-by: Brian Dolbec gentoo.org> mirrorselect/configs.py | 9 ++--- mirrorselect/main.py| 4 ++-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/mirrorselect/configs.py b/mirrorselect/configs.py index 2dd6cba..93b2108 100644 --- a/mirrorselect/configs.py +++ b/mirrorselect/configs.py @@ -138,12 +138,10 @@ def write_repos_conf(output, config_path, var, value): " variable: %s\nChanges NOT SAVED" %var) -def get_filesystem_mirrors(output, config_path, sync=False): +def get_filesystem_mirrors(output, config_path): """Read the current mirrors and retain mounted filesystems mirrors @param config_path: string - @param sync: boolean, used to switch between SYNC and GENTOO_MIRRORS - make.conf variable target @rtype list """ @@ -158,10 +156,7 @@ def get_filesystem_mirrors(output, config_path, sync=False): fsmirrors = [] - if sync: - var = 'SYNC' - else: - var = 'GENTOO_MIRRORS' + var = 'GENTOO_MIRRORS' output.write('get_filesystem_mirrors(): config_path = %s\n' % config_path, 2) try: diff --git a/mirrorselect/main.py b/mirrorselect/main.py old mode 100755 new mode 100644 index 9cad25b..8a3094e --- a/mirrorselect/main.py +++ b/mirrorselect/main.py @@ -95,7 +95,7 @@ class MirrorSelect(object): @param out: boolean, used to redirect output to stdout @param config_path; string @param sync: boolean, used to switch between sync-uri repos.conf target, - SYNC and GENTOO_MIRRORS make.conf variable target + and GENTOO_MIRRORS make.conf variable target """ if sync: var = "sync-uri" @@ -371,7 +371,7 @@ class MirrorSelect(object): self.output.print_err("main(); Exiting due to missing repos.conf/gentoo.conf file\n") fsmirrors = get_filesystem_mirrors(self.output, - config_path, options.rsync) + config_path) hosts = self.get_available_hosts(options)
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: 1d39a41a244b49b3e1fe1739eb8fdd2a01783877 Author: Brian Dolbec gentoo org> AuthorDate: Tue May 31 17:53:22 2022 + Commit: Brian Dolbec gentoo org> CommitDate: Tue May 31 17:53:22 2022 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=1d39a41a configs.py: Add missing https:// to the re.compile Signed-off-by: Brian Dolbec gentoo.org> mirrorselect/configs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mirrorselect/configs.py b/mirrorselect/configs.py index d72ddf3..6d901a8 100644 --- a/mirrorselect/configs.py +++ b/mirrorselect/configs.py @@ -165,7 +165,7 @@ def get_filesystem_mirrors(output, config_path): lex = shlex.shlex(f, posix=True) lex.wordchars = string.digits + letters + r"~!@#$%*_\:;?,./-+{}" lex.quotes = "\"'" - p = re.compile('rsync://|http://|ftp://', re.IGNORECASE) + p = re.compile('rsync://|http://|https://|ftp://', re.IGNORECASE) while 1: key = get_token(lex) #output.write('get_filesystem_mirrors(): processing key = %s\n' % key, 2)
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: efa29410a1ae8194c9d40866a2c893d414639d5b Author: Brian Dolbec gentoo org> AuthorDate: Tue May 31 03:34:17 2022 + Commit: Brian Dolbec gentoo org> CommitDate: Tue May 31 03:34:17 2022 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=efa29410 selectors.py: Fix bug 698528 clear screen on dialog exit Signed-off-by: Brian Dolbec gentoo.org> mirrorselect/selectors.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mirrorselect/selectors.py b/mirrorselect/selectors.py index 35051ee..1b1312c 100644 --- a/mirrorselect/selectors.py +++ b/mirrorselect/selectors.py @@ -571,6 +571,7 @@ class Interactive(object): self.urls = out.splitlines() + sys.stderr.write("\x1b[2J\x1b[H") if self.urls: if hasattr(self.urls[0], 'decode'): self.urls = decode_selection(
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: c920bf656ab8d41ecc637741d49053a594302c3c Author: Brian Dolbec gentoo org> AuthorDate: Tue May 31 04:07:35 2022 + Commit: Brian Dolbec gentoo org> CommitDate: Tue May 31 04:07:35 2022 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=c920bf65 version.py: Bump base version to 2.3.0 before release Signed-off-by: Brian Dolbec gentoo.org> mirrorselect/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mirrorselect/version.py b/mirrorselect/version.py index ce4f7f4..c8216df 100644 --- a/mirrorselect/version.py +++ b/mirrorselect/version.py @@ -25,5 +25,5 @@ Distributed under the terms of the GNU General Public License v2 """ -version = "2.2.6-git" +version = "2.3.0-git"
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: 738c6f83b48c9f33ae17551b725756a1e94437fb Author: Brian Dolbec gentoo org> AuthorDate: Tue May 31 02:06:54 2022 + Commit: Brian Dolbec gentoo org> CommitDate: Tue May 31 02:22:29 2022 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=738c6f83 main.py: Fix bug 600572 Remove SYNC variable usage Signed-off-by: Brian Dolbec gentoo.org> mirrorselect/main.py | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mirrorselect/main.py b/mirrorselect/main.py index b0a68cc..9cad25b 100755 --- a/mirrorselect/main.py +++ b/mirrorselect/main.py @@ -343,12 +343,12 @@ class MirrorSelect(object): @rtype: string ''' if rsync: - # startwith repos.conf + # repos.conf config_path = EPREFIX + '/etc/portage/repos.conf/gentoo.conf' if not os.access(config_path, os.F_OK): self.output.write("Failed access to gentoo.conf: " "%s\n" % os.access(config_path, os.F_OK), 2) - return get_make_conf_path(EPREFIX) + config_path = None return config_path return get_make_conf_path(EPREFIX) @@ -363,12 +363,12 @@ class MirrorSelect(object): self.output.verbosity = options.verbosity self.output.write("main(); config_path = %s\n" % config_path, 2) - # reset config_path to find repos.conf/gentoo.conf if it exists + # reset config_path to find repos.conf/gentoo.conf if options.rsync: config_path = self.get_conf_path(options.rsync) self.output.write("main(); reset config_path = %s\n" % config_path, 2) - else: - self.output.write("main(); rsync = %s\n" % str(options.rsync),2) + if not config_path: + self.output.print_err("main(); Exiting due to missing repos.conf/gentoo.conf file\n") fsmirrors = get_filesystem_mirrors(self.output, config_path, options.rsync)
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: 25535069d5943b6e7bbbe4607e40685a7ed36ea4 Author: Brian Dolbec gentoo org> AuthorDate: Tue May 31 01:32:43 2022 + Commit: Brian Dolbec gentoo org> CommitDate: Tue May 31 02:21:52 2022 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=25535069 selectors.py: Bug 800149. Add general exception for any other server error Catch any other server errors so that mirrorselect will ignore that server without crashing. It will also output the error and request it to be reported. Signed-off-by: Brian Dolbec gentoo.org> mirrorselect/selectors.py | 5 + 1 file changed, 5 insertions(+) diff --git a/mirrorselect/selectors.py b/mirrorselect/selectors.py index 74405a7..35051ee 100644 --- a/mirrorselect/selectors.py +++ b/mirrorselect/selectors.py @@ -460,6 +460,11 @@ class Deep(object): except TimeoutException: self.output.write(('deeptime(): connection to host %s ' 'timed out for ip %s\n') % (url_parts.hostname, ip), 2) + except Exception as e: # Add general exception to catch any other errors + self.output.write(('deeptime(): connection to host %s ' + 'errored for ip %s\n%s\n' + ' Please file a bug for this error at bugs.gentoo.org') + % (url_parts.hostname, ip, e), 2) return f, test_url, early_out
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: b7defa1505c2e1207dc514523c21995f707943f4 Author: Brian Dolbec gentoo org> AuthorDate: Mon May 30 22:22:29 2022 + Commit: Brian Dolbec gentoo org> CommitDate: Mon May 30 23:11:22 2022 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=b7defa15 Remove obsolete __future__ import of print_function Signed-off-by: Brian Dolbec gentoo.org> mirrorselect/configs.py | 3 --- mirrorselect/main.py | 3 --- mirrorselect/mirrorparser3.py | 2 -- 3 files changed, 8 deletions(-) diff --git a/mirrorselect/configs.py b/mirrorselect/configs.py index 4cba14f..2dd6cba 100644 --- a/mirrorselect/configs.py +++ b/mirrorselect/configs.py @@ -29,9 +29,6 @@ Distributed under the terms of the GNU General Public License v2 """ -from __future__ import print_function - - import os import re import shlex diff --git a/mirrorselect/main.py b/mirrorselect/main.py index c4f649f..c3b5633 100755 --- a/mirrorselect/main.py +++ b/mirrorselect/main.py @@ -30,9 +30,6 @@ Distributed under the terms of the GNU General Public License v2 """ -from __future__ import print_function - - import os import socket import sys diff --git a/mirrorselect/mirrorparser3.py b/mirrorselect/mirrorparser3.py index 16cb1c6..c9349cb 100644 --- a/mirrorselect/mirrorparser3.py +++ b/mirrorselect/mirrorparser3.py @@ -27,8 +27,6 @@ Distributed under the terms of the GNU General Public License v2 """ -from __future__ import print_function - from xml.etree import ElementTree as ET # old url's
[gentoo-commits] proj/mirrorselect:master commit in: /, mirrorselect/
commit: eb9a6203b721d7247f79cb8c991ef835f1b9e1f7 Author: Brian Dolbec gentoo org> AuthorDate: Mon May 30 23:01:21 2022 + Commit: Brian Dolbec gentoo org> CommitDate: Mon May 30 23:11:33 2022 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=eb9a6203 Apply bug 730994 https filtering patch Author: Peter Levine Signed-off-by: Brian Dolbec gentoo.org> mirrorselect.8| 3 +++ mirrorselect/extractor.py | 2 +- mirrorselect/main.py | 7 +-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/mirrorselect.8 b/mirrorselect.8 index 8f0f56e..49caadd 100644 --- a/mirrorselect.8 +++ b/mirrorselect.8 @@ -44,6 +44,9 @@ ftp only mode. Will not consider hosts of other types. .B \-H, \-\-http http only mode. Will not consider hosts of other types. .TP +.B \-S, \-\-https +https only mode. Will not consider hosts of other types. +.TP .B \-r, \-\-rsync rsync mode. Allows you to interactively select your rsync mirror. Requires -i to be used. diff --git a/mirrorselect/extractor.py b/mirrorselect/extractor.py index dca8302..19dc059 100644 --- a/mirrorselect/extractor.py +++ b/mirrorselect/extractor.py @@ -50,7 +50,7 @@ class Extractor(object): filters[opt] = value self.output.print_info('Limiting test to "%s=%s" hosts. \n' %(opt, value)) - for opt in ["ftp", "http"]: + for opt in ["ftp", "http", "https"]: if getattr(options, opt): filters["proto"] = opt self.output.print_info('Limiting test to %s hosts. \n' % opt ) diff --git a/mirrorselect/main.py b/mirrorselect/main.py index c3b5633..b0a68cc 100755 --- a/mirrorselect/main.py +++ b/mirrorselect/main.py @@ -181,6 +181,9 @@ class MirrorSelect(object): group.add_option( "-H", "--http", action="store_true", default=False, help="http only mode. Will not consider hosts of other types") + group.add_option( + "-S", "--https", action="store_true", default=False, + help="https only mode. Will not consider hosts of other types") group.add_option( "-r", "--rsync", action="store_true", default=False, help="rsync mode. Allows you to interactively select your" @@ -255,8 +258,8 @@ class MirrorSelect(object): # sanity checks # hack: check if more than one of these is set - if options.http + options.ftp + options.rsync > 1: - self.output.print_err('Choose at most one of -H, -f and -r') + if options.http + options.https + options.ftp + options.rsync > 1: + self.output.print_err('Choose at most one of -H, -S, -f and -r') if options.ipv4 and options.ipv6: self.output.print_err('Choose at most one of --ipv4 and --ipv6')
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: a61f2d061134d1a61254da4cd8c30cc9b4749cdb Author: Brian Dolbec gentoo org> AuthorDate: Mon May 30 22:19:30 2022 + Commit: Brian Dolbec gentoo org> CommitDate: Mon May 30 23:11:03 2022 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=a61f2d06 selectors.py: Fix bug 771963 incorrect comparison Signed-off-by: Brian Dolbec gentoo.org> mirrorselect/selectors.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mirrorselect/selectors.py b/mirrorselect/selectors.py index 4564f11..74405a7 100644 --- a/mirrorselect/selectors.py +++ b/mirrorselect/selectors.py @@ -63,7 +63,7 @@ from mirrorselect.output import encoder, get_encoding, decode_selection # The netselect --ipv4 and --ipv6 options are supported only # with >=net-analyzer/netselect-0.4[ipv6(+)]. -NETSELECT_SUPPORTS_IPV4_IPV6 = False +NETSELECT_SUPPORTS_IPV4_IPV6 = True class Shallow(object): @@ -260,7 +260,7 @@ class Deep(object): for host in hosts: prog += 1 - if self.test_file is not 'mirrorselect-test': + if self.test_file != 'mirrorselect-test': self.output.print_info( 'Downloading %s files from each mirror... [%s of %s]' % (self.test_file, prog, num_hosts) )
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: 7caac017833b01e13028658effc502430c56d770 Author: Brian Dolbec gentoo org> AuthorDate: Wed Jun 3 18:53:47 2020 + Commit: Brian Dolbec gentoo org> CommitDate: Wed Jun 3 18:58:04 2020 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=7caac017 main.py: Add a -a, -s combo sanity check This is to prevent all mirrors from being added to make.conf when the -s option is also enabled. The -a option takes priority in the code, so there is never any selection done. This options check will error out when both options are enabled. Reported by: toralf on #gentoo-dev Signed-off-by: Brian Dolbec gentoo.org> mirrorselect/main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mirrorselect/main.py b/mirrorselect/main.py index b49461b..c4f649f 100755 --- a/mirrorselect/main.py +++ b/mirrorselect/main.py @@ -271,6 +271,9 @@ class MirrorSelect(object): if options.rsync and not (options.interactive or options.all_mirrors): self.output.print_err('rsync servers can only be selected with -i or -a') + if options.servers and options.all_mirrors: + self.output.print_err('Choose at most one of -s or -a') + if options.interactive and ( options.deep or options.blocksize or
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: 95ba3ca5e8db2a6b360e4abdcee026076652551d Author: Zac Medico gentoo org> AuthorDate: Sat Jul 13 05:00:33 2019 + Commit: Zac Medico gentoo org> CommitDate: Sat Jul 13 05:09:20 2019 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=95ba3ca5 netselect: make netselect ipv6 support optional Since netselect with ipv6 support does not work on a system where ipv6 is disabled, use a NETSELECT_SUPPORTS_IPV4_IPV6 variable to optionally enable the use of netselect -4/-6 options. The ebuild will use sed to set NETSELECT_SUPPORTS_IPV4_IPV6 = True when USE=ipv6 is enabled, and will have a dependency like RDEPEND=">=net-analyzer/netselect-0.4[ipv6(+)?]". Bug: https://bugs.gentoo.org/688214 Signed-off-by: Zac Medico gentoo.org> mirrorselect/selectors.py | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/mirrorselect/selectors.py b/mirrorselect/selectors.py index e3f718c..4564f11 100644 --- a/mirrorselect/selectors.py +++ b/mirrorselect/selectors.py @@ -61,6 +61,11 @@ else: from mirrorselect.output import encoder, get_encoding, decode_selection +# The netselect --ipv4 and --ipv6 options are supported only +# with >=net-analyzer/netselect-0.4[ipv6(+)]. +NETSELECT_SUPPORTS_IPV4_IPV6 = False + + class Shallow(object): """handles rapid server selection via netselect""" @@ -96,10 +101,12 @@ class Shallow(object): host_string = ' '.join(hosts) cmd = ['netselect', '-s%d' % (number,)] - if self._options.ipv4: - cmd.append('-4') - elif self._options.ipv6: - cmd.append('-6') + + if NETSELECT_SUPPORTS_IPV4_IPV6: + if self._options.ipv4: + cmd.append('-4') + elif self._options.ipv6: + cmd.append('-6') cmd.extend(hosts)
[gentoo-commits] proj/mirrorselect:master commit in: /, mirrorselect/
commit: 823dd74dfc9cdfee5072c8595619b669625f5942 Author: Zac Medico gentoo org> AuthorDate: Wed Jul 17 05:07:56 2019 + Commit: Zac Medico gentoo org> CommitDate: Wed Jul 17 05:08:04 2019 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=823dd74d Update version for 2.2.5 release Signed-off-by: Zac Medico gentoo.org> mirrorselect.8 | 2 +- mirrorselect/version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mirrorselect.8 b/mirrorselect.8 index 5bdb43d..8f0f56e 100644 --- a/mirrorselect.8 +++ b/mirrorselect.8 @@ -1,4 +1,4 @@ -.TH "mirrorselect" "8" "2.2.5" +.TH "mirrorselect" "8" "2.2.6" .SH "NAME" .LP diff --git a/mirrorselect/version.py b/mirrorselect/version.py index fefb0df..ce4f7f4 100644 --- a/mirrorselect/version.py +++ b/mirrorselect/version.py @@ -25,5 +25,5 @@ Distributed under the terms of the GNU General Public License v2 """ -version = "2.2.5-git" +version = "2.2.6-git"
[gentoo-commits] proj/mirrorselect:master commit in: /, mirrorselect/
commit: 72aa138d7c866d42b3bfea011f3622c3c6db755d Author: Zac Medico gentoo org> AuthorDate: Mon May 27 17:33:46 2019 + Commit: Zac Medico gentoo org> CommitDate: Mon May 27 18:01:35 2019 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=72aa138d Update version for 2.2.5 release Signed-off-by: Zac Medico gentoo.org> MANIFEST.in | 1 + mirrorselect.8 | 2 +- mirrorselect/version.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 000..b562f73 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +recursive-include tests *.py diff --git a/mirrorselect.8 b/mirrorselect.8 index 7db8c0c..5bdb43d 100644 --- a/mirrorselect.8 +++ b/mirrorselect.8 @@ -1,4 +1,4 @@ -.TH "mirrorselect" "8" "2.2.4" +.TH "mirrorselect" "8" "2.2.5" .SH "NAME" .LP diff --git a/mirrorselect/version.py b/mirrorselect/version.py index abb971b..fefb0df 100644 --- a/mirrorselect/version.py +++ b/mirrorselect/version.py @@ -25,5 +25,5 @@ Distributed under the terms of the GNU General Public License v2 """ -version = "2.2.4-git" +version = "2.2.5-git"
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: 2bc49521708ec4cd6941bc725f7b4ab490ff77a9 Author: Zac Medico gentoo org> AuthorDate: Mon May 27 17:51:38 2019 + Commit: Zac Medico gentoo org> CommitDate: Mon May 27 17:52:05 2019 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=2bc49521 get_filesystem_mirrors: fix DeprecationWarning: invalid escape sequence \ Signed-off-by: Zac Medico gentoo.org> mirrorselect/configs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mirrorselect/configs.py b/mirrorselect/configs.py index 8c4b4df..df718f6 100644 --- a/mirrorselect/configs.py +++ b/mirrorselect/configs.py @@ -172,7 +172,7 @@ def get_filesystem_mirrors(output, config_path, sync=False): """ Search for 'var' in make.conf and extract value """ lex = shlex.shlex(f, posix=True) - lex.wordchars = string.digits+letters+"~!@#$%*_\:;?,./-+{}" + lex.wordchars = string.digits + letters + r"~!@#$%*_\:;?,./-+{}" lex.quotes = "\"'" p = re.compile('rsync://|http://|ftp://', re.IGNORECASE) while 1:
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: 195781b8fbfe3ee52ceb478de5058e2745d24aa2 Author: Zac Medico gentoo org> AuthorDate: Mon May 27 17:02:02 2019 + Commit: Zac Medico gentoo org> CommitDate: Mon May 27 17:07:45 2019 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=195781b8 netselect: use -4/-6 options (bug 582508) Requires >=net-analyzer/netselect-0.4[ipv6(+)]. Bug: https://bugs.gentoo.org/582508 Signed-off-by: Zac Medico gentoo.org> mirrorselect/selectors.py | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/mirrorselect/selectors.py b/mirrorselect/selectors.py index 4b7e7a2..e3f718c 100644 --- a/mirrorselect/selectors.py +++ b/mirrorselect/selectors.py @@ -65,6 +65,7 @@ class Shallow(object): """handles rapid server selection via netselect""" def __init__(self, hosts, options, output): + self._options = options self.output = output self.urls = [] @@ -94,10 +95,18 @@ class Shallow(object): host_string = ' '.join(hosts) - self.output.write('\nnetselect(): running "netselect -s%d %s"\n' - % (int(number), host_string), 2) + cmd = ['netselect', '-s%d' % (number,)] + if self._options.ipv4: + cmd.append('-4') + elif self._options.ipv6: + cmd.append('-6') - proc = subprocess.Popen( ['netselect', '-s%d' % (number,)] + hosts, + cmd.extend(hosts) + + self.output.write('\nnetselect(): running "%s"\n' + % ' '.join(cmd), 2) + + proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = proc.communicate()
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/, /
commit: 15e2aa6f910643510a23bd89a6b375304a42694f Author: Zac Medico gentoo org> AuthorDate: Wed Feb 13 08:29:48 2019 + Commit: Zac Medico gentoo org> CommitDate: Wed Feb 13 08:42:05 2019 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=15e2aa6f Update version for 2.2.4 release Signed-off-by: Zac Medico gentoo.org> mirrorselect.8 | 2 +- mirrorselect/version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mirrorselect.8 b/mirrorselect.8 index e84e133..7db8c0c 100644 --- a/mirrorselect.8 +++ b/mirrorselect.8 @@ -1,4 +1,4 @@ -.TH "mirrorselect" "8" "2.2.3" +.TH "mirrorselect" "8" "2.2.4" .SH "NAME" .LP diff --git a/mirrorselect/version.py b/mirrorselect/version.py index 60d33ac..abb971b 100644 --- a/mirrorselect/version.py +++ b/mirrorselect/version.py @@ -25,5 +25,5 @@ Distributed under the terms of the GNU General Public License v2 """ -version = "2.2.3-git" +version = "2.2.4-git"
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: 856abee86416d4b2159f81d34cf28ef3422b92ec Author: Michel Ganguin romandie com> AuthorDate: Mon Dec 31 21:54:29 2018 + Commit: Zac Medico gentoo org> CommitDate: Wed Feb 13 08:20:47 2019 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=856abee8 selectors.py: Give urllib hostname info (bug 604968) Give urllib hostname info such that: * it will not fail when using HTTPS because of hostname mismatch (CertificateError) * it will not fail when the server is a virtualhost * it will not fail when the server validates ssl SNI Bug: https://bugs.gentoo.org/566778 Bug: https://bugs.gentoo.org/604968 Bug: https://bugs.gentoo.org/639156 Signed-off-by: Zac Medico gentoo.org> mirrorselect/selectors.py | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mirrorselect/selectors.py b/mirrorselect/selectors.py index 33f7663..4b7e7a2 100644 --- a/mirrorselect/selectors.py +++ b/mirrorselect/selectors.py @@ -42,6 +42,7 @@ if sys.version_info[0] >= 3: url_parse = urllib.parse.urlparse url_unparse = urllib.parse.urlunparse url_open = urllib.request.urlopen + url_request = urllib.request.Request HTTPError = urllib.error.HTTPError import http.client IncompleteRead = http.client.IncompleteRead @@ -51,6 +52,7 @@ else: url_parse = urlparse.urlparse url_unparse = urlparse.urlunparse url_open = urllib2.urlopen + url_request = urllib2.Request HTTPError = urllib2.HTTPError import httplib IncompleteRead = httplib.IncompleteRead @@ -368,7 +370,9 @@ class Deep(object): try: signal.alarm(int(math.ceil(maxtime))) stime = time.time() - f = url_open(test_url) + r = url_request(test_url) + r.host = url_parts.netloc + f = url_open(r) md5 = hashlib.md5(f.read()).hexdigest() @@ -419,7 +423,9 @@ class Deep(object): try: try: signal.alarm(self._connect_timeout) - f = url_open(test_url) + r = url_request(test_url) + r.host = url_parts.netloc + f = url_open(r) early_out = True finally: signal.alarm(0)
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: a6532e7c6b655ebba0dce53f92d9fca180b23be6 Author: Xiami f2light com> AuthorDate: Thu Dec 14 10:30:29 2017 + Commit: Zac Medico gentoo org> CommitDate: Wed Feb 13 08:06:57 2019 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=a6532e7c selectors.py: handle ssl.CertificateError (bug 639156) Bug: https://bugs.gentoo.org/639156 Signed-off-by: Zac Medico gentoo.org> mirrorselect/selectors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mirrorselect/selectors.py b/mirrorselect/selectors.py index 58a44a1..33f7663 100644 --- a/mirrorselect/selectors.py +++ b/mirrorselect/selectors.py @@ -388,7 +388,7 @@ class Deep(object): finally: signal.alarm(0) - except EnvironmentError as e: + except (EnvironmentError, ssl.CertificateError) as e: self.output.write(('\ndeeptime(): download from host %s ' 'failed for ip %s: %s\n') % (url_parts.hostname, ip, e), 2) return (None, True)
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: 92d682ca0f8d173149df8511a06b0457ffbffa8d Author: Daniel Harding living180 net> AuthorDate: Sat Sep 2 11:13:00 2017 + Commit: Zac Medico gentoo org> CommitDate: Wed Feb 13 05:50:12 2019 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=92d682ca selectors.py: handle ssl.CertificateError (bug 604968) Bug: https://bugs.gentoo.org/604968 Signed-off-by: Zac Medico gentoo.org> mirrorselect/selectors.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mirrorselect/selectors.py b/mirrorselect/selectors.py index cf70b21..58a44a1 100644 --- a/mirrorselect/selectors.py +++ b/mirrorselect/selectors.py @@ -31,6 +31,7 @@ Distributed under the terms of the GNU General Public License v2 import math import signal import socket +import ssl import subprocess import sys import time @@ -430,7 +431,7 @@ class Deep(object): if len(ips) == 1: test_url = url_unparse(url_parts) return self._test_connection(test_url, url_parts, ip, []) - except EnvironmentError as e: + except (EnvironmentError, ssl.CertificateError) as e: self.output.write('deeptime(): connection to host %s ' 'failed for ip %s:\n%s\n' % (url_parts.hostname, ip, e), 2)
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/, /
commit: 7268ac5c2e06732668cdfaa62a9eb2be9fea17e3 Author: Zac Medico gentoo org> AuthorDate: Wed Jan 23 18:14:54 2019 + Commit: Zac Medico gentoo org> CommitDate: Wed Jan 23 18:15:13 2019 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=7268ac5c Update version for 2.2.3 release Signed-off-by: Zac Medico gentoo.org> mirrorselect.8 | 2 +- mirrorselect/version.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mirrorselect.8 b/mirrorselect.8 index 3a1e304..e84e133 100644 --- a/mirrorselect.8 +++ b/mirrorselect.8 @@ -1,4 +1,4 @@ -.TH "mirrorselect" "8" "2.2.2" +.TH "mirrorselect" "8" "2.2.3" .SH "NAME" .LP diff --git a/mirrorselect/version.py b/mirrorselect/version.py index ce110c9..60d33ac 100644 --- a/mirrorselect/version.py +++ b/mirrorselect/version.py @@ -5,7 +5,7 @@ """Mirrorselect 2.x Tool for selecting Gentoo source and rsync mirrors. -Copyright 2012 Gentoo Foundation +Copyright 2012-2019 Gentoo Authors Copyright (C) 2012 Brian Dolbec @@ -25,5 +25,5 @@ Distributed under the terms of the GNU General Public License v2 """ -version = "2.2.2-git" +version = "2.2.3-git"
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: cf6769792d8334e6302a082350d5cf411ff4f3f7 Author: Brian Dolbec gentoo org> AuthorDate: Tue Jul 18 20:14:25 2017 + Commit: Brian Dolbec gentoo org> CommitDate: Tue Jul 18 20:15:02 2017 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=cf676979 main.py: Remove obsolete 'SYNC' option Signed-off-by: Brian Dolbec gentoo.org> mirrorselect/main.py | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mirrorselect/main.py b/mirrorselect/main.py index 4858875..04698f3 100755 --- a/mirrorselect/main.py +++ b/mirrorselect/main.py @@ -101,10 +101,7 @@ class MirrorSelect(object): SYNC and GENTOO_MIRRORS make.conf variable target """ if sync: - if 'repos.conf' in config_path: - var = "sync-uri" - else: - var = 'SYNC' + var = "sync-uri" else: var = 'GENTOO_MIRRORS'
[gentoo-commits] proj/mirrorselect:master commit in: /, mirrorselect/
commit: d0f37a2cb9734439c2d69f74c16ffb0489a30280 Author: i.Dark_Templar dark-templar-archives net> AuthorDate: Sat May 26 15:28:53 2018 + Commit: Brian Dolbec gentoo org> CommitDate: Sat May 26 15:40:31 2018 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=d0f37a2c Mirrorselect: add 'exclude' option to allow excluding hosts from mirrors list. mirrorselect.8 | 3 +++ mirrorselect/main.py | 7 +++ 2 files changed, 10 insertions(+) diff --git a/mirrorselect.8 b/mirrorselect.8 index cd7b8bb..3a1e304 100644 --- a/mirrorselect.8 +++ b/mirrorselect.8 @@ -96,6 +96,9 @@ download mirrors. If this is not specified, a default of 1 is used. .TP .BI \-t " TIMEOUT " "\fR,\fP \-timeout" " TIMEOUT " Timeout for deep mode. Defaults to 10 seconds. +.TP +.BI \-e " EXCLUDE " "\fR,\fP \-exclude" " EXCLUDE " +Exclude host from mirrors list. .SH "EXAMPLES" automatic: diff --git a/mirrorselect/main.py b/mirrorselect/main.py index 04698f3..b49461b 100755 --- a/mirrorselect/main.py +++ b/mirrorselect/main.py @@ -243,6 +243,9 @@ class MirrorSelect(object): group.add_option( "-t", "--timeout", action="store", type="int", default="10", help="Timeout for deep mode. Defaults to 10 seconds.") + group.add_option( + "-e", "--exclude", action="append", dest="exclude", + default=None, help="Exclude host from mirrors list.") @@ -302,6 +305,10 @@ class MirrorSelect(object): else: self.output.write("using url: %s\n" % MIRRORS_3_XML, 2) hosts = Extractor(MIRRORS_3_XML, options, self.output).hosts + + if options.exclude: + hosts = [x for x in hosts if x[0] not in options.exclude] + return hosts
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: 18df6efa96f57830f26ca94c41e1f1e8cc30b3ca Author: Zac Medico gentoo org> AuthorDate: Tue Feb 21 04:44:03 2017 + Commit: Zac Medico gentoo org> CommitDate: Tue Feb 21 04:44:24 2017 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=18df6efa main.py: fix isinstance(hosts[i], bytes) Fixes: c91509d823c2 ("main.py: Fix Bytes error in hosts list bug 610016") mirrorselect/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mirrorselect/main.py b/mirrorselect/main.py index 30345cc..4858875 100755 --- a/mirrorselect/main.py +++ b/mirrorselect/main.py @@ -109,7 +109,7 @@ class MirrorSelect(object): var = 'GENTOO_MIRRORS' for i in range(0, len(hosts)): - if isinstance(hosts[i], 'bytes'): + if isinstance(hosts[i], bytes): hosts[i] = hosts[i].decode('utf-8') if var == "sync-uri" and out:
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: 195bea73e1195b824eabdeb411713801f17d11a6 Author: Brian Dolbec gentoo org> AuthorDate: Tue Feb 21 03:15:28 2017 + Commit: Brian Dolbec gentoo org> CommitDate: Tue Feb 21 03:18:51 2017 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=195bea73 extractor.py: Add climit param for >=ssl-fetch-0.4 mirrorselect/extractor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mirrorselect/extractor.py b/mirrorselect/extractor.py index 06dce6c..dca8302 100644 --- a/mirrorselect/extractor.py +++ b/mirrorselect/extractor.py @@ -115,7 +115,7 @@ class Extractor(object): } fetcher = Connector(connector_output, self.proxies, USERAGENT) - success, mirrorlist, timestamp = fetcher.fetch_content(url) + success, mirrorlist, timestamp = fetcher.fetch_content(url, climit=60) parser.parse(mirrorlist) if (not mirrorlist) or len(parser.tuples()) == 0:
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: c91509d823c27fdb1527c61f77c959b305170915 Author: zakalwe gmail com> AuthorDate: Tue Feb 21 03:09:11 2017 + Commit: Brian Dolbec gentoo org> CommitDate: Tue Feb 21 03:18:51 2017 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=c91509d8 main.py: Fix Bytes error in hosts list bug 610016 The code was only checking the first host which was not a bytes instance in that case. This resulted in the remaining host entries to not be decoded. Signed-off-by: Brian Dolbec gentoo.org> mirrorselect/main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mirrorselect/main.py b/mirrorselect/main.py index d17a4f1..30345cc 100755 --- a/mirrorselect/main.py +++ b/mirrorselect/main.py @@ -108,8 +108,9 @@ class MirrorSelect(object): else: var = 'GENTOO_MIRRORS' - if hasattr(hosts[0], 'decode'): - hosts = [x.decode('utf-8') for x in hosts] + for i in range(0, len(hosts)): + if isinstance(hosts[i], 'bytes'): + hosts[i] = hosts[i].decode('utf-8') if var == "sync-uri" and out: mirror_string = '%s = %s' % (var, ' '.join(hosts))
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: 613bb0efeebe6461b37df6baa862f4a3e67c94c7 Author: Zac Medico gentoo org> AuthorDate: Mon Nov 14 07:16:51 2016 + Commit: Zac Medico gentoo org> CommitDate: Mon Nov 14 07:23:19 2016 + URL:https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=613bb0ef deeptime: cancel alarm signal before handling socket.error (bug 523312) In order to avoid a race condition, the alarm signal must be cancelled before socket.error is handled. X-Gentoo-Bug: 523312 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=523312 mirrorselect/selectors.py | 22 -- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/mirrorselect/selectors.py b/mirrorselect/selectors.py index 1aa5f11..cf70b21 100644 --- a/mirrorselect/selectors.py +++ b/mirrorselect/selectors.py @@ -300,22 +300,24 @@ class Deep(object): ips = [] for addr_family in self._addr_families: try: - signal.alarm(self._dns_timeout) - for result in socket.getaddrinfo(url_parts.hostname, None, - addr_family, socket.SOCK_STREAM, 0, socket.AI_ADDRCONFIG): - family, _, __, ___, sockaddr = result - ip = sockaddr[0] - if family == socket.AF_INET6: - ip = "[%s]" % ip - ips.append(ip) + try: + signal.alarm(self._dns_timeout) + for result in socket.getaddrinfo( + url_parts.hostname, None, addr_family, + socket.SOCK_STREAM, 0, socket.AI_ADDRCONFIG): + family, _, __, ___, sockaddr = result + ip = sockaddr[0] + if family == socket.AF_INET6: + ip = "[%s]" % ip + ips.append(ip) + finally: + signal.alarm(0) except socket.error as e: self.output.write('deeptime(): dns error for host %s: %s\n' % (url_parts.hostname, e), 2) except TimeoutException: self.output.write('deeptime(): dns timeout for host %s\n' % url_parts.hostname, 2) - finally: - signal.alarm(0) if not ips: self.output.write('deeptime(): unable to resolve ip for host %s\n'
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: e9dea3a98aa5031fecf1c7115de77e948e8d07ca Author: Brian Dolbec gentoo org> AuthorDate: Tue Jan 27 18:19:05 2015 + Commit: Brian Dolbec gentoo org> CommitDate: Tue Jan 27 18:19:05 2015 + URL: http://sources.gentoo.org/gitweb/?p=proj/mirrorselect.git;a=commit;h=e9dea3a9 Add missed output mode function assignment. --- mirrorselect/extractor.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mirrorselect/extractor.py b/mirrorselect/extractor.py index 59efad1..06dce6c 100644 --- a/mirrorselect/extractor.py +++ b/mirrorselect/extractor.py @@ -107,6 +107,7 @@ class Extractor(object): # setup the ssl-fetch ouptut map connector_output = { 'info':self.output.write, + 'debug': self.output.write, 'error': self.output.print_err, 'kwargs-info': {'level': 2}, 'kwargs-debug': {'level':2},
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: 9ec1e9649c980d32d23aab40eff3cac5e8f6f555 Author: Brian Dolbec gentoo org> AuthorDate: Tue Jan 27 02:23:05 2015 + Commit: Brian Dolbec gentoo org> CommitDate: Tue Jan 27 02:23:05 2015 + URL: http://sources.gentoo.org/gitweb/?p=proj/mirrorselect.git;a=commit;h=9ec1e964 Update for ssl-fetch api change --- mirrorselect/extractor.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mirrorselect/extractor.py b/mirrorselect/extractor.py index ec5f299..59efad1 100644 --- a/mirrorselect/extractor.py +++ b/mirrorselect/extractor.py @@ -109,6 +109,7 @@ class Extractor(object): 'info':self.output.write, 'error': self.output.print_err, 'kwargs-info': {'level': 2}, + 'kwargs-debug': {'level':2}, 'kwargs-error': {'level':0}, }
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: 71a32f7fea74caedb83d57408f8f2aa08e40176b Author: Brian Dolbec gentoo org> AuthorDate: Tue Jan 27 04:38:03 2015 + Commit: Brian Dolbec gentoo org> CommitDate: Tue Jan 27 04:38:03 2015 + URL: http://sources.gentoo.org/gitweb/?p=proj/mirrorselect.git;a=commit;h=71a32f7f update version with latest release as a base --- mirrorselect/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mirrorselect/version.py b/mirrorselect/version.py index 12942ed..ce110c9 100644 --- a/mirrorselect/version.py +++ b/mirrorselect/version.py @@ -25,5 +25,5 @@ Distributed under the terms of the GNU General Public License v2 """ -version = "git" +version = "2.2.2-git"
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: 186426dd65b0b91daa9a5163900f2233ff197d61 Author: Brian Dolbec gentoo org> AuthorDate: Wed May 28 20:52:38 2014 + Commit: Brian Dolbec gmail com> CommitDate: Wed May 28 20:52:38 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/mirrorselect.git;a=commit;h=186426dd Ssl-fetch renamed args-* to kwargs-* --- mirrorselect/extractor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mirrorselect/extractor.py b/mirrorselect/extractor.py index b9ed15e..ec5f299 100644 --- a/mirrorselect/extractor.py +++ b/mirrorselect/extractor.py @@ -108,8 +108,8 @@ class Extractor(object): connector_output = { 'info':self.output.write, 'error': self.output.print_err, - 'args-info': {'level': 2}, - 'args-error': {'level':0}, + 'kwargs-info': {'level': 2}, + 'kwargs-error': {'level':0}, } fetcher = Connector(connector_output, self.proxies, USERAGENT)
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: 16c4aebc0a90b98c50f4df58abd63066196cefc7 Author: Brian Dolbec gentoo org> AuthorDate: Wed May 28 19:43:46 2014 + Commit: Brian Dolbec gmail com> CommitDate: Wed May 28 19:43:46 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/mirrorselect.git;a=commit;h=16c4aebc Update for recent ssl-fetch changes --- mirrorselect/extractor.py | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mirrorselect/extractor.py b/mirrorselect/extractor.py index eb26faf..b9ed15e 100644 --- a/mirrorselect/extractor.py +++ b/mirrorselect/extractor.py @@ -104,7 +104,15 @@ class Extractor(object): self.output.print_info('Downloading a list of mirrors...\n') - fetcher = Connector(self.output, self.proxies, USERAGENT) + # setup the ssl-fetch ouptut map + connector_output = { + 'info':self.output.write, + 'error': self.output.print_err, + 'args-info': {'level': 2}, + 'args-error': {'level':0}, + } + + fetcher = Connector(connector_output, self.proxies, USERAGENT) success, mirrorlist, timestamp = fetcher.fetch_content(url) parser.parse(mirrorlist)
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: 9f6c6d2fd749df7528fcb2b7a85790362fb4d232 Author: Brian Dolbec gentoo org> AuthorDate: Mon May 5 02:00:35 2014 + Commit: Brian Dolbec gmail com> CommitDate: Mon May 5 02:00:35 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/mirrorselect.git;a=commit;h=9f6c6d2f main.py: Sort the cli options --- mirrorselect/main.py | 60 ++-- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/mirrorselect/main.py b/mirrorselect/main.py index 3014c3f..d17a4f1 100755 --- a/mirrorselect/main.py +++ b/mirrorselect/main.py @@ -162,19 +162,24 @@ class MirrorSelect(object): " For the -r, --rsync option, it will select the rotation server " "only. As multiple rsync URL's are not supported.") group.add_option( - "-i", "--interactive", action="store_true", default=False, - help="Interactive Mode, this will present a list " - "to make it possible to select mirrors you wish to use.") - group.add_option( "-D", "--deep", action="store_true", default=False, help="Deep mode. This is used to give a more accurate " "speed test. It will download a 100k file from " "each server. Because of this you should only use " "this option if you have a good connection.") + group.add_option( + "-i", "--interactive", action="store_true", default=False, + help="Interactive Mode, this will present a list " + "to make it possible to select mirrors you wish to use.") group = parser.add_option_group( "Server type selection (choose at most one)") group.add_option( + "-c", "--country", action="store", default=None, + help="only use mirrors from the specified country " + "NOTE: Names with a space must be quoted " + "eg.: -c 'South Korea'") + group.add_option( "-F", "--ftp", action="store_true", default=False, help="ftp only mode. Will not consider hosts of other " "types.") @@ -186,29 +191,19 @@ class MirrorSelect(object): help="rsync mode. Allows you to interactively select your" " rsync mirror. Requires -i or -a to be used.") group.add_option( + "-R", "--region", action="store", default=None, + help="only use mirrors from the specified region " + "NOTE: Names with a space must be quoted " + "eg.: -R 'North America'") + group.add_option( "-4", "--ipv4", action="store_true", default=False, help="only use IPv4") group.add_option( "-6", "--ipv6", action="store_true", default=False, help="only use IPv6") - group.add_option( - "-c", "--country", action="store", default=None, - help="only use mirrors from the specified country " - "NOTE: Names with a space must be quoted " - "eg.: -c 'South Korea'") - group.add_option( - "-R", "--region", action="store", default=None, - help="only use mirrors from the specified region " - "NOTE: Names with a space must be quoted " - "eg.: -R 'North America'") group = parser.add_option_group("Other options") group.add_option( - "-o", "--output", action="store_true", default=False, - help="Output Only Mode, this is especially useful " - "when being used during installation, to redirect " - "output to a file other than %s" % config_path) - group.add_option( "-b", "--blocksize", action="store", type="int", help="This is to be used in automatic mode " "and will split the hosts into blocks of BLOCKSIZE for " @@ -216,20 +211,9 @@ class MirrorSelect(object): "routers which block 40+ requests at any given time. " "Recommended parameters to pass are: -s3 -b10") group.add_option( - "-t", "--timeout", action="store", type="int", - default="10", help="Timeout for deep mode. Defaults to 10 seconds.") - group.add_option( - "-s", "--servers", a
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: a54f7eab35470bf34a3955cda94d372af3cd030d Author: Brian Dolbec gentoo org> AuthorDate: Thu Mar 6 16:35:22 2014 + Commit: Brian Dolbec gmail com> CommitDate: Thu Mar 6 16:35:22 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/mirrorselect.git;a=commit;h=a54f7eab Fix typo in help message. --- mirrorselect/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mirrorselect/main.py b/mirrorselect/main.py index 15b8ead..3014c3f 100755 --- a/mirrorselect/main.py +++ b/mirrorselect/main.py @@ -200,7 +200,7 @@ class MirrorSelect(object): "-R", "--region", action="store", default=None, help="only use mirrors from the specified region " "NOTE: Names with a space must be quoted " - "eg.: -r 'North America'") + "eg.: -R 'North America'") group = parser.add_option_group("Other options") group.add_option(
[gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
commit: 3445069b3da6a33356f2d16a9ff27a722873512d Author: Brian Dolbec gentoo org> AuthorDate: Mon May 5 02:03:01 2014 + Commit: Brian Dolbec gmail com> CommitDate: Mon May 5 02:03:01 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/mirrorselect.git;a=commit;h=3445069b selectors.py: Add IncompleteRead exception Improve output formatting. --- mirrorselect/selectors.py | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/mirrorselect/selectors.py b/mirrorselect/selectors.py index 5d30695..1aa5f11 100644 --- a/mirrorselect/selectors.py +++ b/mirrorselect/selectors.py @@ -42,6 +42,8 @@ if sys.version_info[0] >= 3: url_unparse = urllib.parse.urlunparse url_open = urllib.request.urlopen HTTPError = urllib.error.HTTPError + import http.client + IncompleteRead = http.client.IncompleteRead else: import urllib2 import urlparse @@ -49,6 +51,8 @@ else: url_unparse = urlparse.urlunparse url_open = urllib2.urlopen HTTPError = urllib2.HTTPError + import httplib + IncompleteRead = httplib.IncompleteRead from mirrorselect.output import encoder, get_encoding, decode_selection @@ -369,7 +373,7 @@ class Deep(object): f.close() if md5 != self.test_md5: self.output.write( - "deeptime(): md5sum error for file: %s\n" + "\ndeeptime(): md5sum error for file: %s\n" % self.test_file + " expected: %s\n" % self.test_md5 + " got.: %s\n" % md5 + @@ -382,13 +386,17 @@ class Deep(object): signal.alarm(0) except EnvironmentError as e: - self.output.write(('deeptime(): download from host %s ' + self.output.write(('\ndeeptime(): download from host %s ' 'failed for ip %s: %s\n') % (url_parts.hostname, ip, e), 2) return (None, True) except TimeoutException: - self.output.write(('deeptime(): download from host %s ' + self.output.write(('\ndeeptime(): download from host %s ' 'timed out for ip %s\n') % (url_parts.hostname, ip), 2) return (None, True) + except IncompleteRead as e: + self.output.write(('\ndeeptime(): download from host %s ' + 'failed for ip %s: %s\n') % (url_parts.hostname, ip, e), 2) + return (None, True) signal.signal(signal.SIGALRM, signal.SIG_DFL)