1 |
Author: grobian |
2 |
Date: 2008-11-05 18:08:52 +0000 (Wed, 05 Nov 2008) |
3 |
New Revision: 11810 |
4 |
|
5 |
Modified: |
6 |
main/branches/prefix/bin/ebuild.sh |
7 |
main/branches/prefix/bin/repoman |
8 |
main/branches/prefix/pym/_emerge/__init__.py |
9 |
main/branches/prefix/pym/portage/__init__.py |
10 |
main/branches/prefix/pym/portage/dbapi/vartree.py |
11 |
main/branches/prefix/pym/portage/util.py |
12 |
Log: |
13 |
Merged from trunk -r11799:11809 |
14 |
|
15 |
| 11800 | Remove locking from EbuildFetchPretend since it uses a | |
16 |
| zmedico | private temp directory now (since bug #245231). | |
17 |
|
18 |
| 11801 | Remove duplicate code inside EbuildFetchPretend._execute(). | |
19 |
| zmedico | | |
20 |
|
21 |
| 11802 | Import shutil globally. | |
22 |
| zmedico | | |
23 |
|
24 |
| 11803 | Make metadata.missing and metadata.bad fatal by removing | |
25 |
| zmedico | them from the qawarnings set. Thanks to Robin H. Johnson | |
26 |
| | <robbat2@g.o> for the suggestion. | |
27 |
|
28 |
| 11804 | Bug #245356 - Filter POSIXLY_CORRECT from the ebuild | |
29 |
| zmedico | environment since it breaks stuff. | |
30 |
|
31 |
| 11805 | Bug #245358 - For unsatisfied dependencies, display the | |
32 |
| zmedico | parent nodes and the argument that pulled them in. | |
33 |
|
34 |
| 11806 | Bug #245362 - Use tuples of (device, inode) for all path | |
35 |
| zmedico | comparisons inside LinkageMap, so that they work regardless | |
36 |
| | of path differences due to symlinked directories. TODO: Fix | |
37 |
| | other preserve-libs code, such as dblink._preserve_libs(), | |
38 |
| | to use this approach for path comparisons. | |
39 |
|
40 |
| 11807 | Free some memory by clearing the LinkageMap cache when it's | |
41 |
| zmedico | not needed. | |
42 |
|
43 |
| 11808 | Synchronize portage update/restart logic in dblink.merge() | |
44 |
| zmedico | and depgraph.display() so it's consistent with | |
45 |
| | Scheduler._is_restart_necessary(). Thanks to Jeremy Olexa | |
46 |
| | <darkside@g.o> for reporting. | |
47 |
|
48 |
| 11809 | Fix broken reference to self inside unmerge(). | |
49 |
| zmedico | | |
50 |
|
51 |
|
52 |
Modified: main/branches/prefix/bin/ebuild.sh |
53 |
=================================================================== |
54 |
--- main/branches/prefix/bin/ebuild.sh 2008-11-04 23:43:38 UTC (rev 11809) |
55 |
+++ main/branches/prefix/bin/ebuild.sh 2008-11-05 18:08:52 UTC (rev 11810) |
56 |
@@ -1608,7 +1608,7 @@ |
57 |
SANDBOX_DEBUG_LOG SANDBOX_DISABLED SANDBOX_LIB |
58 |
SANDBOX_LOG SANDBOX_ON" |
59 |
filtered_vars="${readonly_bash_vars} ${READONLY_PORTAGE_VARS} |
60 |
- BASH_.* PATH" |
61 |
+ BASH_.* PATH POSIXLY_CORRECT" |
62 |
if hasq --filter-sandbox $* ; then |
63 |
filtered_vars="${filtered_vars} SANDBOX_.*" |
64 |
else |
65 |
|
66 |
Modified: main/branches/prefix/bin/repoman |
67 |
=================================================================== |
68 |
--- main/branches/prefix/bin/repoman 2008-11-04 23:43:38 UTC (rev 11809) |
69 |
+++ main/branches/prefix/bin/repoman 2008-11-05 18:08:52 UTC (rev 11810) |
70 |
@@ -349,8 +349,6 @@ |
71 |
"file.size", |
72 |
"inherit.autotools", |
73 |
"java.eclassesnotused", |
74 |
-"metadata.missing", |
75 |
-"metadata.bad", |
76 |
"virtual.versioned", |
77 |
"virtual.exists", |
78 |
"virtual.unavailable", |
79 |
|
80 |
Modified: main/branches/prefix/pym/_emerge/__init__.py |
81 |
=================================================================== |
82 |
--- main/branches/prefix/pym/_emerge/__init__.py 2008-11-04 23:43:38 UTC (rev 11809) |
83 |
+++ main/branches/prefix/pym/_emerge/__init__.py 2008-11-05 18:08:52 UTC (rev 11810) |
84 |
@@ -1634,13 +1634,17 @@ |
85 |
return retval |
86 |
|
87 |
def _execute(self): |
88 |
- build_dir = EbuildBuildDir(pkg=self.pkg, settings=self.settings) |
89 |
- build_dir.lock() |
90 |
- build_dir.clean() |
91 |
+ settings = self.settings |
92 |
+ pkg = self.pkg |
93 |
+ root_config = pkg.root_config |
94 |
+ portdb = root_config.trees["porttree"].dbapi |
95 |
+ ebuild_path = portdb.findname(pkg.cpv) |
96 |
+ settings.setcpv(pkg) |
97 |
+ debug = settings.get("PORTAGE_DEBUG") == "1" |
98 |
+ use_cache = 1 # always true |
99 |
+ portage.doebuild_environment(ebuild_path, "fetch", |
100 |
+ root_config.root, settings, debug, use_cache, portdb) |
101 |
portage.prepare_build_dirs(self.pkg.root, self.settings, 0) |
102 |
- portdb = self.pkg.root_config.trees["porttree"].dbapi |
103 |
- ebuild_path = portdb.findname(self.pkg.cpv) |
104 |
- debug = self.settings.get("PORTAGE_DEBUG") == "1" |
105 |
|
106 |
retval = portage.doebuild(ebuild_path, "fetch", |
107 |
self.settings["ROOT"], self.settings, debug=debug, |
108 |
@@ -1648,8 +1652,6 @@ |
109 |
mydbapi=portdb, tree="porttree") |
110 |
|
111 |
portage.elog.elog_process(self.pkg.cpv, self.settings) |
112 |
- build_dir.clean() |
113 |
- build_dir.unlock() |
114 |
return retval |
115 |
|
116 |
class AsynchronousTask(SlotObject): |
117 |
@@ -5313,10 +5315,6 @@ |
118 |
xinfo='"%s"' % arg |
119 |
# Discard null/ from failed cpv_expand category expansion. |
120 |
xinfo = xinfo.replace("null/", "") |
121 |
- if myparent: |
122 |
- xfrom = '(dependency required by '+ \ |
123 |
- green('"%s"' % myparent[2]) + \ |
124 |
- red(' [%s]' % myparent[0]) + ')' |
125 |
masked_packages = [] |
126 |
missing_use = [] |
127 |
missing_licenses = [] |
128 |
@@ -5415,8 +5413,24 @@ |
129 |
show_mask_docs() |
130 |
else: |
131 |
print "\nemerge: there are no ebuilds to satisfy "+green(xinfo)+"." |
132 |
- if myparent: |
133 |
- print xfrom |
134 |
+ |
135 |
+ # Show parent nodes and the argument that pulled them in. |
136 |
+ node = myparent |
137 |
+ msg = [] |
138 |
+ while node is not None: |
139 |
+ msg.append('(dependency required by "%s" [%s])' % \ |
140 |
+ (colorize('INFORM', str(node.cpv)), node.type_name)) |
141 |
+ parent = None |
142 |
+ for parent in self.digraph.parent_nodes(node): |
143 |
+ if isinstance(parent, DependencyArg): |
144 |
+ msg.append('(dependency required by "%s" [argument])' % \ |
145 |
+ (colorize('INFORM', str(parent)))) |
146 |
+ parent = None |
147 |
+ break |
148 |
+ node = parent |
149 |
+ for line in msg: |
150 |
+ print line |
151 |
+ |
152 |
print |
153 |
|
154 |
def _select_pkg_highest_available(self, root, atom, onlydeps=False): |
155 |
@@ -7553,15 +7567,9 @@ |
156 |
not self._opts_no_restart.intersection(self.myopts) and \ |
157 |
pkg.root == self._running_root.root and \ |
158 |
portage.match_from_list( |
159 |
- portage.const.PORTAGE_PACKAGE_ATOM, [pkg]): |
160 |
- |
161 |
- pn, ver, rev = pkg.pv_split |
162 |
- if rev == "r0": |
163 |
- myversion = ver |
164 |
- else: |
165 |
- myversion = "%s-%s" % (ver, rev) |
166 |
- |
167 |
- if myversion != portage.VERSION and "--quiet" not in self.myopts: |
168 |
+ portage.const.PORTAGE_PACKAGE_ATOM, [pkg]) and \ |
169 |
+ not vardb.cpv_exists(pkg.cpv) and \ |
170 |
+ "--quiet" not in self.myopts: |
171 |
if mylist_index < len(mylist) - 1: |
172 |
p.append(colorize("WARN", "*** Portage will stop merging at this point and reload itself,")) |
173 |
p.append(colorize("WARN", " then resume the merge.")) |
174 |
@@ -13540,6 +13548,7 @@ |
175 |
d["porttree"].dbapi._aux_cache.clear() |
176 |
d["bintree"].dbapi._aux_cache.clear() |
177 |
d["bintree"].dbapi._clear_cache() |
178 |
+ d["vartree"].dbapi.linkmap._clear_cache() |
179 |
portage.dircache.clear() |
180 |
gc.collect() |
181 |
|
182 |
|
183 |
Modified: main/branches/prefix/pym/portage/__init__.py |
184 |
=================================================================== |
185 |
--- main/branches/prefix/pym/portage/__init__.py 2008-11-04 23:43:38 UTC (rev 11809) |
186 |
+++ main/branches/prefix/pym/portage/__init__.py 2008-11-05 18:08:52 UTC (rev 11810) |
187 |
@@ -994,6 +994,11 @@ |
188 |
"VENDOR", "__CF_USER_TEXT_ENCODING", |
189 |
] |
190 |
|
191 |
+ # variables that break bash |
192 |
+ _environ_filter += [ |
193 |
+ "POSIXLY_CORRECT", |
194 |
+ ] |
195 |
+ |
196 |
# portage config variables and variables set directly by portage |
197 |
_environ_filter += [ |
198 |
"ACCEPT_KEYWORDS", "AUTOCLEAN", |
199 |
@@ -6122,6 +6127,7 @@ |
200 |
ldpath_mtimes=None, scheduler=None): |
201 |
mylink = dblink(cat, pkg, myroot, mysettings, treetype="vartree", |
202 |
vartree=vartree, scheduler=scheduler) |
203 |
+ vartree = mylink.vartree |
204 |
try: |
205 |
mylink.lockdb() |
206 |
if mylink.exists(): |
207 |
@@ -6134,6 +6140,7 @@ |
208 |
return retval |
209 |
return os.EX_OK |
210 |
finally: |
211 |
+ vartree.dbapi.linkmap._clear_cache() |
212 |
mylink.unlockdb() |
213 |
|
214 |
def getCPFromCPV(mycpv): |
215 |
|
216 |
Modified: main/branches/prefix/pym/portage/dbapi/vartree.py |
217 |
=================================================================== |
218 |
--- main/branches/prefix/pym/portage/dbapi/vartree.py 2008-11-04 23:43:38 UTC (rev 11809) |
219 |
+++ main/branches/prefix/pym/portage/dbapi/vartree.py 2008-11-05 18:08:52 UTC (rev 11810) |
220 |
@@ -30,7 +30,7 @@ |
221 |
from portage.elog import elog_process |
222 |
from portage.elog.filtering import filter_mergephases, filter_unmergephases |
223 |
|
224 |
-import os, re, stat, errno, copy, subprocess |
225 |
+import os, re, shutil, stat, errno, copy, subprocess |
226 |
import logging |
227 |
import shlex |
228 |
from itertools import izip |
229 |
@@ -149,9 +149,24 @@ |
230 |
self._root = self._dbapi.root |
231 |
self._libs = {} |
232 |
self._obj_properties = {} |
233 |
- self._defpath = set(getlibpaths(self._root)) |
234 |
self._obj_key_cache = {} |
235 |
+ self._defpath = set() |
236 |
+ self._path_key_cache = {} |
237 |
|
238 |
+ def _clear_cache(self): |
239 |
+ self._libs.clear() |
240 |
+ self._obj_properties.clear() |
241 |
+ self._obj_key_cache.clear() |
242 |
+ self._defpath.clear() |
243 |
+ self._path_key_cache.clear() |
244 |
+ |
245 |
+ def _path_key(self, path): |
246 |
+ key = self._path_key_cache.get(path) |
247 |
+ if key is None: |
248 |
+ key = self._ObjectKey(path, self._root) |
249 |
+ self._path_key_cache[path] = key |
250 |
+ return key |
251 |
+ |
252 |
class _ObjectKey(object): |
253 |
|
254 |
"""Helper class used as _obj_properties keys for objects.""" |
255 |
@@ -222,10 +237,12 @@ |
256 |
|
257 |
def rebuild(self, exclude_pkgs=None, include_file=None): |
258 |
root = self._root |
259 |
- self._defpath = set(getlibpaths(root)) |
260 |
- libs = {} |
261 |
- obj_key_cache = {} |
262 |
- obj_properties = {} |
263 |
+ self._clear_cache() |
264 |
+ self._defpath.update(getlibpaths(self._root)) |
265 |
+ libs = self._libs |
266 |
+ obj_key_cache = self._obj_key_cache |
267 |
+ obj_properties = self._obj_properties |
268 |
+ |
269 |
lines = [] |
270 |
for cpv in self._dbapi.cpv_all(): |
271 |
if exclude_pkgs is not None and cpv in exclude_pkgs: |
272 |
@@ -259,8 +276,7 @@ |
273 |
obj = fields[1] |
274 |
obj_key = self._ObjectKey(obj, root) |
275 |
soname = fields[2] |
276 |
- path = set([ |
277 |
- normalize_path(os.path.join(self._root, x.lstrip(os.path.sep))) |
278 |
+ path = set([normalize_path(x) \ |
279 |
for x in filter(None, fields[3].replace( |
280 |
"${ORIGIN}", os.path.dirname(obj)).replace( |
281 |
"$ORIGIN", os.path.dirname(obj)).split(":"))]) |
282 |
@@ -281,10 +297,6 @@ |
283 |
obj_properties.setdefault(obj_key, \ |
284 |
(arch, needed, path, soname, set()))[4].add(obj) |
285 |
|
286 |
- self._libs = libs |
287 |
- self._obj_properties = obj_properties |
288 |
- self._obj_key_cache = obj_key_cache |
289 |
- |
290 |
def listBrokenBinaries(self, debug=False): |
291 |
""" |
292 |
Find binaries and their needed sonames, which have no providers. |
293 |
@@ -530,7 +542,7 @@ |
294 |
raise KeyError("%s (%s) not in object list" % (obj_key, obj)) |
295 |
|
296 |
arch, needed, path, _, _ = self._obj_properties[obj_key] |
297 |
- path = path.union(self._defpath) |
298 |
+ path_keys = set(self._path_key(x) for x in path.union(self._defpath)) |
299 |
for soname in needed: |
300 |
rValue[soname] = set() |
301 |
if soname not in self._libs or arch not in self._libs[soname]: |
302 |
@@ -540,8 +552,7 @@ |
303 |
for provider_key in self._libs[soname][arch]["providers"]: |
304 |
providers = self._obj_properties[provider_key][4] |
305 |
for provider in providers: |
306 |
- if os.path.join(self._root, |
307 |
- os.path.dirname(provider).lstrip(os.path.sep)) in path: |
308 |
+ if self._path_key(os.path.dirname(provider)) in path_keys: |
309 |
rValue[soname].add(provider) |
310 |
return rValue |
311 |
|
312 |
@@ -584,10 +595,6 @@ |
313 |
if obj_key not in self._obj_properties: |
314 |
raise KeyError("%s (%s) not in object list" % (obj_key, obj)) |
315 |
|
316 |
- # Determine the directory(ies) from the set of objects. |
317 |
- objs_dirs = set(os.path.join(self._root, |
318 |
- os.path.dirname(x).lstrip(os.sep)) for x in objs) |
319 |
- |
320 |
# If there is another version of this lib with the |
321 |
# same soname and the master link points to that |
322 |
# other version, this lib will be shadowed and won't |
323 |
@@ -606,6 +613,10 @@ |
324 |
(master_st.st_dev, master_st.st_ino): |
325 |
return set() |
326 |
|
327 |
+ # Determine the directory(ies) from the set of objects. |
328 |
+ objs_dir_keys = set(self._path_key(os.path.dirname(x)) for x in objs) |
329 |
+ defpath_keys = set(self._path_key(x) for x in self._defpath) |
330 |
+ |
331 |
arch, _, _, soname, _ = self._obj_properties[obj_key] |
332 |
if soname in self._libs and arch in self._libs[soname]: |
333 |
# For each potential consumer, add it to rValue if an object from the |
334 |
@@ -613,8 +624,8 @@ |
335 |
for consumer_key in self._libs[soname][arch]["consumers"]: |
336 |
_, _, path, _, consumer_objs = \ |
337 |
self._obj_properties[consumer_key] |
338 |
- path = path.union(self._defpath) |
339 |
- if objs_dirs.intersection(path): |
340 |
+ path_keys = defpath_keys.union(self._path_key(x) for x in path) |
341 |
+ if objs_dir_keys.intersection(path_keys): |
342 |
rValue.update(consumer_objs) |
343 |
return rValue |
344 |
|
345 |
@@ -2158,7 +2169,7 @@ |
346 |
writemsg("portage.dblink.delete(): invalid dbdir: %s\n" % \ |
347 |
self.dbdir, noiselevel=-1) |
348 |
return |
349 |
- import shutil |
350 |
+ |
351 |
shutil.rmtree(self.dbdir) |
352 |
self.vartree.dbapi._remove(self) |
353 |
|
354 |
@@ -2966,7 +2977,6 @@ |
355 |
del mylibs, mycontents, old_contents, liblist |
356 |
|
357 |
# inject files that should be preserved into our image dir |
358 |
- import shutil |
359 |
preserve_paths = [] |
360 |
candidates_stack = list(candidates) |
361 |
while candidates_stack: |
362 |
@@ -4173,11 +4183,12 @@ |
363 |
if self.vartree.dbapi._categories is not None: |
364 |
self.vartree.dbapi._categories = None |
365 |
if self.myroot == "/" and \ |
366 |
- match_from_list(PORTAGE_PACKAGE_ATOM, [self.mycpv]): |
367 |
+ match_from_list(PORTAGE_PACKAGE_ATOM, [self.mycpv]) and \ |
368 |
+ not self.vartree.dbapi.cpv_exists(self.mycpv): |
369 |
settings = self.settings |
370 |
base_path_orig = os.path.dirname(settings["PORTAGE_BIN_PATH"]) |
371 |
from tempfile import mkdtemp |
372 |
- import shutil |
373 |
+ |
374 |
# Make the temp directory inside PORTAGE_TMPDIR since, unlike |
375 |
# /tmp, it can't be mounted with the "noexec" option. |
376 |
base_path_tmp = mkdtemp("", "._portage_reinstall_.", |
377 |
@@ -4228,6 +4239,7 @@ |
378 |
self._scheduler.dblinkEbuildPhase( |
379 |
self, mydbapi, myebuild, "clean") |
380 |
finally: |
381 |
+ self.vartree.dbapi.linkmap._clear_cache() |
382 |
self.unlockdb() |
383 |
return retval |
384 |
|
385 |
@@ -4241,7 +4253,6 @@ |
386 |
return " ".join(mydata) |
387 |
|
388 |
def copyfile(self,fname): |
389 |
- import shutil |
390 |
shutil.copyfile(fname,self.dbdir+"/"+os.path.basename(fname)) |
391 |
|
392 |
def getfile(self,fname): |
393 |
|
394 |
Modified: main/branches/prefix/pym/portage/util.py |
395 |
=================================================================== |
396 |
--- main/branches/prefix/pym/portage/util.py 2008-11-04 23:43:38 UTC (rev 11809) |
397 |
+++ main/branches/prefix/pym/portage/util.py 2008-11-05 18:08:52 UTC (rev 11810) |
398 |
@@ -1220,8 +1220,4 @@ |
399 |
rval.append("/usr/lib") |
400 |
rval.append("/lib") |
401 |
|
402 |
- rval = [normalize_path(os.path.join(root, x.lstrip(os.path.sep))) \ |
403 |
- for x in rval if x] |
404 |
- |
405 |
- return rval |
406 |
- |
407 |
+ return [normalize_path(x) for x in rval if x] |