1 |
Author: grobian |
2 |
Date: 2009-08-24 09:40:49 +0000 (Mon, 24 Aug 2009) |
3 |
New Revision: 14144 |
4 |
|
5 |
Modified: |
6 |
main/branches/prefix/bin/misc-functions.sh |
7 |
main/branches/prefix/man/emerge.1 |
8 |
main/branches/prefix/man/portage.5 |
9 |
main/branches/prefix/pym/_emerge/RepoDisplay.py |
10 |
main/branches/prefix/pym/_emerge/create_depgraph_params.py |
11 |
main/branches/prefix/pym/_emerge/depgraph.py |
12 |
main/branches/prefix/pym/_emerge/help.py |
13 |
main/branches/prefix/pym/_emerge/main.py |
14 |
main/branches/prefix/pym/portage/__init__.py |
15 |
main/branches/prefix/pym/portage/dbapi/porttree.py |
16 |
main/branches/prefix/pym/portage/dbapi/vartree.py |
17 |
main/branches/prefix/pym/portage/output.py |
18 |
Log: |
19 |
Merged from trunk -r14117:14127 |
20 |
|
21 |
| 14118 | Note that package.* and use.* as directories is only | |
22 |
| zmedico | supported since portage-2.1.6.7, and it is not included in | |
23 |
| | PMS at this time. | |
24 |
|
25 |
| 14119 | Avoid potential empty lines in warnings about missing | |
26 |
| arfrever | SONAMEs or NEEDED entries. Found by Zac Medico. | |
27 |
|
28 |
| 14120 | Add support for --selective=n, so it can be used to remove | |
29 |
| zmedico | selective behavior that may have been implied by some other | |
30 |
| | option like --update. | |
31 |
|
32 |
| 14121 | Add support for --keep-going=n so that it can be disabled | |
33 |
| zmedico | on the command line after it's been enabled in | |
34 |
| | EMERGE_DEFAULT_OPTS. | |
35 |
|
36 |
| 14122 | Add some --debug output for backtracking. Also, remove | |
37 |
| zmedico | unused imports. | |
38 |
|
39 |
| 14124 | Bug #282269 - Avoid str() calls with overlay paths, which | |
40 |
| zmedico | can trigger UnicodeEncodeError in python-2.x. | |
41 |
|
42 |
| 14125 | Bug #282306 - Inside dblink._security_check(), fall back to | |
43 |
| zmedico | utf_8 encoding it a path cannot be encoded under the user's | |
44 |
| | chosen encoding. | |
45 |
|
46 |
| 14126 | Bug #282269, comment #2 - Avoid potential | |
47 |
| zmedico | UnicodeEncodeError when writing to sys.stderr inside | |
48 |
| | xtermTitle(). | |
49 |
|
50 |
| 14127 | Support package.provided directory. | |
51 |
| arfrever | | |
52 |
|
53 |
|
54 |
Modified: main/branches/prefix/bin/misc-functions.sh |
55 |
=================================================================== |
56 |
--- main/branches/prefix/bin/misc-functions.sh 2009-08-24 09:38:13 UTC (rev 14143) |
57 |
+++ main/branches/prefix/bin/misc-functions.sh 2009-08-24 09:40:49 UTC (rev 14144) |
58 |
@@ -264,6 +264,7 @@ |
59 |
set -${shopts} |
60 |
fi |
61 |
fi |
62 |
+ sed -e "/^\$/d" -i "${T}"/scanelf-missing-SONAME.log |
63 |
f=$(<"${T}"/scanelf-missing-SONAME.log) |
64 |
if [[ -n ${f} ]] ; then |
65 |
vecho -ne '\a\n' |
66 |
@@ -297,6 +298,7 @@ |
67 |
set -${shopts} |
68 |
fi |
69 |
fi |
70 |
+ sed -e "/^\$/d" -i "${T}"/scanelf-missing-NEEDED.log |
71 |
f=$(<"${T}"/scanelf-missing-NEEDED.log) |
72 |
if [[ -n ${f} ]] ; then |
73 |
vecho -ne '\a\n' |
74 |
|
75 |
Modified: main/branches/prefix/man/emerge.1 |
76 |
=================================================================== |
77 |
--- main/branches/prefix/man/emerge.1 2009-08-24 09:38:13 UTC (rev 14143) |
78 |
+++ main/branches/prefix/man/emerge.1 2009-08-24 09:40:49 UTC (rev 14144) |
79 |
@@ -343,7 +343,7 @@ |
80 |
given without an argument, emerge will not limit the number of jobs that can |
81 |
run simultaneously. Also see the related \fB\-\-load\-average\fR option. |
82 |
.TP |
83 |
-.BR "\-\-keep\-going" |
84 |
+.BR "\-\-keep\-going[=n]" |
85 |
Continue as much as possible after an error. When an error occurs, |
86 |
dependencies are recalculated for remaining packages and any with |
87 |
unsatisfied dependencies are automatically dropped. Also see |
88 |
@@ -446,9 +446,12 @@ |
89 |
\fBDEPEND\fR variable. However, behavior may change for new |
90 |
\fBEAPI\fRs when related extensions are added in the future. |
91 |
.TP |
92 |
-.BR "\-\-selective" |
93 |
+.BR "\-\-selective"[=n] |
94 |
This is similar to the \fB\-\-noreplace\fR option, except that it |
95 |
does not take precedence over options such as \fB\-\-newuse\fR. |
96 |
+Some options, such as \fB\-\-update\fR, imply \fB\-\-selective\fR. |
97 |
+Use \fB\-\-selective=n\fR if you want to forcefully disable |
98 |
+\fB\-\-selective\fR, regardless of options like \fB\-\-update\fR. |
99 |
.TP |
100 |
.BR "\-\-skipfirst" |
101 |
This option is only valid when used with \fB\-\-resume\fR. It removes the |
102 |
|
103 |
Modified: main/branches/prefix/man/portage.5 |
104 |
=================================================================== |
105 |
--- main/branches/prefix/man/portage.5 2009-08-24 09:38:13 UTC (rev 14143) |
106 |
+++ main/branches/prefix/man/portage.5 2009-08-24 09:40:49 UTC (rev 14144) |
107 |
@@ -148,7 +148,8 @@ |
108 |
"profiles" directory that begins with "package." or "use." can be more than |
109 |
just a flat file. If it is a directory, then all the files in that directory |
110 |
will be sorted in ascending alphabetical order by file name and summed together |
111 |
-as if it were a single file. |
112 |
+as if it were a single file. Note that this behavior is only supported since |
113 |
+portage-2.1.6.7, and it is not included in PMS at this time. |
114 |
|
115 |
.I Example: |
116 |
.nf |
117 |
|
118 |
Modified: main/branches/prefix/pym/_emerge/RepoDisplay.py |
119 |
=================================================================== |
120 |
--- main/branches/prefix/pym/_emerge/RepoDisplay.py 2009-08-24 09:38:13 UTC (rev 14143) |
121 |
+++ main/branches/prefix/pym/_emerge/RepoDisplay.py 2009-08-24 09:40:49 UTC (rev 14144) |
122 |
@@ -48,6 +48,10 @@ |
123 |
return s |
124 |
|
125 |
def __str__(self): |
126 |
+ """ |
127 |
+ In python-2.x, str() can trigger a UnicodeEncodeError here, |
128 |
+ so call __str__() directly. |
129 |
+ """ |
130 |
output = [] |
131 |
shown_repos = self._shown_repos |
132 |
unknown_repo = self._unknown_repo |
133 |
|
134 |
Modified: main/branches/prefix/pym/_emerge/create_depgraph_params.py |
135 |
=================================================================== |
136 |
--- main/branches/prefix/pym/_emerge/create_depgraph_params.py 2009-08-24 09:38:13 UTC (rev 14143) |
137 |
+++ main/branches/prefix/pym/_emerge/create_depgraph_params.py 2009-08-24 09:40:49 UTC (rev 14144) |
138 |
@@ -2,6 +2,9 @@ |
139 |
# Distributed under the terms of the GNU General Public License v2 |
140 |
# $Id$ |
141 |
|
142 |
+import logging |
143 |
+from portage.util import writemsg_level |
144 |
+ |
145 |
def create_depgraph_params(myopts, myaction): |
146 |
#configure emerge engine parameters |
147 |
# |
148 |
@@ -23,7 +26,7 @@ |
149 |
"--newuse" in myopts or \ |
150 |
"--reinstall" in myopts or \ |
151 |
"--noreplace" in myopts or \ |
152 |
- "--selective" in myopts: |
153 |
+ myopts.get("--selective", "n") != "n": |
154 |
myparams["selective"] = True |
155 |
if "--emptytree" in myopts: |
156 |
myparams["empty"] = True |
157 |
@@ -34,5 +37,15 @@ |
158 |
myparams["deep"] = myopts["--deep"] |
159 |
if "--complete-graph" in myopts: |
160 |
myparams["complete"] = True |
161 |
+ if myopts.get("--selective") == "n": |
162 |
+ # --selective=n can be used to remove selective |
163 |
+ # behavior that may have been implied by some |
164 |
+ # other option like --update. |
165 |
+ myparams.pop("selective", None) |
166 |
+ |
167 |
+ if '--debug' in myopts: |
168 |
+ writemsg_level('\n\nmyparams %s\n\n' % myparams, |
169 |
+ noiselevel=-1, level=logging.DEBUG) |
170 |
+ |
171 |
return myparams |
172 |
|
173 |
|
174 |
Modified: main/branches/prefix/pym/_emerge/depgraph.py |
175 |
=================================================================== |
176 |
--- main/branches/prefix/pym/_emerge/depgraph.py 2009-08-24 09:38:13 UTC (rev 14143) |
177 |
+++ main/branches/prefix/pym/_emerge/depgraph.py 2009-08-24 09:40:49 UTC (rev 14144) |
178 |
@@ -3,6 +3,7 @@ |
179 |
# $Id$ |
180 |
|
181 |
import gc |
182 |
+import logging |
183 |
import re |
184 |
import sys |
185 |
import textwrap |
186 |
@@ -17,6 +18,7 @@ |
187 |
from portage.sets import SETPREFIX |
188 |
from portage.sets.base import InternalPackageSet |
189 |
from portage.util import cmp_sort_key, writemsg, writemsg_stdout |
190 |
+from portage.util import writemsg_level |
191 |
|
192 |
from _emerge.AtomArg import AtomArg |
193 |
from _emerge.Blocker import Blocker |
194 |
@@ -24,7 +26,6 @@ |
195 |
from _emerge.BlockerDepPriority import BlockerDepPriority |
196 |
from _emerge.changelog import calc_changelog |
197 |
from _emerge.countdown import countdown |
198 |
-from _emerge.create_depgraph_params import create_depgraph_params |
199 |
from _emerge.create_world_atom import create_world_atom |
200 |
from _emerge.Dependency import Dependency |
201 |
from _emerge.DependencyArg import DependencyArg |
202 |
@@ -714,6 +715,18 @@ |
203 |
dep.parent, {})["missing dependency"] = \ |
204 |
set([(dep.parent, dep.root, dep.atom)]) |
205 |
self._dynamic_config._need_restart = True |
206 |
+ if "--debug" in self._frozen_config.myopts: |
207 |
+ msg = [] |
208 |
+ msg.append("") |
209 |
+ msg.append("") |
210 |
+ msg.append("backtracking due to unsatisfied dep:") |
211 |
+ msg.append(" parent: %s" % dep.parent) |
212 |
+ msg.append(" priority: %s" % dep.priority) |
213 |
+ msg.append(" root: %s" % dep.root) |
214 |
+ msg.append(" atom: %s" % dep.atom) |
215 |
+ msg.append("") |
216 |
+ writemsg_level("".join("%s\n" % l for l in msg), |
217 |
+ noiselevel=-1, level=logging.DEBUG) |
218 |
|
219 |
return 0 |
220 |
# In some cases, dep_check will return deps that shouldn't |
221 |
@@ -868,6 +881,19 @@ |
222 |
self._dynamic_config._runtime_pkg_mask.setdefault( |
223 |
existing_node, {})["slot conflict"] = parent_atoms |
224 |
self._dynamic_config._need_restart = True |
225 |
+ if "--debug" in self._frozen_config.myopts: |
226 |
+ msg = [] |
227 |
+ msg.append("") |
228 |
+ msg.append("") |
229 |
+ msg.append("backtracking due to slot conflict:") |
230 |
+ msg.append(" package: %s" % existing_node) |
231 |
+ msg.append(" slot: %s" % existing_node.slot_atom) |
232 |
+ msg.append(" parents: %s" % \ |
233 |
+ [(str(parent), atom) \ |
234 |
+ for parent, atom in parent_atoms]) |
235 |
+ msg.append("") |
236 |
+ writemsg_level("".join("%s\n" % l for l in msg), |
237 |
+ noiselevel=-1, level=logging.DEBUG) |
238 |
return 0 |
239 |
|
240 |
# A slot collision has occurred. Sometimes this coincides |
241 |
@@ -3866,8 +3892,6 @@ |
242 |
depth >= mylist[i+1][1]: |
243 |
del mylist[i] |
244 |
|
245 |
- from portage import flatten |
246 |
- from portage.dep import use_reduce, paren_reduce |
247 |
# files to fetch list - avoids counting a same file twice |
248 |
# in size display (verbose mode) |
249 |
myfetchlist=[] |
250 |
@@ -4346,7 +4370,9 @@ |
251 |
print |
252 |
print counters |
253 |
if show_repos: |
254 |
- writemsg_stdout(str(repo_display), noiselevel=-1) |
255 |
+ # In python-2.x, str() can trigger a UnicodeEncodeError here, |
256 |
+ # so call __str__() directly. |
257 |
+ writemsg_stdout(repo_display.__str__(), noiselevel=-1) |
258 |
|
259 |
if "--changelog" in self._frozen_config.myopts: |
260 |
writemsg_stdout('\n', noiselevel=-1) |
261 |
@@ -4966,6 +4992,10 @@ |
262 |
runtime_pkg_mask = mydepgraph.get_runtime_pkg_mask() |
263 |
backtracked += 1 |
264 |
elif backtracked and allow_backtracking: |
265 |
+ if "--debug" in myopts: |
266 |
+ writemsg_level( |
267 |
+ "\n\nbacktracking aborted after %s tries\n\n" % \ |
268 |
+ backtracked, noiselevel=-1, level=logging.DEBUG) |
269 |
# Backtracking failed, so disable it and do |
270 |
# a plain dep calculation + error message. |
271 |
allow_backtracking = False |
272 |
|
273 |
Modified: main/branches/prefix/pym/_emerge/help.py |
274 |
=================================================================== |
275 |
--- main/branches/prefix/pym/_emerge/help.py 2009-08-24 09:38:13 UTC (rev 14143) |
276 |
+++ main/branches/prefix/pym/_emerge/help.py 2009-08-24 09:40:49 UTC (rev 14144) |
277 |
@@ -360,7 +360,7 @@ |
278 |
for line in wrap(desc, desc_width): |
279 |
print desc_indent + line |
280 |
print |
281 |
- print " "+green("--keep-going") |
282 |
+ print " " + green("--keep-going") + "[=%s]" % turquoise("n") |
283 |
desc = "Continue as much as possible after " + \ |
284 |
"an error. When an error occurs, " + \ |
285 |
"dependencies are recalculated for " + \ |
286 |
@@ -467,9 +467,12 @@ |
287 |
for line in wrap(desc, desc_width): |
288 |
print desc_indent + line |
289 |
print |
290 |
- print " " + green("--selective") |
291 |
+ print " " + green("--selective") + "[=%s]" % turquoise("n") |
292 |
desc = "This is similar to the --noreplace option, except that it " + \ |
293 |
- "does not take precedence over options such as --newuse." |
294 |
+ "does not take precedence over options such as --newuse. " + \ |
295 |
+ "Some options, such as --update, imply --selective. " + \ |
296 |
+ "Use --selective=n if you want to forcefully disable " + \ |
297 |
+ "--selective, regardless of options like --update." |
298 |
for line in wrap(desc, desc_width): |
299 |
print desc_indent + line |
300 |
print |
301 |
|
302 |
Modified: main/branches/prefix/pym/_emerge/main.py |
303 |
=================================================================== |
304 |
--- main/branches/prefix/pym/_emerge/main.py 2009-08-24 09:38:13 UTC (rev 14143) |
305 |
+++ main/branches/prefix/pym/_emerge/main.py 2009-08-24 09:40:49 UTC (rev 14144) |
306 |
@@ -46,14 +46,13 @@ |
307 |
"--emptytree", |
308 |
"--fetchonly", "--fetch-all-uri", |
309 |
"--ignore-default-opts", |
310 |
-"--keep-going", |
311 |
"--noconfmem", |
312 |
"--newuse", |
313 |
"--nodeps", "--noreplace", |
314 |
"--nospinner", "--oneshot", |
315 |
"--onlydeps", "--pretend", |
316 |
"--quiet", "--resume", |
317 |
-"--searchdesc", "--selective", |
318 |
+"--searchdesc", |
319 |
"--skipfirst", |
320 |
"--tree", |
321 |
"--update", |
322 |
@@ -377,7 +376,9 @@ |
323 |
'--getbinpkg' : ('n',), |
324 |
'--getbinpkgonly' : ('n',), |
325 |
'--jobs' : valid_integers, |
326 |
+ '--keep-going' : ('n',), |
327 |
'--root-deps' : ('rdeps',), |
328 |
+ '--selective' : ('n',), |
329 |
'--usepkg' : ('n',), |
330 |
'--usepkgonly' : ('n',), |
331 |
} |
332 |
@@ -533,6 +534,12 @@ |
333 |
"action" : "store" |
334 |
}, |
335 |
|
336 |
+ "--keep-going": { |
337 |
+ "help" : "continue as much as possible after an error", |
338 |
+ "type" : "choice", |
339 |
+ "choices" : ("True", "n") |
340 |
+ }, |
341 |
+ |
342 |
"--load-average": { |
343 |
|
344 |
"help" :"Specifies that no new builds should be started " + \ |
345 |
@@ -585,6 +592,13 @@ |
346 |
"choices" :("True", "rdeps") |
347 |
}, |
348 |
|
349 |
+ "--selective": { |
350 |
+ "help" : "similar to the --noreplace but does not take " + \ |
351 |
+ "precedence over options such as --newuse", |
352 |
+ "type" : "choice", |
353 |
+ "choices" : ("True", "n") |
354 |
+ }, |
355 |
+ |
356 |
"--usepkg": { |
357 |
"shortopt" : "-k", |
358 |
"help" : "use binary packages", |
359 |
@@ -654,9 +668,17 @@ |
360 |
else: |
361 |
myoptions.getbinpkgonly = None |
362 |
|
363 |
+ if myoptions.keep_going in ("True",): |
364 |
+ myoptions.keep_going = True |
365 |
+ else: |
366 |
+ myoptions.keep_going = None |
367 |
+ |
368 |
if myoptions.root_deps == "True": |
369 |
myoptions.root_deps = True |
370 |
|
371 |
+ if myoptions.selective == "True": |
372 |
+ myoptions.selective = True |
373 |
+ |
374 |
if myoptions.deep is not None: |
375 |
deep = None |
376 |
if myoptions.deep == "True": |
377 |
|
378 |
Modified: main/branches/prefix/pym/portage/__init__.py |
379 |
=================================================================== |
380 |
--- main/branches/prefix/pym/portage/__init__.py 2009-08-24 09:38:13 UTC (rev 14143) |
381 |
+++ main/branches/prefix/pym/portage/__init__.py 2009-08-24 09:40:49 UTC (rev 14144) |
382 |
@@ -2076,7 +2076,7 @@ |
383 |
else: |
384 |
self.punmaskdict[mycatpkg]=[x] |
385 |
|
386 |
- pkgprovidedlines = [grabfile(os.path.join(x, "package.provided")) for x in self.profiles] |
387 |
+ pkgprovidedlines = [grabfile(os.path.join(x, "package.provided"), recursive=1) for x in self.profiles] |
388 |
pkgprovidedlines = stack_lists(pkgprovidedlines, incremental=1) |
389 |
has_invalid_data = False |
390 |
for x in range(len(pkgprovidedlines)-1, -1, -1): |
391 |
|
392 |
Modified: main/branches/prefix/pym/portage/dbapi/porttree.py |
393 |
=================================================================== |
394 |
--- main/branches/prefix/pym/portage/dbapi/porttree.py 2009-08-24 09:38:13 UTC (rev 14143) |
395 |
+++ main/branches/prefix/pym/portage/dbapi/porttree.py 2009-08-24 09:40:49 UTC (rev 14144) |
396 |
@@ -604,15 +604,11 @@ |
397 |
mydata, st, emtime = self._pull_valid_cache(mycpv, myebuild, mylocation) |
398 |
doregen = mydata is None |
399 |
|
400 |
- writemsg(_("auxdb is valid: ")+str(not doregen)+" "+str(pkg)+"\n", 2) |
401 |
- |
402 |
if doregen: |
403 |
if myebuild in self._broken_ebuilds: |
404 |
raise KeyError(mycpv) |
405 |
if not self._have_root_eclass_dir: |
406 |
raise KeyError(mycpv) |
407 |
- writemsg("doregen: %s %s\n" % (doregen, mycpv), 2) |
408 |
- writemsg(_("Generating cache entry(0) for: ")+str(myebuild)+"\n", 1) |
409 |
|
410 |
self.doebuild_settings.setcpv(mycpv) |
411 |
mydata = {} |
412 |
@@ -831,7 +827,7 @@ |
413 |
os.path.join(self.mysettings["DISTDIR"], x), mysums[x]) |
414 |
except FileNotFound, e: |
415 |
ok = False |
416 |
- reason = _("File Not Found: '%s'") % str(e) |
417 |
+ reason = _("File Not Found: '%s'") % (e,) |
418 |
if not ok: |
419 |
failures[x] = reason |
420 |
if failures: |
421 |
@@ -1105,7 +1101,7 @@ |
422 |
except PortageException, e: |
423 |
writemsg("!!! Error: aux_get('%s', %s)\n" % (mycpv, aux_keys), |
424 |
noiselevel=-1) |
425 |
- writemsg("!!! %s\n" % str(e), noiselevel=-1) |
426 |
+ writemsg("!!! %s\n" % (e,), noiselevel=-1) |
427 |
del e |
428 |
continue |
429 |
eapi = metadata["EAPI"] |
430 |
|
431 |
Modified: main/branches/prefix/pym/portage/dbapi/vartree.py |
432 |
=================================================================== |
433 |
--- main/branches/prefix/pym/portage/dbapi/vartree.py 2009-08-24 09:38:13 UTC (rev 14143) |
434 |
+++ main/branches/prefix/pym/portage/dbapi/vartree.py 2009-08-24 09:40:49 UTC (rev 14144) |
435 |
@@ -3849,6 +3849,22 @@ |
436 |
0 == i % self._file_merge_yield_interval: |
437 |
scheduler.scheduleYield() |
438 |
|
439 |
+ if os is _os_merge: |
440 |
+ try: |
441 |
+ _unicode_encode(path, |
442 |
+ encoding=_encodings['merge'], errors='strict') |
443 |
+ except UnicodeEncodeError: |
444 |
+ # The package appears to have been merged with a |
445 |
+ # different value of sys.getfilesystemencoding(), |
446 |
+ # so fall back to utf_8 if appropriate. |
447 |
+ try: |
448 |
+ _unicode_encode(path, |
449 |
+ encoding=_encodings['fs'], errors='strict') |
450 |
+ except UnicodeEncodeError: |
451 |
+ pass |
452 |
+ else: |
453 |
+ os = portage.os |
454 |
+ |
455 |
try: |
456 |
s = os.lstat(path) |
457 |
except OSError, e: |
458 |
|
459 |
Modified: main/branches/prefix/pym/portage/output.py |
460 |
=================================================================== |
461 |
--- main/branches/prefix/pym/portage/output.py 2009-08-24 09:38:13 UTC (rev 14143) |
462 |
+++ main/branches/prefix/pym/portage/output.py 2009-08-24 09:40:49 UTC (rev 14144) |
463 |
@@ -252,6 +252,9 @@ |
464 |
mystr = mystr[:_max_xtermTitle_len] |
465 |
if not raw: |
466 |
mystr = '\x1b]0;%s\x07' % mystr |
467 |
+ if sys.hexversion < 0x3000000 and isinstance(mystr, unicode): |
468 |
+ # avoid potential UnicodeEncodeError |
469 |
+ mystr = mystr.encode(_encodings['stdio'], 'backslashreplace') |
470 |
sys.stderr.write(mystr) |
471 |
sys.stderr.flush() |