1 |
Author: grobian |
2 |
Date: 2010-02-19 10:14:15 +0000 (Fri, 19 Feb 2010) |
3 |
New Revision: 15385 |
4 |
|
5 |
Modified: |
6 |
main/branches/prefix/pym/_emerge/EbuildBuildDir.py |
7 |
main/branches/prefix/pym/_emerge/Package.py |
8 |
main/branches/prefix/pym/portage/__init__.py |
9 |
main/branches/prefix/pym/portage/dbapi/bintree.py |
10 |
main/branches/prefix/pym/portage/dbapi/porttree.py |
11 |
main/branches/prefix/pym/portage/dbapi/vartree.py |
12 |
Log: |
13 |
Merged from trunk -r15350:15360 |
14 |
|
15 |
|15351 |Evaluate conditional USE deps for *DEPEND atoms saved in vdb entries. | |
16 |
|zmedico| | |
17 |
|
18 |
|15352 |Bug #304981 - Truncate the build log after successful fetch, instead of removing it, so as| |
19 |
|zmedico|not to interfere with tail -f. | |
20 |
|
21 |
|15353 |Prevent CHOST vdb entries from being created for virtual packages. | |
22 |
|zmedico| | |
23 |
|
24 |
|15354 |Make sure that config._accept_chost() accepts empty CHOST. | |
25 |
|zmedico| | |
26 |
|
27 |
|15355 |Use config.environ() instead of config.items() when spawning FETCHCOMMAND. | |
28 |
|zmedico| | |
29 |
|
30 |
|15356 |Add a 'trees' parameter to portdbapi.cp_all(). Thanks to Brian Dolbec (dol-sen) for this | |
31 |
|zmedico|patch. | |
32 |
|
33 |
|15357 |Add a BUILD_TIME vdb entry containing the integer number of seconds since the unix Epoch. | |
34 |
|zmedico|This will be useful for creating package sets that involve comparison of installed | |
35 |
| |packages to binary packages, especially for binhost users. See discussion here: | |
36 |
| |http://archives.gentoo.org/gentoo-portage-dev/msg_d068a8deefd179cc23808bc23f3de200.xml | |
37 |
|
38 |
|15358 |Cache BUILD_TIME in vdb_metadata.pickle. | |
39 |
|zmedico| | |
40 |
|
41 |
|15359 |Cache BUILD_TIME in Package.metadata. | |
42 |
|zmedico| | |
43 |
|
44 |
|15360 |Cache BUILD_TIME in $PKGDIR/Packages and inside bindbapi. | |
45 |
|zmedico| | |
46 |
|
47 |
|
48 |
Modified: main/branches/prefix/pym/_emerge/EbuildBuildDir.py |
49 |
=================================================================== |
50 |
--- main/branches/prefix/pym/_emerge/EbuildBuildDir.py 2010-02-19 10:12:27 UTC (rev 15384) |
51 |
+++ main/branches/prefix/pym/_emerge/EbuildBuildDir.py 2010-02-19 10:14:15 UTC (rev 15385) |
52 |
@@ -64,10 +64,11 @@ |
53 |
def clean_log(self): |
54 |
"""Discard existing log.""" |
55 |
settings = self.settings |
56 |
- |
57 |
- for x in ('.logid', 'temp/build.log'): |
58 |
+ log_file = settings.get('PORTAGE_LOG_FILE') |
59 |
+ if log_file is not None and os.path.isfile(log_file): |
60 |
+ # Truncate rather than unlink, so tail -f still works. |
61 |
try: |
62 |
- os.unlink(os.path.join(settings["PORTAGE_BUILDDIR"], x)) |
63 |
+ open(log_file, 'wb') |
64 |
except OSError: |
65 |
pass |
66 |
|
67 |
|
68 |
Modified: main/branches/prefix/pym/_emerge/Package.py |
69 |
=================================================================== |
70 |
--- main/branches/prefix/pym/_emerge/Package.py 2010-02-19 10:12:27 UTC (rev 15384) |
71 |
+++ main/branches/prefix/pym/_emerge/Package.py 2010-02-19 10:14:15 UTC (rev 15385) |
72 |
@@ -28,7 +28,7 @@ |
73 |
("_use",) |
74 |
|
75 |
metadata_keys = [ |
76 |
- "CHOST", "COUNTER", "DEPEND", "EAPI", |
77 |
+ "BUILD_TIME", "CHOST", "COUNTER", "DEPEND", "EAPI", |
78 |
"INHERITED", "IUSE", "KEYWORDS", |
79 |
"LICENSE", "PDEPEND", "PROVIDE", "RDEPEND", |
80 |
"repository", "PROPERTIES", "RESTRICT", "SLOT", "USE", "_mtime_", |
81 |
|
82 |
Modified: main/branches/prefix/pym/portage/__init__.py |
83 |
=================================================================== |
84 |
--- main/branches/prefix/pym/portage/__init__.py 2010-02-19 10:12:27 UTC (rev 15384) |
85 |
+++ main/branches/prefix/pym/portage/__init__.py 2010-02-19 10:14:15 UTC (rev 15385) |
86 |
@@ -3264,8 +3264,9 @@ |
87 |
(" ".join(accept_chost), e), noiselevel=-1) |
88 |
self._accept_chost_re = re.compile("^$") |
89 |
|
90 |
- return self._accept_chost_re.match( |
91 |
- metadata.get('CHOST', '')) is not None |
92 |
+ pkg_chost = metadata.get('CHOST', '') |
93 |
+ return not pkg_chost or \ |
94 |
+ self._accept_chost_re.match(pkg_chost) is not None |
95 |
|
96 |
def setinst(self,mycpv,mydbapi): |
97 |
"""This updates the preferences for old-style virtuals, |
98 |
@@ -4264,7 +4265,7 @@ |
99 |
if args[0] != BASH_BINARY: |
100 |
args = [BASH_BINARY, "-c", "exec \"$@\"", args[0]] + args |
101 |
|
102 |
- rval = spawn_func(args, env=dict(iter(settings.items())), **kwargs) |
103 |
+ rval = spawn_func(args, env=settings.environ(), **kwargs) |
104 |
|
105 |
return rval |
106 |
|
107 |
@@ -5883,6 +5884,9 @@ |
108 |
CHOST variable, so revert it to the initial |
109 |
setting. |
110 |
""" |
111 |
+ if settings.get('CATEGORY') == 'virtual': |
112 |
+ return |
113 |
+ |
114 |
chost = settings.get('CHOST') |
115 |
if chost: |
116 |
write_atomic(os.path.join(settings['PORTAGE_BUILDDIR'], |
117 |
@@ -5890,6 +5894,7 @@ |
118 |
|
119 |
_vdb_use_conditional_keys = ('DEPEND', 'LICENSE', 'PDEPEND', |
120 |
'PROPERTIES', 'PROVIDE', 'RDEPEND', 'RESTRICT',) |
121 |
+_vdb_use_conditional_atoms = frozenset(['DEPEND', 'PDEPEND', 'RDEPEND']) |
122 |
|
123 |
def _post_src_install_uid_fix(mysettings, out=None): |
124 |
""" |
125 |
@@ -6001,6 +6006,11 @@ |
126 |
'w', encoding=_encodings['repo.content'], |
127 |
errors='strict').write(str(size) + '\n') |
128 |
|
129 |
+ codecs.open(_unicode_encode(os.path.join(build_info_dir, |
130 |
+ 'BUILD_TIME'), encoding=_encodings['fs'], errors='strict'), |
131 |
+ 'w', encoding=_encodings['repo.content'], |
132 |
+ errors='strict').write(str(int(time.time())) + '\n') |
133 |
+ |
134 |
use = frozenset(mysettings['PORTAGE_USE'].split()) |
135 |
for k in _vdb_use_conditional_keys: |
136 |
v = mysettings.configdict['pkg'].get(k) |
137 |
@@ -6012,6 +6022,16 @@ |
138 |
v = dep.paren_enclose(v) |
139 |
if not v: |
140 |
continue |
141 |
+ if v in _vdb_use_conditional_atoms: |
142 |
+ v_split = [] |
143 |
+ for x in v.split(): |
144 |
+ try: |
145 |
+ x = dep.Atom(x) |
146 |
+ except exception.InvalidAtom: |
147 |
+ v_split.append(x) |
148 |
+ else: |
149 |
+ v_split.append(str(x.evaluate_conditionals(use))) |
150 |
+ v = ' '.join(v_split) |
151 |
codecs.open(_unicode_encode(os.path.join(build_info_dir, |
152 |
k), encoding=_encodings['fs'], errors='strict'), |
153 |
mode='w', encoding=_encodings['repo.content'], |
154 |
|
155 |
Modified: main/branches/prefix/pym/portage/dbapi/bintree.py |
156 |
=================================================================== |
157 |
--- main/branches/prefix/pym/portage/dbapi/bintree.py 2010-02-19 10:12:27 UTC (rev 15384) |
158 |
+++ main/branches/prefix/pym/portage/dbapi/bintree.py 2010-02-19 10:14:15 UTC (rev 15385) |
159 |
@@ -50,7 +50,7 @@ |
160 |
self.cpdict={} |
161 |
# Selectively cache metadata in order to optimize dep matching. |
162 |
self._aux_cache_keys = set( |
163 |
- ["CHOST", "DEPEND", "EAPI", "IUSE", "KEYWORDS", |
164 |
+ ["BUILD_TIME", "CHOST", "DEPEND", "EAPI", "IUSE", "KEYWORDS", |
165 |
"LICENSE", "PDEPEND", "PROPERTIES", "PROVIDE", |
166 |
"RDEPEND", "repository", "RESTRICT", "SLOT", "USE", |
167 |
"EPREFIX"]) |
168 |
@@ -189,7 +189,7 @@ |
169 |
self._pkgindex_keys = self.dbapi._aux_cache_keys.copy() |
170 |
self._pkgindex_keys.update(["CPV", "MTIME", "SIZE"]) |
171 |
self._pkgindex_aux_keys = \ |
172 |
- ["CHOST", "DEPEND", "DESCRIPTION", "EAPI", |
173 |
+ ["BUILD_TIME", "CHOST", "DEPEND", "DESCRIPTION", "EAPI", |
174 |
"IUSE", "KEYWORDS", "LICENSE", "PDEPEND", "PROPERTIES", |
175 |
"PROVIDE", "RDEPEND", "repository", "SLOT", "USE", |
176 |
"EPREFIX"] |
177 |
@@ -203,6 +203,7 @@ |
178 |
"CHOST", "CONFIG_PROTECT", "CONFIG_PROTECT_MASK", "FEATURES", |
179 |
"GENTOO_MIRRORS", "INSTALL_MASK", "SYNC", "USE", "EPREFIX"]) |
180 |
self._pkgindex_default_pkg_data = { |
181 |
+ "BUILD_TIME" : "", |
182 |
"DEPEND" : "", |
183 |
"EAPI" : "0", |
184 |
"IUSE" : "", |
185 |
@@ -1052,6 +1053,16 @@ |
186 |
writemsg("%s: %s\n" % (k, str(e)), |
187 |
noiselevel=-1) |
188 |
raise |
189 |
+ if k in portage._vdb_use_conditional_atoms: |
190 |
+ v_split = [] |
191 |
+ for x in deps.split(): |
192 |
+ try: |
193 |
+ x = portage.dep.Atom(x) |
194 |
+ except portage.exception.InvalidAtom: |
195 |
+ v_split.append(x) |
196 |
+ else: |
197 |
+ v_split.append(str(x.evaluate_conditionals(raw_use))) |
198 |
+ deps = ' '.join(v_split) |
199 |
metadata[k] = deps |
200 |
|
201 |
def exists_specific(self, cpv): |
202 |
|
203 |
Modified: main/branches/prefix/pym/portage/dbapi/porttree.py |
204 |
=================================================================== |
205 |
--- main/branches/prefix/pym/portage/dbapi/porttree.py 2010-02-19 10:12:27 UTC (rev 15384) |
206 |
+++ main/branches/prefix/pym/portage/dbapi/porttree.py 2010-02-19 10:14:15 UTC (rev 15385) |
207 |
@@ -901,13 +901,22 @@ |
208 |
else: |
209 |
return 0 |
210 |
|
211 |
- def cp_all(self, categories=None): |
212 |
- "returns a list of all keys in our tree" |
213 |
+ def cp_all(self, categories=None, trees=None): |
214 |
+ """ |
215 |
+ This returns a list of all keys in our tree or trees |
216 |
+ @param categories: optional list of categories to search or |
217 |
+ defaults to self.settings.categories |
218 |
+ @param trees: optional list of trees to search the categories in or |
219 |
+ defaults to self.porttrees |
220 |
+ @rtype list of [cat/pkg,...] |
221 |
+ """ |
222 |
d = {} |
223 |
if categories is None: |
224 |
categories = self.settings.categories |
225 |
+ if trees is None: |
226 |
+ trees = self.porttrees |
227 |
for x in categories: |
228 |
- for oroot in self.porttrees: |
229 |
+ for oroot in trees: |
230 |
for y in listdir(oroot+"/"+x, EmptyOnError=1, ignorecvs=1, dirsonly=1): |
231 |
if not self._pkg_dir_name_re.match(y) or \ |
232 |
y == "CVS": |
233 |
|
234 |
Modified: main/branches/prefix/pym/portage/dbapi/vartree.py |
235 |
=================================================================== |
236 |
--- main/branches/prefix/pym/portage/dbapi/vartree.py 2010-02-19 10:12:27 UTC (rev 15384) |
237 |
+++ main/branches/prefix/pym/portage/dbapi/vartree.py 2010-02-19 10:14:15 UTC (rev 15385) |
238 |
@@ -1816,7 +1816,7 @@ |
239 |
vartree = db[root]["vartree"] |
240 |
self.vartree = vartree |
241 |
self._aux_cache_keys = set( |
242 |
- ["CHOST", "COUNTER", "DEPEND", "DESCRIPTION", |
243 |
+ ["BUILD_TIME", "CHOST", "COUNTER", "DEPEND", "DESCRIPTION", |
244 |
"EAPI", "HOMEPAGE", "IUSE", "KEYWORDS", |
245 |
"LICENSE", "PDEPEND", "PROPERTIES", "PROVIDE", "RDEPEND", |
246 |
"repository", "RESTRICT" , "SLOT", "USE"]) |
247 |
@@ -4450,6 +4450,13 @@ |
248 |
|
249 |
slot = '' |
250 |
for var_name in ('CHOST', 'SLOT'): |
251 |
+ if var_name == 'CHOST' and self.cat == 'virtual': |
252 |
+ try: |
253 |
+ os.unlink(os.path.join(inforoot, var_name)) |
254 |
+ except OSError: |
255 |
+ pass |
256 |
+ continue |
257 |
+ |
258 |
try: |
259 |
val = codecs.open(_unicode_encode( |
260 |
os.path.join(inforoot, var_name), |