public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [gentoo-commits] portage r11756 - main/trunk/pym/_emerge
@ 2008-10-30 22:18 99% Zac Medico (zmedico)
  0 siblings, 0 replies; 1+ results
From: Zac Medico (zmedico) @ 2008-10-30 22:18 UTC (permalink / raw
  To: gentoo-commits

Author: zmedico
Date: 2008-10-30 22:18:55 +0000 (Thu, 30 Oct 2008)
New Revision: 11756

Modified:
   main/trunk/pym/_emerge/__init__.py
Log:
Bug #244975 - Don't allow the user to make portage unmerge itself since
there's never any valid reason to do so.


Modified: main/trunk/pym/_emerge/__init__.py
===================================================================
--- main/trunk/pym/_emerge/__init__.py	2008-10-30 21:16:03 UTC (rev 11755)
+++ main/trunk/pym/_emerge/__init__.py	2008-10-30 22:18:55 UTC (rev 11756)
@@ -10489,7 +10489,7 @@
 	candidate_catpkgs=[]
 	global_unmerge=0
 	xterm_titles = "notitles" not in settings.features
-
+	out = portage.output.EOutput()
 	pkg_cache = {}
 	db_keys = list(vartree.dbapi._aux_cache_keys)
 
@@ -10754,6 +10754,21 @@
 				# It could have been uninstalled
 				# by a concurrent process.
 				continue
+
+			if unmerge_action != "clean" and \
+				root_config.root == "/" and \
+				portage.match_from_list(
+				portage.const.PORTAGE_PACKAGE_ATOM, [pkg]):
+				msg = ("Not unmerging package %s since there is no valid " + \
+				"reason for portage to unmerge itself.") % (pkg.cpv,)
+				for line in textwrap.wrap(msg, 75):
+					out.eerror(line)
+				# adjust pkgmap so the display output is correct
+				pkgmap[cp]["selected"].remove(cpv)
+				all_selected.remove(cpv)
+				pkgmap[cp]["protected"].add(cpv)
+				continue
+
 			parents = []
 			for s in installed_sets:
 				# skip sets that the user requested to unmerge, and skip world 
@@ -10812,10 +10827,18 @@
 				print "    %s\n" % ", ".join(parents)
 				# adjust pkgmap so the display output is correct
 				pkgmap[cp]["selected"].remove(cpv)
+				all_selected.remove(cpv)
 				pkgmap[cp]["protected"].add(cpv)
 	
 	del installed_sets
 
+	numselected = len(all_selected)
+	if not numselected:
+		writemsg_level(
+			"\n>>> No packages selected for removal by " + \
+			unmerge_action + "\n")
+		return 0
+
 	# Unmerge order only matters in some cases
 	if not ordered:
 		unordered = {}




^ permalink raw reply	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2008-10-30 22:18 99% [gentoo-commits] portage r11756 - main/trunk/pym/_emerge 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