From 5626f1f7e4a586ee3d3776dee07501cb379adefb Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 12 Aug 2013 16:08:12 -0700 Subject: [PATCH] emirrordist: allow missing --repo if exactly one --- pym/portage/_emirrordist/main.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pym/portage/_emirrordist/main.py b/pym/portage/_emirrordist/main.py index becd11b7b..3c7b81a37 100644 --- a/pym/portage/_emirrordist/main.py +++ b/pym/portage/_emirrordist/main.py @@ -244,9 +244,6 @@ def emirrordist_main(args): config_root = options.config_root - if options.repo is None: - parser.error("--repo option is required") - if options.portdir is not None: writemsg_level("emirrordist: warning: --portdir option is deprecated in favor of --repositories-configuration option\n", level=logging.WARNING, noiselevel=-1) @@ -275,6 +272,16 @@ def emirrordist_main(args): settings = portage.config(config_root=config_root, local_config=False, env=env) + if options.repo is None: + if len(settings.repositories.prepos) == 2: + for repo in settings.repositories: + if repo.name != "DEFAULT": + options.repo = repo.name + break + + if options.repo is None: + parser.error("--repo option is required") + repo_path = settings.repositories.treemap.get(options.repo) if repo_path is None: parser.error("Unable to locate repository named '%s'" % (options.repo,)) -- 2.26.2