public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] portage r10177 - main/branches/prefix/pym/_emerge
@ 2008-05-04 12:02 Fabian Groffen (grobian)
  0 siblings, 0 replies; only message in thread
From: Fabian Groffen (grobian) @ 2008-05-04 12:02 UTC (permalink / raw
  To: gentoo-commits

Author: grobian
Date: 2008-05-04 12:02:29 +0000 (Sun, 04 May 2008)
New Revision: 10177

Modified:
   main/branches/prefix/pym/_emerge/__init__.py
Log:
   Merged from trunk 10165:10171

   | 10171   | Similar to the sys-apps/portage protection, also add         |
   | zmedico | protection against inappropriately uninstalling either       |
   |         | app-shells/bash or dev-lang/python.                          |


Modified: main/branches/prefix/pym/_emerge/__init__.py
===================================================================
--- main/branches/prefix/pym/_emerge/__init__.py	2008-05-04 11:32:23 UTC (rev 10176)
+++ main/branches/prefix/pym/_emerge/__init__.py	2008-05-04 12:02:29 UTC (rev 10177)
@@ -3514,6 +3514,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]
@@ -3702,10 +3705,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 12:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-04 12:02 [gentoo-commits] portage r10177 - main/branches/prefix/pym/_emerge Fabian Groffen (grobian)

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