From: Arfrever Frehtes Taifersar Arahesis Date: Wed, 24 Jul 2013 01:54:10 +0000 (+0200) Subject: emirrordist: Require --repo option, deprecate --portdir and --portdir-overlay X-Git-Tag: v2.2.0_alpha189~13 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ab7d606eb6f66004a63c9406cf9cf87b352f6d01;p=portage.git emirrordist: Require --repo option, deprecate --portdir and --portdir-overlay options, support --repositories-configuration option. --- diff --git a/man/egencache.1 b/man/egencache.1 index 34e0b7b0c..92af34784 100644 --- a/man/egencache.1 +++ b/man/egencache.1 @@ -57,7 +57,7 @@ Also see the related \fB\-\-load\-average\fR option. Specifies that maximum load allowed when spawning multiple jobs. .TP .BR "\-\-portdir=PORTDIR" -Override the portage tree location. This option is deprecated in favor of +Override the PORTDIR variable. This option is deprecated in favor of \-\-repositories\-configuration option. .TP .BR "\-\-portdir\-overlay=PORTDIR_OVERLAY" diff --git a/man/emirrordist.1 b/man/emirrordist.1 index 6d020770e..715d3d77a 100644 --- a/man/emirrordist.1 +++ b/man/emirrordist.1 @@ -1,4 +1,4 @@ -.TH "EMIRRORDIST" "1" "Jan 2013" "Portage VERSION" "Portage" +.TH "EMIRRORDIST" "1" "Jul 2013" "Portage VERSION" "Portage" .SH "NAME" emirrordist \- a fetch tool for mirroring of package distfiles .SH SYNOPSIS @@ -42,18 +42,22 @@ Maximum number of tries per file, 0 means unlimited (default is 10). .TP \fB\-\-repo\fR=\fIREPO\fR -Name of repo to operate on (default repo is located at -$PORTDIR). +Name of repo to operate on. .TP \fB\-\-config\-root\fR=\fIDIR\fR Location of portage config files. .TP \fB\-\-portdir\fR=\fIDIR\fR -Override the portage tree location. +Override the PORTDIR variable. This option is deprecated in favor of +\-\-repositories\-configuration option. .TP \fB\-\-portdir\-overlay\fR=\fIPORTDIR_OVERLAY\fR -Override the PORTDIR_OVERLAY variable (requires that -\fI\-\-repo\fR is also specified). +Override the PORTDIR_OVERLAY variable. This option is deprecated in favor of +\-\-repositories\-configuration option. +.TP +\fB\-\-repositories\-configuration=REPOSITORIES_CONFIGURATION\fR=\fIREPOSITORIES_CONFIGURATION\fR +Override configuration of repositories. The argument of this option has +the same format as repos.conf (see \fBportage\fR(5)). .TP \fB\-\-strict\-manifests=\fR Manually override "strict" FEATURES setting. @@ -131,6 +135,7 @@ which emirrordist is derived. .SH "AUTHORS" .nf Zac Medico +Arfrever Frehtes Taifersar Arahesis .fi .SH "FILES" .TP diff --git a/pym/portage/_emirrordist/main.py b/pym/portage/_emirrordist/main.py index e19f4aa7b..f4824f6b5 100644 --- a/pym/portage/_emirrordist/main.py +++ b/pym/portage/_emirrordist/main.py @@ -7,7 +7,7 @@ import sys import portage from portage import os -from portage.util import normalize_path +from portage.util import normalize_path, writemsg_level from portage.util._async.run_main_scheduler import run_main_scheduler from portage.util._async.SchedulerInterface import SchedulerInterface from portage.util._eventloop.global_event_loop import global_event_loop @@ -62,7 +62,7 @@ common_options = ( }, { "longopt" : "--repo", - "help" : "name of repo to operate on (default repo is located at $PORTDIR)" + "help" : "name of repo to operate on" }, { "longopt" : "--config-root", @@ -71,13 +71,16 @@ common_options = ( }, { "longopt" : "--portdir", - "help" : "override the portage tree location", + "help" : "override the PORTDIR variable (deprecated in favor of --repositories-configuration)", "metavar" : "DIR" }, { "longopt" : "--portdir-overlay", - "help" : "override the PORTDIR_OVERLAY variable (requires " - "that --repo is also specified)" + "help" : "override the PORTDIR_OVERLAY variable (deprecated in favor of --repositories-configuration)" + }, + { + "longopt" : "--repositories-configuration", + "help" : "override configuration of repositories (in format of repos.conf)" }, { "longopt" : "--strict-manifests", @@ -241,7 +244,17 @@ def emirrordist_main(args): config_root = options.config_root if options.repo is None: - env['PORTDIR_OVERLAY'] = '' + 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) + if options.portdir_overlay is not None: + writemsg_level("emirrordist: warning: --portdir-overlay option is deprecated in favor of --repositories-configuration option\n", + level=logging.WARNING, noiselevel=-1) + + if options.repositories_configuration is not None: + env['PORTAGE_REPOSITORIES'] = options.repositories_configuration elif options.portdir_overlay: env['PORTDIR_OVERLAY'] = options.portdir_overlay @@ -261,16 +274,9 @@ def emirrordist_main(args): settings = portage.config(config_root=config_root, local_config=False, env=env) - 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,)) - else: - repo_path = settings.repositories.mainRepoLocation() - if not repo_path: - parser.error("PORTDIR is undefined") + repo_path = settings.repositories.treemap.get(options.repo) + if repo_path is None: + parser.error("Unable to locate repository named '%s'" % (options.repo,)) if options.jobs is not None: options.jobs = int(options.jobs)