aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Dolbec <dolsen@gentoo.org>2013-10-17 23:42:20 -0700
committerBrian Dolbec <dolsen@gentoo.org>2013-10-17 23:42:20 -0700
commit1be270280f8ca26ff76dfc3b86a8ddabda09d4f6 (patch)
treeb81248547024469defb6ee0a84cba05556923d87 /mirrorselect
parentImprove python version testing for imports. (diff)
downloadmirrorselect-1be270280f8ca26ff76dfc3b86a8ddabda09d4f6.tar.gz
mirrorselect-1be270280f8ca26ff76dfc3b86a8ddabda09d4f6.tar.bz2
mirrorselect-1be270280f8ca26ff76dfc3b86a8ddabda09d4f6.zip
Add -f, --file & -m, --md5 options to override mirrorselect-test file used.
Diffstat (limited to 'mirrorselect')
-rwxr-xr-xmirrorselect/main.py11
-rw-r--r--mirrorselect/selectors.py14
2 files changed, 21 insertions, 4 deletions
diff --git a/mirrorselect/main.py b/mirrorselect/main.py
index 8a1bfca..5844a65 100755
--- a/mirrorselect/main.py
+++ b/mirrorselect/main.py
@@ -229,6 +229,17 @@ class MirrorSelect(object):
group.add_option(
"-q", "--quiet", action="store_const", const=0, dest="verbosity",
help="Quiet mode")
+ group.add_option(
+ "-f", "--file", action="store", default='mirrorselect-test',
+ help="An alternate file to download for deep testing. "
+ "Please choose the file carefully as to not abuse the system "
+ "by selecting an overly large size file. You must also "
+ " use the -m, --md5 option.")
+ group.add_option(
+ "-m", "--md5", action="store", default='bdf077b2e683c506bf9e8f2494eeb044',
+ help="An alternate file md5sum value used to compare the downloaded "
+ "file against for deep testing.")
+
if len(argv) == 1:
parser.print_help()
diff --git a/mirrorselect/selectors.py b/mirrorselect/selectors.py
index d72fd23..2c7bac8 100644
--- a/mirrorselect/selectors.py
+++ b/mirrorselect/selectors.py
@@ -191,6 +191,8 @@ class Deep(object):
self._dns_timeout = options.timeout
self._connect_timeout = options.timeout
self._download_timeout = options.timeout
+ self.test_file = options.file
+ self.test_md5 = options.md5
addr_families = []
if options.ipv4:
@@ -221,8 +223,12 @@ class Deep(object):
for host in hosts:
prog += 1
- self.output.print_info('Downloading 100k files from each mirror... [%s of %s]'\
- % (prog, num_hosts) )
+ if self.test_file is not 'mirrorselect-test':
+ self.output.print_info('Downloading %s files from each mirror... [%s of %s]'\
+ % (self.test_file, prog, num_hosts) )
+ else:
+ self.output.print_info('Downloading 100k files from each mirror... [%s of %s]'\
+ % (prog, num_hosts) )
mytime, ignore = self.deeptime(host, maxtime)
@@ -259,9 +265,9 @@ class Deep(object):
self.output.write('\n_deeptime(): maxtime is %s\n' % maxtime, 2)
if url.endswith('/'): #append the path to the testfile to the URL
- url = url + 'distfiles/mirrorselect-test'
+ url = url + 'distfiles/' + self.test_file
else:
- url = url + '/distfiles/mirrorselect-test'
+ url = url + '/distfiles/' + self.test_file
url_parts = url_parse(url)