From 04612ddc5200e7cd796fb0b49b69d77b5e502ab3 Mon Sep 17 00:00:00 2001 From: Arfrever Frehtes Taifersar Arahesis Date: Tue, 23 Jul 2013 22:41:20 +0200 Subject: [PATCH] egencache: Require --repo option. --- bin/egencache | 31 +++++++++---------------------- man/egencache.1 | 10 ++++------ 2 files changed, 13 insertions(+), 28 deletions(-) diff --git a/bin/egencache b/bin/egencache index 2c5dddce9..921c4612d 100755 --- a/bin/egencache +++ b/bin/egencache @@ -97,7 +97,7 @@ def parse_args(args): common = optparse.OptionGroup(parser, 'Common options') common.add_option("--repo", action="store", - help="name of repo to operate on (default repo is located at $PORTDIR)") + help="name of repo to operate on") common.add_option("--config-root", help="location of portage config files", dest="portage_configroot") @@ -111,10 +111,10 @@ def parse_args(args): help="override the portage tree location (deprecated in favor of --repositories-configuration)", dest="portdir") common.add_option("--portdir-overlay", - help="override the PORTDIR_OVERLAY variable (requires that --repo is also specified) (deprecated in favor of --repositories-configuration)", + help="override the PORTDIR_OVERLAY variable (deprecated in favor of --repositories-configuration)", dest="portdir_overlay") common.add_option("--repositories-configuration", - help="override configuration of repositories (in format of repos.conf) (requires that --repo is also specified)", + help="override configuration of repositories (in format of repos.conf)", dest="repositories_configuration") common.add_option("--sign-manifests", type="choice", @@ -213,10 +213,7 @@ def parse_args(args): (options.cache_dir,)) if options.repo is None: - if options.repositories_configuration is not None: - parser.error("--repositories-configuration option requires --repo option") - if options.portdir_overlay is not None: - parser.error("--portdir-overlay option requires --repo option") + parser.error("--repo option is required") for atom in args: try: @@ -862,9 +859,7 @@ def egencache_main(args): config_root = options.config_root - if options.repo is None: - env['PORTDIR_OVERLAY'] = '' - elif options.repositories_configuration is not None: + if options.repositories_configuration is not None: env['PORTAGE_REPOSITORIES'] = options.repositories_configuration elif options.portdir_overlay: env['PORTDIR_OVERLAY'] = options.portdir_overlay @@ -897,18 +892,10 @@ def egencache_main(args): parser.error('No action specified') return 1 - repo_path = None - if options.repo is not None: - repo_path = settings.repositories.treemap.get(options.repo) - if repo_path is None: - parser.error("Unable to locate repository named '%s'" % \ - (options.repo,)) - return 1 - else: - repo_path = settings.repositories.mainRepoLocation() - if not repo_path: - parser.error("PORTDIR is undefined") - return 1 + repo_path = settings.repositories.treemap.get(options.repo) + if repo_path is None: + parser.error("Unable to locate repository named '%s'" % (options.repo,)) + return 1 repo_config = settings.repositories.get_repo_for_location(repo_path) diff --git a/man/egencache.1 b/man/egencache.1 index 81c3bbb0a..34e0b7b0c 100644 --- a/man/egencache.1 +++ b/man/egencache.1 @@ -61,8 +61,7 @@ Override the portage tree location. This option is deprecated in favor of \-\-repositories\-configuration option. .TP .BR "\-\-portdir\-overlay=PORTDIR_OVERLAY" -Override the PORTDIR_OVERLAY variable (requires that -\-\-repo is also specified). This option is deprecated in favor of +Override the PORTDIR_OVERLAY variable. This option is deprecated in favor of \-\-repositories\-configuration option. .TP .BR "\-\-preserve\-comments" @@ -70,10 +69,8 @@ Preserve the comments found in the output use.local.desc file. This requires the output file to exist before egencache is called. .TP .BR "\-\-repo=REPO" -Name of the repo to operate on (default repo is located at \fBPORTDIR\fR). -The name should correspond the value of a \fBrepo_name\fR entry (see -\fBportage\fR(5)) from one of the repositories that is configured via the -\fBPORTDIR\fR or \fBPORTDIR_OVERLAY\fR variables (see \fBmake.conf\fR(5)). +Name of the repo to operate on. The name should correspond the value of +a \fBrepo_name\fR entry (see \fBportage\fR(5)) from one of the repositories. .TP .BR "\-\-repositories\-configuration=REPOSITORIES_CONFIGURATION" Override configuration of repositories. The argument of this option has @@ -153,6 +150,7 @@ Please report bugs via http://bugs.gentoo.org/ .SH "AUTHORS" .nf Zac Medico +Arfrever Frehtes Taifersar Arahesis .fi .SH "FILES" .TP -- 2.26.2