1 |
Author: zmedico |
2 |
Date: 2008-04-27 00:21:24 +0000 (Sun, 27 Apr 2008) |
3 |
New Revision: 9984 |
4 |
|
5 |
Modified: |
6 |
main/branches/2.1.2/bin/emerge |
7 |
Log: |
8 |
Refactor the way that depgraph.altlist(), _complete_graph(), and |
9 |
validate_blockers() interact with eachother. This simplifies things |
10 |
by eliminating the need for recursive calls to validate_blockers(). |
11 |
(trunk r9977) |
12 |
|
13 |
|
14 |
Modified: main/branches/2.1.2/bin/emerge |
15 |
=================================================================== |
16 |
--- main/branches/2.1.2/bin/emerge 2008-04-27 00:10:17 UTC (rev 9983) |
17 |
+++ main/branches/2.1.2/bin/emerge 2008-04-27 00:21:24 UTC (rev 9984) |
18 |
@@ -2706,12 +2706,11 @@ |
19 |
missing += 1 |
20 |
print "Missing binary for:",xs[2] |
21 |
|
22 |
- if not self._complete_graph(): |
23 |
+ try: |
24 |
+ self.altlist() |
25 |
+ except self._unknown_internal_error: |
26 |
return False, myfavorites |
27 |
|
28 |
- if not self.validate_blockers(): |
29 |
- return False, myfavorites |
30 |
- |
31 |
# We're true here unless we are missing binaries. |
32 |
return (not missing,myfavorites) |
33 |
|
34 |
@@ -3379,25 +3378,6 @@ |
35 |
if not self.blocker_parents[blocker]: |
36 |
del self.blocker_parents[blocker] |
37 |
|
38 |
- # This checks whether or not it's possible to resolve blocker |
39 |
- # conflicts that depend on installation order or require |
40 |
- # uninstallation of a currently installed package. Note that |
41 |
- # this can lead to the current method being called recursively |
42 |
- # if changes to the dependency graph are required. |
43 |
- try: |
44 |
- self.altlist() |
45 |
- except self._unknown_internal_error: |
46 |
- return False |
47 |
- |
48 |
- if self._slot_collision_info: |
49 |
- # The user is only notified of a slot collision if there are no |
50 |
- # unresolvable blocks. |
51 |
- for x in self.altlist(): |
52 |
- if x[0] == "blocks": |
53 |
- self._slot_collision_info.clear() |
54 |
- return True |
55 |
- if not self._accept_collisions(): |
56 |
- return False |
57 |
return True |
58 |
|
59 |
def _accept_collisions(self): |
60 |
@@ -3422,6 +3402,7 @@ |
61 |
def altlist(self, reversed=False): |
62 |
|
63 |
while self._serialized_tasks_cache is None: |
64 |
+ self._resolve_conflicts() |
65 |
try: |
66 |
self._serialized_tasks_cache = self._serialize_tasks() |
67 |
except self._serialize_tasks_retry: |
68 |
@@ -3432,6 +3413,13 @@ |
69 |
retlist.reverse() |
70 |
return retlist |
71 |
|
72 |
+ def _resolve_conflicts(self): |
73 |
+ if not self._complete_graph(): |
74 |
+ raise self._unknown_internal_error() |
75 |
+ |
76 |
+ if not self.validate_blockers(): |
77 |
+ raise self._unknown_internal_error() |
78 |
+ |
79 |
def _serialize_tasks(self): |
80 |
mygraph=self.digraph.copy() |
81 |
# Prune "nomerge" root nodes if nothing depends on them, since |
82 |
@@ -3851,10 +3839,6 @@ |
83 |
not complete and \ |
84 |
not myblocker_parents: |
85 |
self.myparams.add("complete") |
86 |
- if not self._complete_graph(): |
87 |
- raise self._unknown_internal_error("") |
88 |
- if not self.validate_blockers(): |
89 |
- raise self._unknown_internal_error("") |
90 |
raise self._serialize_tasks_retry("") |
91 |
|
92 |
return retlist |
93 |
@@ -4525,8 +4509,18 @@ |
94 |
to ensure that the user is notified of problems with the graph. |
95 |
""" |
96 |
|
97 |
- self._show_slot_collision_notice() |
98 |
+ task_list = self.altlist() |
99 |
|
100 |
+ # Any blockers must be appended to the tail of the list, |
101 |
+ # so we only need to check the last item. |
102 |
+ have_blocker_conflict = \ |
103 |
+ bool(task_list and task_list[-1][0] == "blocks") |
104 |
+ |
105 |
+ # The user is only notified of a slot conflict if |
106 |
+ # there are no unresolvable blocker conflicts. |
107 |
+ if not have_blocker_conflict: |
108 |
+ self._show_slot_collision_notice() |
109 |
+ |
110 |
# TODO: Add generic support for "set problem" handlers so that |
111 |
# the below warnings aren't special cases for world only. |
112 |
|
113 |
|
114 |
-- |
115 |
gentoo-commits@l.g.o mailing list |