From: Zac Medico Date: Mon, 12 Aug 2013 23:01:20 +0000 (-0700) Subject: egencache: allow missing --repo if exactly 1 repo X-Git-Tag: v2.2.0~2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=db095dbbbb7cf51b4a89e7b961dc84c1a2af2402;p=portage.git egencache: allow missing --repo if exactly 1 repo --- diff --git a/bin/egencache b/bin/egencache index 45d4fbdbc..3859a06a0 100755 --- a/bin/egencache +++ b/bin/egencache @@ -207,9 +207,6 @@ def parse_args(args): parser.error("Write access denied: --cache-dir='%s'" % \ (options.cache_dir,)) - if options.repo is None: - parser.error("--repo option is required") - if options.portdir is not None: writemsg_level("egencache: warning: --portdir option is deprecated in favor of --repositories-configuration option\n", level=logging.WARNING, noiselevel=-1) @@ -894,6 +891,16 @@ def egencache_main(args): parser.error('No action specified') return 1 + 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,))