1 |
Author: zmedico |
2 |
Date: 2008-05-04 19:48:00 +0000 (Sun, 04 May 2008) |
3 |
New Revision: 10185 |
4 |
|
5 |
Modified: |
6 |
main/branches/2.1.2/bin/emerge |
7 |
main/branches/2.1.2/pym/portage_const.py |
8 |
Log: |
9 |
In the package uninstall sanity check, use RDEPEND from the currently |
10 |
running 'sys-apps/portage' instance to create a set of protected atoms. |
11 |
(trunk r10184) |
12 |
|
13 |
|
14 |
Modified: main/branches/2.1.2/bin/emerge |
15 |
=================================================================== |
16 |
--- main/branches/2.1.2/bin/emerge 2008-05-04 19:41:52 UTC (rev 10184) |
17 |
+++ main/branches/2.1.2/bin/emerge 2008-05-04 19:48:00 UTC (rev 10185) |
18 |
@@ -3640,19 +3640,43 @@ |
19 |
node.operation != "uninstall"] |
20 |
|
21 |
# sys-apps/portage needs special treatment if ROOT="/" |
22 |
- portage_python_dep = ">=dev-lang/python-2.4" |
23 |
- portage_unslotted_deps = frozenset( |
24 |
- ["app-shells/bash", "sys-apps/portage"]) |
25 |
- portage_node = self.mydbapi["/"].match_pkgs("sys-apps/portage") |
26 |
- if portage_node: |
27 |
- portage_node = portage_node[0] |
28 |
+ running_root = "/" |
29 |
+ from portage_const import PORTAGE_PACKAGE_ATOM |
30 |
+ runtime_deps = InternalPackageSet( |
31 |
+ initial_atoms=[PORTAGE_PACKAGE_ATOM]) |
32 |
+ running_portage = self.trees[running_root]["vartree"].dbapi.match_pkgs( |
33 |
+ PORTAGE_PACKAGE_ATOM) |
34 |
+ replacement_portage = self.mydbapi[running_root].match_pkgs( |
35 |
+ PORTAGE_PACKAGE_ATOM) |
36 |
+ |
37 |
+ if running_portage: |
38 |
+ running_portage = running_portage[0] |
39 |
else: |
40 |
- portage_node = None |
41 |
- if portage_node is not None and \ |
42 |
- (not mygraph.contains(portage_node) or \ |
43 |
- portage_node.operation == "nomerge"): |
44 |
- portage_node = None |
45 |
+ running_portage = None |
46 |
|
47 |
+ if replacement_portage: |
48 |
+ replacement_portage = replacement_portage[0] |
49 |
+ else: |
50 |
+ replacement_portage = None |
51 |
+ |
52 |
+ if replacement_portage == running_portage: |
53 |
+ replacement_portage = None |
54 |
+ |
55 |
+ if running_portage is not None: |
56 |
+ try: |
57 |
+ portage_rdepend = self._select_atoms_highest_available( |
58 |
+ running_root, running_portage.metadata["RDEPEND"], |
59 |
+ myuse=running_portage.metadata["USE"].split(), |
60 |
+ parent=running_portage, strict=False) |
61 |
+ except portage_exception.InvalidDependString, e: |
62 |
+ portage.writemsg("!!! Invalid RDEPEND in " + \ |
63 |
+ "'%svar/db/pkg/%s/RDEPEND': %s\n" % \ |
64 |
+ (running_root, running_portage.cpv, e), noiselevel=-1) |
65 |
+ del e |
66 |
+ portage_rdepend = [] |
67 |
+ runtime_deps.update(atom for atom in portage_rdepend \ |
68 |
+ if not atom.startswith("!")) |
69 |
+ |
70 |
ignore_priority_soft_range = [None] |
71 |
ignore_priority_soft_range.extend( |
72 |
xrange(DepPriority.MIN, DepPriority.MEDIUM_SOFT + 1)) |
73 |
@@ -3735,7 +3759,8 @@ |
74 |
return True |
75 |
if node not in mergeable_nodes: |
76 |
return False |
77 |
- if node == portage_node and mygraph.child_nodes(node, |
78 |
+ if node == replacement_portage and \ |
79 |
+ mygraph.child_nodes(node, |
80 |
ignore_priority=DepPriority.MEDIUM_SOFT): |
81 |
# Make sure that portage always has all of it's |
82 |
# RDEPENDs installed first. |
83 |
@@ -3830,20 +3855,26 @@ |
84 |
if self.digraph.contains(inst_pkg): |
85 |
continue |
86 |
|
87 |
- if "/" == task.root: |
88 |
+ if running_root == task.root: |
89 |
# Never uninstall sys-apps/portage or it's essential |
90 |
# dependencies, except through replacement. |
91 |
- if task.cp in portage_unslotted_deps: |
92 |
+ try: |
93 |
+ runtime_dep_atoms = \ |
94 |
+ list(runtime_deps.iterAtomsForPackage(task)) |
95 |
+ except portage_exception.InvalidDependString, e: |
96 |
+ portage.writemsg("!!! Invalid PROVIDE in " + \ |
97 |
+ "'%svar/db/pkg/%s/PROVIDE': %s\n" % \ |
98 |
+ (task.root, task.cpv, e), noiselevel=-1) |
99 |
+ del e |
100 |
continue |
101 |
|
102 |
- # Don't uninstall python if it appears to be |
103 |
- # the only suitable one installed. |
104 |
- if task.cp == "dev-lang/python" and \ |
105 |
- portage.match_from_list( |
106 |
- portage_python_dep, [task.cpv_slot]): |
107 |
- vardb = root_config.trees["vartree"].dbapi |
108 |
+ # Don't uninstall a runtime dep if it appears |
109 |
+ # to be the only suitable one installed. |
110 |
+ skip = False |
111 |
+ vardb = root_config.trees["vartree"].dbapi |
112 |
+ for atom in runtime_dep_atoms: |
113 |
other_version = None |
114 |
- for pkg in vardb.match_pkgs(portage_python_dep): |
115 |
+ for pkg in vardb.match_pkgs(atom): |
116 |
if pkg.cpv == task.cpv and \ |
117 |
pkg.metadata["COUNTER"] == \ |
118 |
task.metadata["COUNTER"]: |
119 |
@@ -3851,7 +3882,10 @@ |
120 |
other_version = pkg |
121 |
break |
122 |
if other_version is None: |
123 |
- continue |
124 |
+ skip = True |
125 |
+ break |
126 |
+ if skip: |
127 |
+ continue |
128 |
|
129 |
# For packages in the system set, don't take |
130 |
# any chances. If the conflict can't be resolved |
131 |
|
132 |
Modified: main/branches/2.1.2/pym/portage_const.py |
133 |
=================================================================== |
134 |
--- main/branches/2.1.2/pym/portage_const.py 2008-05-04 19:41:52 UTC (rev 10184) |
135 |
+++ main/branches/2.1.2/pym/portage_const.py 2008-05-04 19:48:00 UTC (rev 10185) |
136 |
@@ -23,6 +23,7 @@ |
137 |
PORTAGE_BASE_PATH = os.path.join(os.sep, os.sep.join(__file__.split(os.sep)[:-2])) |
138 |
PORTAGE_BIN_PATH = PORTAGE_BASE_PATH+"/bin" |
139 |
PORTAGE_PYM_PATH = PORTAGE_BASE_PATH+"/pym" |
140 |
+PORTAGE_PACKAGE_ATOM = "sys-apps/portage" |
141 |
PROFILE_PATH = "/etc/make.profile" |
142 |
LOCALE_DATA_PATH = PORTAGE_BASE_PATH+"/locale" |
143 |
|
144 |
|
145 |
-- |
146 |
gentoo-commits@l.g.o mailing list |