1 |
Author: zmedico |
2 |
Date: 2009-04-06 23:25:22 +0000 (Mon, 06 Apr 2009) |
3 |
New Revision: 13292 |
4 |
|
5 |
Modified: |
6 |
main/trunk/bin/egencache |
7 |
main/trunk/man/egencache.1 |
8 |
Log: |
9 |
Add a --repo option, allowing cache to be generated for overlays. |
10 |
|
11 |
|
12 |
Modified: main/trunk/bin/egencache |
13 |
=================================================================== |
14 |
--- main/trunk/bin/egencache 2009-04-06 22:25:15 UTC (rev 13291) |
15 |
+++ main/trunk/bin/egencache 2009-04-06 23:25:22 UTC (rev 13292) |
16 |
@@ -34,6 +34,9 @@ |
17 |
parser.add_option("--update", |
18 |
action="store_true", |
19 |
help="update metadata/cache/ (generate as necessary)") |
20 |
+ parser.add_option("--repo", |
21 |
+ action="store", |
22 |
+ help="name of repo to operate on (default repo is located at $PORTDIR)") |
23 |
parser.add_option("--cache-dir", |
24 |
help="location of the metadata cache", |
25 |
dest="cache_dir") |
26 |
@@ -126,7 +129,7 @@ |
27 |
max_jobs=max_jobs, max_load=max_load) |
28 |
self.returncode = os.EX_OK |
29 |
metadbmodule = portdb.mysettings.load_best_module("portdbapi.metadbmodule") |
30 |
- self._trg_cache = metadbmodule(portdb.porttree_root, |
31 |
+ self._trg_cache = metadbmodule(portdb.porttrees[0], |
32 |
"metadata/cache", portage.auxdbkeys[:]) |
33 |
if rsync: |
34 |
self._trg_cache.raise_stat_collision = True |
35 |
@@ -259,8 +262,8 @@ |
36 |
# completely controlled by commandline arguments. |
37 |
env = {} |
38 |
|
39 |
- # TODO: Implement --repo for choosing a repo. |
40 |
- env['PORTDIR_OVERLAY'] = '' |
41 |
+ if options.repo is None: |
42 |
+ env['PORTDIR_OVERLAY'] = '' |
43 |
|
44 |
if options.cache_dir is not None: |
45 |
env['PORTAGE_DEPCACHEDIR'] = options.cache_dir |
46 |
@@ -300,7 +303,16 @@ |
47 |
settings.lock() |
48 |
|
49 |
portdb = portage.portdbapi(settings["PORTDIR"], mysettings=settings) |
50 |
+ if options.repo is not None: |
51 |
+ repo_path = portdb.getRepositoryPath(options.repo) |
52 |
+ if repo_path is None: |
53 |
+ parser.error("Unable to locate repository named '%s'" % \ |
54 |
+ (options.repo,)) |
55 |
+ return 1 |
56 |
|
57 |
+ # Limit ebuilds to the specified repo. |
58 |
+ portdb.porttrees = [repo_path] |
59 |
+ |
60 |
cp_iter = None |
61 |
if atoms: |
62 |
cp_iter = iter(atoms) |
63 |
|
64 |
Modified: main/trunk/man/egencache.1 |
65 |
=================================================================== |
66 |
--- main/trunk/man/egencache.1 2009-04-06 22:25:15 UTC (rev 13291) |
67 |
+++ main/trunk/man/egencache.1 2009-04-06 23:25:22 UTC (rev 13292) |
68 |
@@ -7,9 +7,7 @@ |
69 |
.SH "DESCRIPTION" |
70 |
The egencache program generates metadata cache for ebuild repositories and |
71 |
stores it in the \fImetadata/cache/\fR directory within the repository itself, |
72 |
-for distribution. Currenly, only the repository located at \fBPORTDIR\fR |
73 |
-(configured in \fBmake.conf(5)\fR) can be updated by this program, but a |
74 |
-future version will have the ability to select a different repository. |
75 |
+for distribution. |
76 |
.SH ACTIONS |
77 |
.TP |
78 |
.BR "\-\-update [ATOM] ... " |
79 |
@@ -40,6 +38,12 @@ |
80 |
.BR \-\-load\-average=LOAD |
81 |
Specifies that maximum load allowed when spawning multiple jobs. |
82 |
.TP |
83 |
+.BR "\-\-repo=REPO" |
84 |
+Name of the repo to operate on (default repo is located at \fBPORTDIR\fR). |
85 |
+The name should correspond the value of a \fBrepo_name\fR entry (see |
86 |
+\fBportage\fR(5)) from one of the repositories that is configured via the |
87 |
+\fBPORTDIR\fR or \fBPORTDIR_OVERLAY\fR variables (see \fBmake.conf\fR(5)). |
88 |
+.TP |
89 |
.BR "\-\-rsync" |
90 |
When used together with the \fB\-\-update\fR action, this enables a workaround |
91 |
for cases in which the content of a cache entry changes and neither the file |