parser.add_option("--update",
action="store_true",
help="update metadata/cache/ (generate as necessary)")
+ parser.add_option("--repo",
+ action="store",
+ help="name of repo to operate on (default repo is located at $PORTDIR)")
parser.add_option("--cache-dir",
help="location of the metadata cache",
dest="cache_dir")
max_jobs=max_jobs, max_load=max_load)
self.returncode = os.EX_OK
metadbmodule = portdb.mysettings.load_best_module("portdbapi.metadbmodule")
- self._trg_cache = metadbmodule(portdb.porttree_root,
+ self._trg_cache = metadbmodule(portdb.porttrees[0],
"metadata/cache", portage.auxdbkeys[:])
if rsync:
self._trg_cache.raise_stat_collision = True
# completely controlled by commandline arguments.
env = {}
- # TODO: Implement --repo for choosing a repo.
- env['PORTDIR_OVERLAY'] = ''
+ if options.repo is None:
+ env['PORTDIR_OVERLAY'] = ''
if options.cache_dir is not None:
env['PORTAGE_DEPCACHEDIR'] = options.cache_dir
settings.lock()
portdb = portage.portdbapi(settings["PORTDIR"], mysettings=settings)
+ if options.repo is not None:
+ repo_path = portdb.getRepositoryPath(options.repo)
+ if repo_path is None:
+ parser.error("Unable to locate repository named '%s'" % \
+ (options.repo,))
+ return 1
+
+ # Limit ebuilds to the specified repo.
+ portdb.porttrees = [repo_path]
cp_iter = None
if atoms:
.SH "DESCRIPTION"
The egencache program generates metadata cache for ebuild repositories and
stores it in the \fImetadata/cache/\fR directory within the repository itself,
-for distribution. Currenly, only the repository located at \fBPORTDIR\fR
-(configured in \fBmake.conf(5)\fR) can be updated by this program, but a
-future version will have the ability to select a different repository.
+for distribution.
.SH ACTIONS
.TP
.BR "\-\-update [ATOM] ... "
.BR \-\-load\-average=LOAD
Specifies that maximum load allowed when spawning multiple jobs.
.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)).
+.TP
.BR "\-\-rsync"
When used together with the \fB\-\-update\fR action, this enables a workaround
for cases in which the content of a cache entry changes and neither the file