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