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