1 |
Author: zmedico |
2 |
Date: 2009-06-29 23:34:42 +0000 (Mon, 29 Jun 2009) |
3 |
New Revision: 13737 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/portage/__init__.py |
7 |
Log: |
8 |
Bug #275796 - Prefer packages selected for install over installed packages. |
9 |
This helps automatically solve cases such as the upgrade to the new bluez |
10 |
package which requires uninstallation of the older bluez-libs and bluez-utils |
11 |
packages. Thanks to Sebastian Mingramm (few) <s.mingramm@×××.de> for this |
12 |
patch. |
13 |
|
14 |
|
15 |
Modified: main/trunk/pym/portage/__init__.py |
16 |
=================================================================== |
17 |
--- main/trunk/pym/portage/__init__.py 2009-06-29 23:03:19 UTC (rev 13736) |
18 |
+++ main/trunk/pym/portage/__init__.py 2009-06-29 23:34:42 UTC (rev 13737) |
19 |
@@ -7073,10 +7073,10 @@ |
20 |
# c) contains masked installed packages |
21 |
# d) is the first item |
22 |
|
23 |
- preferred = [] |
24 |
- preferred_not_installed = [] |
25 |
+ preferred_installed = [] |
26 |
+ preferred_in_graph = [] |
27 |
preferred_any_slot = [] |
28 |
- possible_upgrades = [] |
29 |
+ preferred_non_installed = [] |
30 |
other = [] |
31 |
|
32 |
# Alias the trees we'll be checking availability against |
33 |
@@ -7091,15 +7091,15 @@ |
34 |
else: |
35 |
mydbapi = trees[myroot]["porttree"].dbapi |
36 |
|
37 |
- # Sort the deps into preferred (installed) and other |
38 |
- # with values of [[required_atom], availablility] |
39 |
+ # Sort the deps into installed, not installed but already |
40 |
+ # in the graph and other, not installed and not in the graph |
41 |
+ # and other, with values of [[required_atom], availablility] |
42 |
for dep, satisfied in izip(deps, satisfieds): |
43 |
if isinstance(dep, list): |
44 |
atoms = dep_zapdeps(dep, satisfied, myroot, |
45 |
use_binaries=use_binaries, trees=trees) |
46 |
else: |
47 |
atoms = [dep] |
48 |
- |
49 |
if not vardb: |
50 |
# called by repoman |
51 |
other.append((atoms, None, False)) |
52 |
@@ -7124,8 +7124,8 @@ |
53 |
this_choice = (atoms, versions, all_available) |
54 |
if all_available: |
55 |
# The "all installed" criterion is not version or slot specific. |
56 |
- # If any version of a package is installed then we assume that it |
57 |
- # is preferred over other possible packages choices. |
58 |
+ # If any version of a package is already in the graph then we |
59 |
+ # assume that it is preferred over other possible packages choices. |
60 |
all_installed = True |
61 |
for atom in set([dep_getkey(atom) for atom in atoms \ |
62 |
if atom[:1] != "!"]): |
63 |
@@ -7144,7 +7144,7 @@ |
64 |
break |
65 |
if all_installed: |
66 |
if all_installed_slots: |
67 |
- preferred.append(this_choice) |
68 |
+ preferred_installed.append(this_choice) |
69 |
else: |
70 |
preferred_any_slot.append(this_choice) |
71 |
elif graph_db is None: |
72 |
@@ -7159,7 +7159,7 @@ |
73 |
break |
74 |
if all_in_graph: |
75 |
if parent is None or priority is None: |
76 |
- preferred_not_installed.append(this_choice) |
77 |
+ preferred_in_graph.append(this_choice) |
78 |
elif priority.buildtime: |
79 |
# Check if the atom would result in a direct circular |
80 |
# dependency and try to avoid that if it seems likely |
81 |
@@ -7181,11 +7181,11 @@ |
82 |
circular_atom = atom |
83 |
break |
84 |
if circular_atom is None: |
85 |
- preferred_not_installed.append(this_choice) |
86 |
+ preferred_in_graph.append(this_choice) |
87 |
else: |
88 |
other.append(this_choice) |
89 |
else: |
90 |
- possible_upgrades.append(this_choice) |
91 |
+ preferred_non_installed.append(this_choice) |
92 |
else: |
93 |
other.append(this_choice) |
94 |
|
95 |
@@ -7195,9 +7195,7 @@ |
96 |
# into || ( highest version ... lowest version ). We want to prefer the |
97 |
# highest all_available version of the new-style virtual when there is a |
98 |
# lower all_installed version. |
99 |
- preferred.extend(preferred_not_installed) |
100 |
- preferred.extend(preferred_any_slot) |
101 |
- preferred.extend(possible_upgrades) |
102 |
+ preferred = preferred_in_graph + preferred_installed + preferred_any_slot + preferred_non_installed |
103 |
possible_upgrades = preferred[1:] |
104 |
for possible_upgrade in possible_upgrades: |
105 |
atoms, versions, all_available = possible_upgrade |