1 |
Author: zmedico |
2 |
Date: 2008-04-21 04:00:24 +0000 (Mon, 21 Apr 2008) |
3 |
New Revision: 9930 |
4 |
|
5 |
Modified: |
6 |
main/trunk/cnf/make.globals |
7 |
main/trunk/man/make.conf.5 |
8 |
main/trunk/man/portage.5 |
9 |
main/trunk/pym/portage/dbapi/porttree.py |
10 |
Log: |
11 |
* Make portdbapi.aux_get() automatically pull pre-generated metadata |
12 |
directly from the metadata/cache/ directory when metadata-transfer |
13 |
is not enabled in FEATURES. This makes all cache modules behave |
14 |
similar to existing metadata_overlay module, except when |
15 |
FEATURES="metadata-transfer" has been explicitly enabled. |
16 |
|
17 |
* Remove metadata-transfer from FEATURES in make.globals so that it's |
18 |
no longer enabled by default. Users will be happy about this since |
19 |
the "Updating Portage cache" part of emerge --sync can be more time |
20 |
consuming than the rsync run itself. It's also nicer when when using |
21 |
PORTDIR over nfs or bind mounted in a chroot since there's no need |
22 |
to run emerge --metadata. |
23 |
|
24 |
* Update FEATURES="metadata-transfer" docs to warn users of the rsync |
25 |
tree to modify eclases in PORTDIR_OVERLAY if necessary instead of |
26 |
doing it directly in the rsync tree. |
27 |
|
28 |
* Relevant updates to /etc/portage/modules docs. |
29 |
|
30 |
|
31 |
Modified: main/trunk/cnf/make.globals |
32 |
=================================================================== |
33 |
--- main/trunk/cnf/make.globals 2008-04-20 20:53:33 UTC (rev 9929) |
34 |
+++ main/trunk/cnf/make.globals 2008-04-21 04:00:24 UTC (rev 9930) |
35 |
@@ -38,7 +38,7 @@ |
36 |
RESUMECOMMAND="/usr/bin/wget -c -t 5 -T 60 --passive-ftp -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" |
37 |
|
38 |
# Default user options |
39 |
-FEATURES="distlocks parallel-fetch metadata-transfer sandbox sfperms strict unmerge-orphans userfetch" |
40 |
+FEATURES="distlocks parallel-fetch sandbox sfperms strict unmerge-orphans userfetch" |
41 |
|
42 |
# Enable for global testing |
43 |
FEATURES="${FEATURES} preserve-libs" |
44 |
|
45 |
Modified: main/trunk/man/make.conf.5 |
46 |
=================================================================== |
47 |
--- main/trunk/man/make.conf.5 2008-04-20 20:53:33 UTC (rev 9929) |
48 |
+++ main/trunk/man/make.conf.5 2008-04-21 04:00:24 UTC (rev 9930) |
49 |
@@ -215,6 +215,16 @@ |
50 |
.TP |
51 |
.B metadata\-transfer |
52 |
Automatically perform a metadata transfer when `emerge \-\-sync` is run. |
53 |
+In versions of portage greater than 2.1.5, this feature is disabled by |
54 |
+default. When metadata\-transfer is disabled, metadata cache from the |
55 |
+${PORTDIR}/metadata/cache/ directory will be used directly (if available) |
56 |
+and eclasses in ${PORTDIR}/eclass/ must not be modified except by |
57 |
+`emerge \-\-sync` operations since the cache validation mechanism |
58 |
+will not recognize eclass modifications. Normally, this issue only |
59 |
+pertains to users of the rsync tree since the cvs tree does not contain |
60 |
+a metadata/cache/ directory. Users of the rsync tree who want to modify |
61 |
+eclasses should use \fBPORTDIR_OVERLAY\fR in order for the cache |
62 |
+validation mechanism to work correctly. |
63 |
.TP |
64 |
.B mirror |
65 |
Fetch everything in \fBSRC_URI\fR regardless of \fBUSE\fR settings, |
66 |
|
67 |
Modified: main/trunk/man/portage.5 |
68 |
=================================================================== |
69 |
--- main/trunk/man/portage.5 2008-04-20 20:53:33 UTC (rev 9929) |
70 |
+++ main/trunk/man/portage.5 2008-04-21 04:00:24 UTC (rev 9930) |
71 |
@@ -384,18 +384,15 @@ |
72 |
|
73 |
.I Example: |
74 |
.nf |
75 |
-portdbapi.auxdbmodule = portage.cache.metadata_overlay.database |
76 |
+portdbapi.auxdbmodule = portage.cache.sqlite.database |
77 |
.fi |
78 |
|
79 |
-The metadata_overlay cache module makes it possible to disable |
80 |
-FEATURES="metadata-transfer" in \fBmake.conf\fR(5). When the user initially |
81 |
-enables metadata_overlay in /etc/portage/modules, all of the cache files |
82 |
-contained in /var/cache/edb/dep/${PORTDIR} must be manually removed in order |
83 |
-to avoid unecessary cache regeneration. In addition, users of the |
84 |
-metadata_overlay module must never modify eclasses in ${PORTDIR} because |
85 |
-portage will not be able to detect that cache regeneration is necessary. If |
86 |
-the user would like to modify eclasses, it is safe to use metadata_overlay |
87 |
-together with PORTDIR_OVERLAY in \fBmake.conf\fR. |
88 |
+After changing the portdbapi.auxdbmodule setting, it may be necessary to |
89 |
+transfer or regenerate metadata cache. Users of the rsync tree need to |
90 |
+run `emerge \-\-metadata` if they have enabled FEATURES="metadata-transfer" |
91 |
+in \fBmake.conf\fR(5). In order to regenerate metadata for repositories |
92 |
+listed in \fBPORTDIR_OVERLAY\fR or a cvs tree, run `emerge \-\-regen` |
93 |
+(see \fBemerge\fR(1)). |
94 |
.TP |
95 |
.BR package.keywords |
96 |
Per\-package KEYWORDS. Useful for mixing unstable packages in with a normally |
97 |
|
98 |
Modified: main/trunk/pym/portage/dbapi/porttree.py |
99 |
=================================================================== |
100 |
--- main/trunk/pym/portage/dbapi/porttree.py 2008-04-20 20:53:33 UTC (rev 9929) |
101 |
+++ main/trunk/pym/portage/dbapi/porttree.py 2008-04-21 04:00:24 UTC (rev 9930) |
102 |
@@ -107,6 +107,7 @@ |
103 |
|
104 |
self.auxdbmodule = self.mysettings.load_best_module("portdbapi.auxdbmodule") |
105 |
self.auxdb = {} |
106 |
+ self._pregen_auxdb = {} |
107 |
self._init_cache_dirs() |
108 |
# XXX: REMOVE THIS ONCE UNUSED_0 IS YANKED FROM auxdbkeys |
109 |
# ~harring |
110 |
@@ -125,6 +126,11 @@ |
111 |
# location, label, auxdbkeys |
112 |
self.auxdb[x] = self.auxdbmodule( |
113 |
self.depcachedir, x, filtered_auxdbkeys, gid=portage_gid) |
114 |
+ if "metadata-transfer" not in self.mysettings.features: |
115 |
+ for x in self.porttrees: |
116 |
+ if os.path.isdir(os.path.join(x, "metadata", "cache")): |
117 |
+ self._pregen_auxdb[x] = self.metadbmodule( |
118 |
+ x, "metadata/cache", filtered_auxdbkeys, readonly=True) |
119 |
# Selectively cache metadata in order to optimize dep matching. |
120 |
self._aux_cache_keys = set( |
121 |
["DEPEND", "EAPI", "IUSE", "KEYWORDS", "LICENSE", |
122 |
@@ -283,28 +289,41 @@ |
123 |
noiselevel=-1) |
124 |
raise KeyError(mycpv) |
125 |
|
126 |
- try: |
127 |
- mydata = self.auxdb[mylocation][mycpv] |
128 |
- eapi = mydata.get("EAPI","").strip() |
129 |
- if not eapi: |
130 |
- eapi = "0" |
131 |
- if eapi.startswith("-") and eapi_is_supported(eapi[1:]): |
132 |
- doregen = True |
133 |
- elif emtime != long(mydata.get("_mtime_", 0)): |
134 |
- doregen = True |
135 |
- elif len(mydata.get("_eclasses_", [])) > 0: |
136 |
- doregen = not self.eclassdb.is_eclass_data_valid(mydata["_eclasses_"]) |
137 |
- else: |
138 |
- doregen = False |
139 |
- |
140 |
- except KeyError: |
141 |
- doregen = True |
142 |
- except CacheError: |
143 |
- doregen = True |
144 |
+ # Pull pre-generated metadata from the metadata/cache/ |
145 |
+ # directory if it exists and is valid, otherwise fall |
146 |
+ # back to the normal writable cache. |
147 |
+ auxdbs = [] |
148 |
+ pregen_auxdb = self._pregen_auxdb.get(mylocation) |
149 |
+ if pregen_auxdb is not None: |
150 |
+ auxdbs.append(pregen_auxdb) |
151 |
+ auxdbs.append(self.auxdb[mylocation]) |
152 |
+ |
153 |
+ doregen = True |
154 |
+ for auxdb in auxdbs: |
155 |
try: |
156 |
- del self.auxdb[mylocation][mycpv] |
157 |
+ mydata = auxdb[mycpv] |
158 |
+ eapi = mydata.get("EAPI","").strip() |
159 |
+ if not eapi: |
160 |
+ eapi = "0" |
161 |
+ if eapi.startswith("-") and eapi_is_supported(eapi[1:]): |
162 |
+ pass |
163 |
+ elif emtime != long(mydata.get("_mtime_", 0)): |
164 |
+ pass |
165 |
+ elif len(mydata.get("_eclasses_", [])) > 0: |
166 |
+ if self.eclassdb.is_eclass_data_valid(mydata["_eclasses_"]): |
167 |
+ doregen = False |
168 |
+ else: |
169 |
+ doregen = False |
170 |
except KeyError: |
171 |
pass |
172 |
+ except CacheError: |
173 |
+ if auxdb is not pregen_auxdb: |
174 |
+ try: |
175 |
+ del auxdb[mycpv] |
176 |
+ except KeyError: |
177 |
+ pass |
178 |
+ if not doregen: |
179 |
+ break |
180 |
|
181 |
writemsg("auxdb is valid: "+str(not doregen)+" "+str(pkg)+"\n", 2) |
182 |
|
183 |
|
184 |
-- |
185 |
gentoo-commits@l.g.o mailing list |