public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico (zmedico)" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] portage r10172 - main/branches/2.1.2/bin
Date: Sun, 04 May 2008 08:10:13 +0000	[thread overview]
Message-ID: <E1JsZIT-0000Bg-33@stork.gentoo.org> (raw)

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



                 reply	other threads:[~2008-05-04  8:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1JsZIT-0000Bg-33@stork.gentoo.org \
    --to=zmedico@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox