public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] portage r10172 - main/branches/2.1.2/bin
@ 2008-05-04  8:10 Zac Medico (zmedico)
  0 siblings, 0 replies; only message in thread
From: Zac Medico (zmedico) @ 2008-05-04  8:10 UTC (permalink / raw
  To: gentoo-commits

Author: zmedico
Date: 2008-05-04 08:10:12 +0000 (Sun, 04 May 2008)
New Revision: 10172

Modified:
   main/branches/2.1.2/bin/emerge
Log:
Similar to the sys-apps/portage protection, also add protection against
inappropriately uninstalling either app-shells/bash or dev-lang/python.
(trunk r10171)


Modified: main/branches/2.1.2/bin/emerge
===================================================================
--- main/branches/2.1.2/bin/emerge	2008-05-04 08:06:58 UTC (rev 10171)
+++ main/branches/2.1.2/bin/emerge	2008-05-04 08:10:12 UTC (rev 10172)
@@ -3640,6 +3640,9 @@
 				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 @@
 						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.

-- 
gentoo-commits@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-05-04  8:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-04  8:10 [gentoo-commits] portage r10172 - main/branches/2.1.2/bin Zac Medico (zmedico)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox