1 |
commit: f3b89e80bc5779a784427b1435758c0f88946c05 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Aug 2 08:54:25 2013 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Aug 2 08:54:25 2013 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f3b89e80 |
7 |
|
8 |
_slot_confict_backtrack: simplify code |
9 |
|
10 |
The order of backtrack_data is simply based on version comparison |
11 |
since commit 9b6f69e2a66c0f1d1d6545208edb3c45eacfd845. |
12 |
|
13 |
--- |
14 |
pym/_emerge/depgraph.py | 23 ++++------------------- |
15 |
1 file changed, 4 insertions(+), 19 deletions(-) |
16 |
|
17 |
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py |
18 |
index 39ae3ea..4f9d0f0 100644 |
19 |
--- a/pym/_emerge/depgraph.py |
20 |
+++ b/pym/_emerge/depgraph.py |
21 |
@@ -6,7 +6,6 @@ from __future__ import print_function, unicode_literals |
22 |
import errno |
23 |
import io |
24 |
import logging |
25 |
-import operator |
26 |
import stat |
27 |
import sys |
28 |
import textwrap |
29 |
@@ -959,20 +958,11 @@ class depgraph(object): |
30 |
|
31 |
debug = "--debug" in self._frozen_config.myopts |
32 |
existing_node = self._dynamic_config._slot_pkg_map[root][slot_atom] |
33 |
+ # In order to avoid a missed update, first mask lower versions |
34 |
+ # that conflict with higher versions (the backtracker visits |
35 |
+ # these in reverse order). |
36 |
+ conflict_pkgs.sort(reverse=True) |
37 |
backtrack_data = [] |
38 |
- # The ordering of backtrack_data can make |
39 |
- # a difference here, because both mask actions may lead |
40 |
- # to valid, but different, solutions and the one with |
41 |
- # 'existing_node' masked is usually the better one. Because |
42 |
- # of that, we choose an order such that |
43 |
- # the backtracker will first explore the choice with |
44 |
- # existing_node masked. The backtracker reverses the |
45 |
- # order, so the order it uses is the reverse of the |
46 |
- # order shown here. See bug #339606. |
47 |
- if existing_node in conflict_pkgs and \ |
48 |
- existing_node is not conflict_pkgs[-1]: |
49 |
- conflict_pkgs.remove(existing_node) |
50 |
- conflict_pkgs.append(existing_node) |
51 |
for to_be_masked in conflict_pkgs: |
52 |
# For missed update messages, find out which |
53 |
# atoms matched to_be_selected that did not |
54 |
@@ -983,11 +973,6 @@ class depgraph(object): |
55 |
if parent_atom not in parent_atoms) |
56 |
backtrack_data.append((to_be_masked, conflict_atoms)) |
57 |
|
58 |
- if len(backtrack_data) > 1: |
59 |
- # In order to avoid a missed update, first mask lower |
60 |
- # versions that conflict with higher versions. |
61 |
- backtrack_data.sort(key=operator.itemgetter(0), reverse=True) |
62 |
- |
63 |
to_be_masked = backtrack_data[-1][0] |
64 |
|
65 |
self._dynamic_config._backtrack_infos.setdefault( |