Gentoo Archives: gentoo-commits

From: Sebastian Luther <SebastianLuther@×××.de>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/, pym/_emerge/
Date: Wed, 05 Feb 2014 19:42:14
Message-Id: 1391629161.731a3e6ea96acde03150905e28ebb69325acc60f.few@gentoo
1 commit: 731a3e6ea96acde03150905e28ebb69325acc60f
2 Author: Sebastian Luther <SebastianLuther <AT> gmx <DOT> de>
3 AuthorDate: Fri Jan 24 08:43:52 2014 +0000
4 Commit: Sebastian Luther <SebastianLuther <AT> gmx <DOT> de >
5 CommitDate: Wed Feb 5 19:39:21 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=731a3e6e
7
8 Replace _slot_collision_info with _package_tracker
9
10 ---
11 pym/_emerge/depgraph.py | 59 ++++++++++++----------------------
12 pym/_emerge/resolver/slot_collision.py | 22 ++++++-------
13 2 files changed, 31 insertions(+), 50 deletions(-)
14
15 diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
16 index 9d234c2..484ac14 100644
17 --- a/pym/_emerge/depgraph.py
18 +++ b/pym/_emerge/depgraph.py
19 @@ -378,11 +378,6 @@ class _dynamic_depgraph_config(object):
20 # This use used to check if we have accounted for blockers
21 # relevant to a package.
22 self._traversed_pkg_deps = set()
23 - # This should be ordered such that the backtracker will
24 - # attempt to solve conflicts which occurred earlier first,
25 - # since an earlier conflict can be the cause of a conflict
26 - # which occurs later.
27 - self._slot_collision_info = OrderedDict()
28 # Slot collision nodes are not allowed to block other packages since
29 # blocker validation is only able to account for one package per slot.
30 self._slot_collision_nodes = set()
31 @@ -915,7 +910,7 @@ class depgraph(object):
32 cases.
33 """
34
35 - if not self._dynamic_config._slot_collision_info:
36 + if not any(self._dynamic_config._package_tracker.slot_conflicts()):
37 return
38
39 self._show_merge_list()
40 @@ -971,16 +966,18 @@ class depgraph(object):
41 is called, so that all relevant reverse dependencies are
42 available for use in backtracking decisions.
43 """
44 - for (slot_atom, root), slot_nodes in \
45 - self._dynamic_config._slot_collision_info.items():
46 - self._process_slot_conflict(root, slot_atom, slot_nodes)
47 + for conflict in self._dynamic_config._package_tracker.slot_conflicts():
48 + self._process_slot_conflict(conflict)
49
50 - def _process_slot_conflict(self, root, slot_atom, slot_nodes):
51 + def _process_slot_conflict(self, conflict):
52 """
53 Process slot conflict data to identify specific atoms which
54 lead to conflict. These atoms only match a subset of the
55 packages that have been pulled into a given slot.
56 """
57 + root = conflict.root
58 + slot_atom = conflict.atom
59 + slot_nodes = conflict.pkgs
60
61 debug = "--debug" in self._frozen_config.myopts
62
63 @@ -1999,7 +1996,6 @@ class depgraph(object):
64
65 existing_node, existing_node_matches = \
66 self._check_slot_conflict(pkg, dep.atom)
67 - slot_collision = False
68 if existing_node:
69 if existing_node_matches:
70 # The existing node can be reused.
71 @@ -2032,19 +2028,7 @@ class depgraph(object):
72 modified_use=self._pkg_use_enabled(existing_node))),
73 level=logging.DEBUG, noiselevel=-1)
74
75 - slot_collision = True
76 -
77 - if slot_collision:
78 - # Now add this node to the graph so that self.display()
79 - # can show use flags and --tree portage.output. This node is
80 - # only being partially added to the graph. It must not be
81 - # allowed to interfere with the other nodes that have been
82 - # added.
83 - # Even though the graph is now invalid, continue to process
84 - # dependencies so that things like --fetchonly can still
85 - # function despite collisions.
86 - pass
87 - elif not previously_added:
88 + if not previously_added:
89 self._dynamic_config._package_tracker.add_pkg(pkg)
90 self._dynamic_config._filtered_trees[pkg.root]["porttree"].dbapi._clear_cache()
91 self._dynamic_config._highest_pkg_cache.clear()
92 @@ -2156,14 +2140,6 @@ class depgraph(object):
93
94 def _add_slot_conflict(self, pkg):
95 self._dynamic_config._slot_collision_nodes.add(pkg)
96 - slot_key = (pkg.slot_atom, pkg.root)
97 - slot_nodes = self._dynamic_config._slot_collision_info.get(slot_key)
98 - if slot_nodes is None:
99 - slot_nodes = set()
100 - slot_nodes.update(self._dynamic_config._package_tracker.match(
101 - pkg.root, pkg.slot_atom, installed=False))
102 - self._dynamic_config._slot_collision_info[slot_key] = slot_nodes
103 - slot_nodes.add(pkg)
104
105 def _add_pkg_deps(self, pkg, allow_unsatisfied=False):
106
107 @@ -3284,7 +3260,8 @@ class depgraph(object):
108 except self._unknown_internal_error:
109 return False, myfavorites
110
111 - if (self._dynamic_config._slot_collision_info and
112 + have_slot_conflict = any(self._dynamic_config._package_tracker.slot_conflicts())
113 + if (have_slot_conflict and
114 not self._accept_blocker_conflicts()) or \
115 (self._dynamic_config._allow_backtracking and
116 "slot conflict" in self._dynamic_config._backtrack_infos):
117 @@ -6806,7 +6783,8 @@ class depgraph(object):
118 # conflicts (or by blind luck).
119 raise self._unknown_internal_error()
120
121 - if self._dynamic_config._slot_collision_info and \
122 + have_slot_conflict = any(self._dynamic_config._package_tracker.slot_conflicts())
123 + if have_slot_conflict and \
124 not self._accept_blocker_conflicts():
125 self._dynamic_config._serialized_tasks_cache = retlist
126 self._dynamic_config._scheduler_graph = scheduler_graph
127 @@ -6881,13 +6859,17 @@ class depgraph(object):
128 # the reasons are not apparent from the normal merge list
129 # display.
130
131 - slot_collision_info = self._dynamic_config._slot_collision_info
132 -
133 conflict_pkgs = {}
134 for blocker in blockers:
135 for pkg in chain(self._dynamic_config._blocked_pkgs.child_nodes(blocker), \
136 self._dynamic_config._blocker_parents.parent_nodes(blocker)):
137 - if (pkg.slot_atom, pkg.root) in slot_collision_info:
138 +
139 + is_slot_conflict_pkg = False
140 + for conflict in self._dynamic_config._package_tracker.slot_conflicts():
141 + if conflict.root == pkg.root and conflict.atom == pkg.slot_atom:
142 + is_slot_conflict_pkg = True
143 + break
144 + if is_slot_conflict_pkg:
145 # The slot conflict display has better noise reduction
146 # than the unsatisfied blockers display, so skip
147 # unsatisfied blockers display for packages involved
148 @@ -7370,7 +7352,8 @@ class depgraph(object):
149 self._dynamic_config._circular_deps_for_display)
150
151 unresolved_conflicts = False
152 - if self._dynamic_config._slot_collision_info:
153 + have_slot_conflict = any(self._dynamic_config._package_tracker.slot_conflicts())
154 + if have_slot_conflict:
155 unresolved_conflicts = True
156 self._show_slot_collision_notice()
157 if self._dynamic_config._unsatisfied_blockers_for_display is not None:
158
159 diff --git a/pym/_emerge/resolver/slot_collision.py b/pym/_emerge/resolver/slot_collision.py
160 index a193baa..ca3fb74 100644
161 --- a/pym/_emerge/resolver/slot_collision.py
162 +++ b/pym/_emerge/resolver/slot_collision.py
163 @@ -89,10 +89,11 @@ class slot_conflict_handler(object):
164 self.debug = "--debug" in self.myopts
165 if self.debug:
166 writemsg("Starting slot conflict handler\n", noiselevel=-1)
167 - #slot_collision_info is a dict mapping (slot atom, root) to set
168 - #of packages. The packages in the set all belong to the same
169 - #slot.
170 - self.slot_collision_info = depgraph._dynamic_config._slot_collision_info
171 +
172 + # List of tuples, where each tuple represents a slot conflict.
173 + self.all_conflicts = []
174 + for conflict in depgraph._dynamic_config._package_tracker.slot_conflicts():
175 + self.all_conflicts.append((conflict.root, conflict.atom, conflict.pkgs))
176
177 #A dict mapping packages to pairs of parent package
178 #and parent atom
179 @@ -109,8 +110,7 @@ class slot_conflict_handler(object):
180 all_conflict_atoms_by_slotatom = []
181
182 #fill conflict_pkgs, all_conflict_atoms_by_slotatom
183 - for (atom, root), pkgs \
184 - in self.slot_collision_info.items():
185 + for root, atom, pkgs in self.all_conflicts:
186 conflict_pkgs.append(list(pkgs))
187 all_conflict_atoms_by_slotatom.append(set())
188
189 @@ -249,8 +249,7 @@ class slot_conflict_handler(object):
190 msg.append("!!! into the dependency graph, resulting" + \
191 " in a slot conflict:\n\n")
192
193 - for (slot_atom, root), pkgs \
194 - in self.slot_collision_info.items():
195 + for root, slot_atom, pkgs in self.all_conflicts:
196 msg.append("%s" % (slot_atom,))
197 if root != self.depgraph._frozen_config._running_root.root:
198 msg.append(" for %s" % (root,))
199 @@ -536,13 +535,13 @@ class slot_conflict_handler(object):
200 return None
201
202 if len(solutions)==1:
203 - if len(self.slot_collision_info)==1:
204 + if len(self.all_conflicts) == 1:
205 msg += "It might be possible to solve this slot collision\n"
206 else:
207 msg += "It might be possible to solve these slot collisions\n"
208 msg += "by applying all of the following changes:\n"
209 else:
210 - if len(self.slot_collision_info)==1:
211 + if len(self.all_conflicts) == 1:
212 msg += "It might be possible to solve this slot collision\n"
213 else:
214 msg += "It might be possible to solve these slot collisions\n"
215 @@ -583,8 +582,7 @@ class slot_conflict_handler(object):
216 if not pkg.installed:
217 continue
218
219 - for (atom, root), pkgs \
220 - in self.slot_collision_info.items():
221 + for root, atom, pkgs in self.all_conflicts:
222 if pkg not in pkgs:
223 continue
224 for other_pkg in pkgs: