commit:     8c92c14269dfadc87413ebd952397021b1c4dcc7
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 11 21:24:12 2019 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Oct 12 06:40:29 2019 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=8c92c142

emirrordist: Support specifying custom --layout-conf

Support specifying custom layout.conf file to use.  This makes it
possible to start propagating new mirror layout without exposing it
to users.

Reviewed-by: Zac Medico <zmedico <AT> gentoo.org>
Closes: https://github.com/gentoo/portage/pull/465
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 lib/portage/_emirrordist/Config.py | 6 ++++--
 lib/portage/_emirrordist/main.py   | 6 ++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib/portage/_emirrordist/Config.py 
b/lib/portage/_emirrordist/Config.py
index ace3b0a6a..c1f59f725 100644
--- a/lib/portage/_emirrordist/Config.py
+++ b/lib/portage/_emirrordist/Config.py
@@ -74,8 +74,10 @@ class Config(object):
                                options.deletion_db, 'deletion')
 
                self.layout_conf = MirrorLayoutConfig()
-               self.layout_conf.read_from_file(
-                               os.path.join(self.distfiles, 'layout.conf'))
+               if options.layout_conf is None:
+                       options.layout_conf = os.path.join(self.distfiles,
+                                       'layout.conf')
+               self.layout_conf.read_from_file(options.layout_conf)
                self.layouts = self.layout_conf.get_all_layouts()
 
        def _open_log(self, log_desc, log_path, mode):

diff --git a/lib/portage/_emirrordist/main.py b/lib/portage/_emirrordist/main.py
index 0ae45ab6f..ce0c2929f 100644
--- a/lib/portage/_emirrordist/main.py
+++ b/lib/portage/_emirrordist/main.py
@@ -193,6 +193,12 @@ common_options = (
                        "distfiles between layouts",
                "action"   : "store_true"
        },
+       {
+               "longopt"  : "--layout-conf",
+               "help"     : "specifies layout.conf file to use instead of "
+                       "the one present in the distfiles directory",
+               "metavar"  : "FILE"
+       },
 )
 
 def parse_args(args):

Reply via email to