Gentoo Archives: gentoo-commits

From: Brian Dolbec <dolsen@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/mirrorselect:master commit in: /, mirrorselect/
Date: Sat, 26 May 2018 15:43:27
Message-Id: 1527349231.d0f37a2cb9734439c2d69f74c16ffb0489a30280.dolsen@gentoo
1 commit: d0f37a2cb9734439c2d69f74c16ffb0489a30280
2 Author: i.Dark_Templar <darktemplar <AT> dark-templar-archives <DOT> net>
3 AuthorDate: Sat May 26 15:28:53 2018 +0000
4 Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
5 CommitDate: Sat May 26 15:40:31 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=d0f37a2c
7
8 Mirrorselect: add 'exclude' option to allow excluding hosts from mirrors list.
9
10 mirrorselect.8 | 3 +++
11 mirrorselect/main.py | 7 +++++++
12 2 files changed, 10 insertions(+)
13
14 diff --git a/mirrorselect.8 b/mirrorselect.8
15 index cd7b8bb..3a1e304 100644
16 --- a/mirrorselect.8
17 +++ b/mirrorselect.8
18 @@ -96,6 +96,9 @@ download mirrors. If this is not specified, a default of 1 is used.
19 .TP
20 .BI \-t " TIMEOUT " "\fR,\fP \-timeout" " TIMEOUT "
21 Timeout for deep mode. Defaults to 10 seconds.
22 +.TP
23 +.BI \-e " EXCLUDE " "\fR,\fP \-exclude" " EXCLUDE "
24 +Exclude host from mirrors list.
25
26 .SH "EXAMPLES"
27 automatic:
28
29 diff --git a/mirrorselect/main.py b/mirrorselect/main.py
30 index 04698f3..b49461b 100755
31 --- a/mirrorselect/main.py
32 +++ b/mirrorselect/main.py
33 @@ -243,6 +243,9 @@ class MirrorSelect(object):
34 group.add_option(
35 "-t", "--timeout", action="store", type="int",
36 default="10", help="Timeout for deep mode. Defaults to 10 seconds.")
37 + group.add_option(
38 + "-e", "--exclude", action="append", dest="exclude",
39 + default=None, help="Exclude host from mirrors list.")
40
41
42
43 @@ -302,6 +305,10 @@ class MirrorSelect(object):
44 else:
45 self.output.write("using url: %s\n" % MIRRORS_3_XML, 2)
46 hosts = Extractor(MIRRORS_3_XML, options, self.output).hosts
47 +
48 + if options.exclude:
49 + hosts = [x for x in hosts if x[0] not in options.exclude]
50 +
51 return hosts