1 |
Author: zmedico |
2 |
Date: 2008-05-29 19:50:50 +0000 (Thu, 29 May 2008) |
3 |
New Revision: 10478 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/_emerge/__init__.py |
7 |
Log: |
8 |
Make --skipfirst handle missing dependencies by dropping the merge tasks |
9 |
that have missing dependencies. This involves creating an entirely new |
10 |
depgraph each time that a missing dependency is discovered. This isn't |
11 |
the most efficient approach but it's simple and it works well. |
12 |
|
13 |
This new behavior can server as a fix for bug #12768 by calling emerge |
14 |
--resume --skipfirst each time that emerge exits unsuccessfully. This |
15 |
was possible before, but now packages with unsatisfied dependencies |
16 |
will be properly identified and dropped from the list. |
17 |
|
18 |
|
19 |
Modified: main/trunk/pym/_emerge/__init__.py |
20 |
=================================================================== |
21 |
--- main/trunk/pym/_emerge/__init__.py 2008-05-29 05:27:40 UTC (rev 10477) |
22 |
+++ main/trunk/pym/_emerge/__init__.py 2008-05-29 19:50:50 UTC (rev 10478) |
23 |
@@ -5273,13 +5273,6 @@ |
24 |
if not isinstance(mergelist, list): |
25 |
mergelist = [] |
26 |
|
27 |
- if mergelist and "--skipfirst" in self.myopts: |
28 |
- for i, task in enumerate(mergelist): |
29 |
- if isinstance(task, list) and \ |
30 |
- task and task[-1] == "merge": |
31 |
- del mergelist[i] |
32 |
- break |
33 |
- |
34 |
fakedb = self.mydbapi |
35 |
trees = self.trees |
36 |
serialized_tasks = [] |
37 |
@@ -8360,11 +8353,39 @@ |
38 |
if show_spinner: |
39 |
print "Calculating dependencies ", |
40 |
myparams = create_depgraph_params(myopts, myaction) |
41 |
- mydepgraph = depgraph(settings, trees, |
42 |
- myopts, myparams, spinner) |
43 |
+ |
44 |
+ resume_data = mtimedb["resume"] |
45 |
+ mergelist = resume_data["mergelist"] |
46 |
+ if mergelist and "--skipfirst" in myopts: |
47 |
+ for i, task in enumerate(mergelist): |
48 |
+ if isinstance(task, list) and \ |
49 |
+ task and task[-1] == "merge": |
50 |
+ del mergelist[i] |
51 |
+ break |
52 |
+ |
53 |
success = False |
54 |
try: |
55 |
- success = mydepgraph.loadResumeCommand(mtimedb["resume"]) |
56 |
+ while True: |
57 |
+ mydepgraph = depgraph(settings, trees, |
58 |
+ myopts, myparams, spinner) |
59 |
+ try: |
60 |
+ success = mydepgraph.loadResumeCommand(mtimedb["resume"]) |
61 |
+ except depgraph.UnsatisfiedResumeDep, e: |
62 |
+ if "--skipfirst" not in myopts: |
63 |
+ raise |
64 |
+ unsatisfied_parents = set(dep.parent for dep in e.value) |
65 |
+ pruned_mergelist = [] |
66 |
+ for task in mergelist: |
67 |
+ if isinstance(task, list) and \ |
68 |
+ tuple(task) in unsatisfied_parents: |
69 |
+ continue |
70 |
+ pruned_mergelist.append(task) |
71 |
+ if not pruned_mergelist: |
72 |
+ raise |
73 |
+ mergelist[:] = pruned_mergelist |
74 |
+ continue |
75 |
+ else: |
76 |
+ break |
77 |
except (portage.exception.PackageNotFound, |
78 |
mydepgraph.UnsatisfiedResumeDep), e: |
79 |
if show_spinner: |
80 |
@@ -8398,7 +8419,9 @@ |
81 |
msg = "The resume list contains packages " + \ |
82 |
"with dependencies that have not been " + \ |
83 |
"installed yet. Please restart/continue " + \ |
84 |
- "the operation manually." |
85 |
+ "the operation manually, or use --skipfirst " + \ |
86 |
+ "to skip the first package in the list and " + \ |
87 |
+ "any other packages that may have missing dependencies." |
88 |
for line in wrap(msg, 72): |
89 |
out.eerror(line) |
90 |
elif isinstance(e, portage.exception.PackageNotFound): |
91 |
|
92 |
-- |
93 |
gentoo-commits@l.g.o mailing list |