Gentoo Archives: gentoo-commits

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