summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-05-04 08:10:12 +0000
committerZac Medico <zmedico@gentoo.org>2008-05-04 08:10:12 +0000
commite8b23dfae9b01466f034c1e3f9f8fa82e3ed46d8 (patch)
tree772712d16a0ebf42a5c2c17a297411a0b64fe0f6 /bin
parentf2028bc81c055b193f66f0bc4e73f3602f2cf3c1 (diff)
downloadportage-e8b23dfae9b01466f034c1e3f9f8fa82e3ed46d8.tar.gz
portage-e8b23dfae9b01466f034c1e3f9f8fa82e3ed46d8.tar.bz2
portage-e8b23dfae9b01466f034c1e3f9f8fa82e3ed46d8.zip
Similar to the sys-apps/portage protection, also add protection against
inappropriately uninstalling either app-shells/bash or dev-lang/python. (trunk r10171) svn path=/main/branches/2.1.2/; revision=10172
Diffstat (limited to 'bin')
-rwxr-xr-xbin/emerge27
1 files changed, 24 insertions, 3 deletions
diff --git a/bin/emerge b/bin/emerge
index 75da6349c..808101b9c 100755
--- a/bin/emerge
+++ b/bin/emerge
@@ -3640,6 +3640,9 @@ class depgraph(object):
node.operation != "uninstall"]
# sys-apps/portage needs special treatment if ROOT="/"
+ portage_python_dep = ">=dev-lang/python-2.4"
+ portage_unslotted_deps = frozenset(
+ ["app-shells/bash", "sys-apps/portage"])
portage_node = self.mydbapi["/"].match_pkgs("sys-apps/portage")
if portage_node:
portage_node = portage_node[0]
@@ -3828,10 +3831,28 @@ class depgraph(object):
continue
if "/" == task.root:
- # Never uninstall sys-apps/portage
- # except through replacement.
- if "sys-apps/portage" == task.cp:
+ # Never uninstall sys-apps/portage or it's essential
+ # dependencies, except through replacement.
+ if task.cp in portage_unslotted_deps:
continue
+
+ # Don't uninstall python if it appears to be
+ # the only suitable one installed.
+ if task.cp == "dev-lang/python" and \
+ portage.match_from_list(
+ portage_python_dep, [task.cpv_slot]):
+ vardb = root_config.trees["vartree"].dbapi
+ other_version = None
+ for pkg in vardb.match_pkgs(portage_python_dep):
+ if pkg.cpv == task.cpv and \
+ pkg.metadata["COUNTER"] == \
+ task.metadata["COUNTER"]:
+ continue
+ other_version = pkg
+ break
+ if other_version is None:
+ continue
+
# For packages in the system set, don't take
# any chances. If the conflict can't be resolved
# by a normal replacement operation then abort.