summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-04-30 06:58:43 +0000
committerZac Medico <zmedico@gentoo.org>2009-04-30 06:58:43 +0000
commitbbcf8935ce64ed6bdf0cbb883e84d03b43cde05c (patch)
treeca9de970028ad070fefbd854e5f224c3d3a21940 /bin
parentAdd portdbapi support for a metadata/layout.conf file which (diff)
downloadportage-multirepo-bbcf8935ce64ed6bdf0cbb883e84d03b43cde05c.tar.gz
portage-multirepo-bbcf8935ce64ed6bdf0cbb883e84d03b43cde05c.tar.bz2
portage-multirepo-bbcf8935ce64ed6bdf0cbb883e84d03b43cde05c.zip
Add a --repo option, allowing cache to be generated for overlays. (trunk r13292)
svn path=/main/branches/2.1.6/; revision=13463
Diffstat (limited to 'bin')
-rwxr-xr-xbin/egencache18
1 files changed, 15 insertions, 3 deletions
diff --git a/bin/egencache b/bin/egencache
index 487901cf..47e4ea2c 100755
--- a/bin/egencache
+++ b/bin/egencache
@@ -34,6 +34,9 @@ def parse_args(args):
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")
@@ -126,7 +129,7 @@ class GenCache(object):
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
@@ -259,8 +262,8 @@ def egencache_main(args):
# 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
@@ -300,6 +303,15 @@ def egencache_main(args):
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: