Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/
Date: Mon, 27 May 2019 17:22:12
Message-Id: 1558976865.195781b8fbfe3ee52ceb478de5058e2745d24aa2.zmedico@gentoo
1 commit: 195781b8fbfe3ee52ceb478de5058e2745d24aa2
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Mon May 27 17:02:02 2019 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Mon May 27 17:07:45 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=195781b8
7
8 netselect: use -4/-6 options (bug 582508)
9
10 Requires >=net-analyzer/netselect-0.4[ipv6(+)].
11
12 Bug: https://bugs.gentoo.org/582508
13 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
14
15 mirrorselect/selectors.py | 15 ++++++++++++---
16 1 file changed, 12 insertions(+), 3 deletions(-)
17
18 diff --git a/mirrorselect/selectors.py b/mirrorselect/selectors.py
19 index 4b7e7a2..e3f718c 100644
20 --- a/mirrorselect/selectors.py
21 +++ b/mirrorselect/selectors.py
22 @@ -65,6 +65,7 @@ class Shallow(object):
23 """handles rapid server selection via netselect"""
24
25 def __init__(self, hosts, options, output):
26 + self._options = options
27 self.output = output
28 self.urls = []
29
30 @@ -94,10 +95,18 @@ class Shallow(object):
31
32 host_string = ' '.join(hosts)
33
34 - self.output.write('\nnetselect(): running "netselect -s%d %s"\n'
35 - % (int(number), host_string), 2)
36 + cmd = ['netselect', '-s%d' % (number,)]
37 + if self._options.ipv4:
38 + cmd.append('-4')
39 + elif self._options.ipv6:
40 + cmd.append('-6')
41
42 - proc = subprocess.Popen( ['netselect', '-s%d' % (number,)] + hosts,
43 + cmd.extend(hosts)
44 +
45 + self.output.write('\nnetselect(): running "%s"\n'
46 + % ' '.join(cmd), 2)
47 +
48 + proc = subprocess.Popen(cmd,
49 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
50
51 out, err = proc.communicate()