1 |
Author: zmedico |
2 |
Date: 2008-05-04 08:10:12 +0000 (Sun, 04 May 2008) |
3 |
New Revision: 10172 |
4 |
|
5 |
Modified: |
6 |
main/branches/2.1.2/bin/emerge |
7 |
Log: |
8 |
Similar to the sys-apps/portage protection, also add protection against |
9 |
inappropriately uninstalling either app-shells/bash or dev-lang/python. |
10 |
(trunk r10171) |
11 |
|
12 |
|
13 |
Modified: main/branches/2.1.2/bin/emerge |
14 |
=================================================================== |
15 |
--- main/branches/2.1.2/bin/emerge 2008-05-04 08:06:58 UTC (rev 10171) |
16 |
+++ main/branches/2.1.2/bin/emerge 2008-05-04 08:10:12 UTC (rev 10172) |
17 |
@@ -3640,6 +3640,9 @@ |
18 |
node.operation != "uninstall"] |
19 |
|
20 |
# sys-apps/portage needs special treatment if ROOT="/" |
21 |
+ portage_python_dep = ">=dev-lang/python-2.4" |
22 |
+ portage_unslotted_deps = frozenset( |
23 |
+ ["app-shells/bash", "sys-apps/portage"]) |
24 |
portage_node = self.mydbapi["/"].match_pkgs("sys-apps/portage") |
25 |
if portage_node: |
26 |
portage_node = portage_node[0] |
27 |
@@ -3828,10 +3831,28 @@ |
28 |
continue |
29 |
|
30 |
if "/" == task.root: |
31 |
- # Never uninstall sys-apps/portage |
32 |
- # except through replacement. |
33 |
- if "sys-apps/portage" == task.cp: |
34 |
+ # Never uninstall sys-apps/portage or it's essential |
35 |
+ # dependencies, except through replacement. |
36 |
+ if task.cp in portage_unslotted_deps: |
37 |
continue |
38 |
+ |
39 |
+ # Don't uninstall python if it appears to be |
40 |
+ # the only suitable one installed. |
41 |
+ if task.cp == "dev-lang/python" and \ |
42 |
+ portage.match_from_list( |
43 |
+ portage_python_dep, [task.cpv_slot]): |
44 |
+ vardb = root_config.trees["vartree"].dbapi |
45 |
+ other_version = None |
46 |
+ for pkg in vardb.match_pkgs(portage_python_dep): |
47 |
+ if pkg.cpv == task.cpv and \ |
48 |
+ pkg.metadata["COUNTER"] == \ |
49 |
+ task.metadata["COUNTER"]: |
50 |
+ continue |
51 |
+ other_version = pkg |
52 |
+ break |
53 |
+ if other_version is None: |
54 |
+ continue |
55 |
+ |
56 |
# For packages in the system set, don't take |
57 |
# any chances. If the conflict can't be resolved |
58 |
# by a normal replacement operation then abort. |
59 |
|
60 |
-- |
61 |
gentoo-commits@l.g.o mailing list |