Gentoo Archives: gentoo-commits

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