1 |
Author: zmedico |
2 |
Date: 2009-07-01 00:27:38 +0000 (Wed, 01 Jul 2009) |
3 |
New Revision: 13752 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/_emerge/depgraph.py |
7 |
Log: |
8 |
Fix depgraph._serialize_tasks so it never performa a needless uninstall task |
9 |
when a package in the same slot is scheduled to replace it. |
10 |
|
11 |
|
12 |
Modified: main/trunk/pym/_emerge/depgraph.py |
13 |
=================================================================== |
14 |
--- main/trunk/pym/_emerge/depgraph.py 2009-06-30 23:26:36 UTC (rev 13751) |
15 |
+++ main/trunk/pym/_emerge/depgraph.py 2009-07-01 00:27:38 UTC (rev 13752) |
16 |
@@ -2877,28 +2877,16 @@ |
17 |
ignore_priority = priority_range.ignore_priority[i] |
18 |
nodes = get_nodes(ignore_priority=ignore_priority) |
19 |
if nodes: |
20 |
- # If there is a mix of uninstall nodes with other |
21 |
- # types, save the uninstall nodes for later since |
22 |
- # sometimes a merge node will render an uninstall |
23 |
- # node unnecessary (due to occupying the same slot), |
24 |
- # and we want to avoid executing a separate uninstall |
25 |
- # task in that case. |
26 |
+ # If there is a mixuture of merges and uninstalls, |
27 |
+ # do the uninstalls first. |
28 |
if len(nodes) > 1: |
29 |
good_uninstalls = [] |
30 |
- with_some_uninstalls_excluded = [] |
31 |
for node in nodes: |
32 |
if node.operation == "uninstall": |
33 |
- slot_node = self._dynamic_config.mydbapi[node.root |
34 |
- ].match_pkgs(node.slot_atom) |
35 |
- if slot_node and \ |
36 |
- slot_node[0].operation == "merge": |
37 |
- continue |
38 |
good_uninstalls.append(node) |
39 |
- with_some_uninstalls_excluded.append(node) |
40 |
+ |
41 |
if good_uninstalls: |
42 |
nodes = good_uninstalls |
43 |
- elif with_some_uninstalls_excluded: |
44 |
- nodes = with_some_uninstalls_excluded |
45 |
else: |
46 |
nodes = nodes |
47 |
|
48 |
@@ -3151,6 +3139,17 @@ |
49 |
scheduler_graph.add(blocked_pkg, uninst_task, |
50 |
priority=BlockerDepPriority.instance) |
51 |
|
52 |
+ # Sometimes a merge node will render an uninstall |
53 |
+ # node unnecessary (due to occupying the same SLOT), |
54 |
+ # and we want to avoid executing a separate uninstall |
55 |
+ # task in that case. |
56 |
+ slot_node = self._dynamic_config.mydbapi[uninst_task.root |
57 |
+ ].match_pkgs(uninst_task.slot_atom) |
58 |
+ if slot_node and \ |
59 |
+ slot_node[0].operation == "merge": |
60 |
+ mygraph.add(slot_node[0], uninst_task, |
61 |
+ priority=BlockerDepPriority.instance) |
62 |
+ |
63 |
# Reset the state variables for leaf node selection and |
64 |
# continue trying to select leaf nodes. |
65 |
prefer_asap = True |