[PATCH] emirrordist: Support specifying custom --layout-conf

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] emirrordist: Support specifying custom --layout-conf

Michał Górny-5
Support specifying custom layout.conf file to use.  This makes it
possible to start propagating new mirror layout without exposing it
to users.

Signed-off-by: Michał Górny <[hidden email]>
---
 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):
--
2.23.0