Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-portage-dev] [PATCH] emirrordist: Support specifying custom --layout-conf
Date: Fri, 11 Oct 2019 21:25:24
Message-Id: 20191011212501.205553-1-mgorny@gentoo.org
1 Support specifying custom layout.conf file to use. This makes it
2 possible to start propagating new mirror layout without exposing it
3 to users.
4
5 Signed-off-by: Michał Górny <mgorny@g.o>
6 ---
7 lib/portage/_emirrordist/Config.py | 6 ++++--
8 lib/portage/_emirrordist/main.py | 6 ++++++
9 2 files changed, 10 insertions(+), 2 deletions(-)
10
11 diff --git a/lib/portage/_emirrordist/Config.py b/lib/portage/_emirrordist/Config.py
12 index ace3b0a6a..c1f59f725 100644
13 --- a/lib/portage/_emirrordist/Config.py
14 +++ b/lib/portage/_emirrordist/Config.py
15 @@ -74,8 +74,10 @@ class Config(object):
16 options.deletion_db, 'deletion')
17
18 self.layout_conf = MirrorLayoutConfig()
19 - self.layout_conf.read_from_file(
20 - os.path.join(self.distfiles, 'layout.conf'))
21 + if options.layout_conf is None:
22 + options.layout_conf = os.path.join(self.distfiles,
23 + 'layout.conf')
24 + self.layout_conf.read_from_file(options.layout_conf)
25 self.layouts = self.layout_conf.get_all_layouts()
26
27 def _open_log(self, log_desc, log_path, mode):
28 diff --git a/lib/portage/_emirrordist/main.py b/lib/portage/_emirrordist/main.py
29 index 0ae45ab6f..ce0c2929f 100644
30 --- a/lib/portage/_emirrordist/main.py
31 +++ b/lib/portage/_emirrordist/main.py
32 @@ -193,6 +193,12 @@ common_options = (
33 "distfiles between layouts",
34 "action" : "store_true"
35 },
36 + {
37 + "longopt" : "--layout-conf",
38 + "help" : "specifies layout.conf file to use instead of "
39 + "the one present in the distfiles directory",
40 + "metavar" : "FILE"
41 + },
42 )
43
44 def parse_args(args):
45 --
46 2.23.0