Gentoo Archives: gentoo-commits

From: Arfrever Frehtes Taifersar Arahesis <arfrever@××××××.org>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/_emirrordist/
Date: Sun, 02 Feb 2014 03:15:11
Message-Id: 1391310806.d2c0a27401ad6d2ccdb6e5af293c830c7abf0ad0.arfrever@gentoo
1 commit: d2c0a27401ad6d2ccdb6e5af293c830c7abf0ad0
2 Author: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
3 AuthorDate: Sun Feb 2 03:13:26 2014 +0000
4 Commit: Arfrever Frehtes Taifersar Arahesis <arfrever <AT> apache <DOT> org>
5 CommitDate: Sun Feb 2 03:13:26 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d2c0a274
7
8 Bug #500030: emirrordist: Support directory in --whitelist-from argument.
9
10 ---
11 pym/portage/_emirrordist/main.py | 19 +++++++++++++------
12 1 file changed, 13 insertions(+), 6 deletions(-)
13
14 diff --git a/pym/portage/_emirrordist/main.py b/pym/portage/_emirrordist/main.py
15 index f28aad7..139f24f 100644
16 --- a/pym/portage/_emirrordist/main.py
17 +++ b/pym/portage/_emirrordist/main.py
18 @@ -1,4 +1,4 @@
19 -# Copyright 2013 Gentoo Foundation
20 +# Copyright 2013-2014 Gentoo Foundation
21 # Distributed under the terms of the GNU General Public License v2
22
23 import logging
24 @@ -6,7 +6,7 @@ import sys
25
26 import portage
27 from portage import os
28 -from portage.util import normalize_path, writemsg_level
29 +from portage.util import normalize_path, writemsg_level, _recursive_file_list
30 from portage.util._argparse import ArgumentParser
31 from portage.util._async.run_main_scheduler import run_main_scheduler
32 from portage.util._async.SchedulerInterface import SchedulerInterface
33 @@ -414,10 +414,17 @@ def emirrordist_main(args):
34 normalized_paths = []
35 for x in options.whitelist_from:
36 path = normalize_path(os.path.abspath(x))
37 - normalized_paths.append(path)
38 - if not (os.access(path, os.R_OK) and os.path.isfile(path)):
39 - parser.error(
40 - "--whitelist-from '%s' is not a readable file" % x)
41 + if not os.access(path, os.R_OK):
42 + parser.error("--whitelist-from '%s' is not readable" % x)
43 + if os.path.isfile(path):
44 + normalized_paths.append(path)
45 + elif os.path.isdir(path):
46 + for file in _recursive_file_list(path):
47 + if not os.access(file, os.R_OK):
48 + parser.error("--whitelist-from '%s' directory contains not readable file '%s'" % (x, file))
49 + normalized_paths.append(file)
50 + else:
51 + parser.error("--whitelist-from '%s' is not a regular file or a directory" % x)
52 options.whitelist_from = normalized_paths
53
54 if options.strict_manifests is not None: