Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r11756 - main/trunk/pym/_emerge
Date: Thu, 30 Oct 2008 22:18:59
Message-Id: E1Kvfqy-0006Da-8z@stork.gentoo.org
1 Author: zmedico
2 Date: 2008-10-30 22:18:55 +0000 (Thu, 30 Oct 2008)
3 New Revision: 11756
4
5 Modified:
6 main/trunk/pym/_emerge/__init__.py
7 Log:
8 Bug #244975 - Don't allow the user to make portage unmerge itself since
9 there's never any valid reason to do so.
10
11
12 Modified: main/trunk/pym/_emerge/__init__.py
13 ===================================================================
14 --- main/trunk/pym/_emerge/__init__.py 2008-10-30 21:16:03 UTC (rev 11755)
15 +++ main/trunk/pym/_emerge/__init__.py 2008-10-30 22:18:55 UTC (rev 11756)
16 @@ -10489,7 +10489,7 @@
17 candidate_catpkgs=[]
18 global_unmerge=0
19 xterm_titles = "notitles" not in settings.features
20 -
21 + out = portage.output.EOutput()
22 pkg_cache = {}
23 db_keys = list(vartree.dbapi._aux_cache_keys)
24
25 @@ -10754,6 +10754,21 @@
26 # It could have been uninstalled
27 # by a concurrent process.
28 continue
29 +
30 + if unmerge_action != "clean" and \
31 + root_config.root == "/" and \
32 + portage.match_from_list(
33 + portage.const.PORTAGE_PACKAGE_ATOM, [pkg]):
34 + msg = ("Not unmerging package %s since there is no valid " + \
35 + "reason for portage to unmerge itself.") % (pkg.cpv,)
36 + for line in textwrap.wrap(msg, 75):
37 + out.eerror(line)
38 + # adjust pkgmap so the display output is correct
39 + pkgmap[cp]["selected"].remove(cpv)
40 + all_selected.remove(cpv)
41 + pkgmap[cp]["protected"].add(cpv)
42 + continue
43 +
44 parents = []
45 for s in installed_sets:
46 # skip sets that the user requested to unmerge, and skip world
47 @@ -10812,10 +10827,18 @@
48 print " %s\n" % ", ".join(parents)
49 # adjust pkgmap so the display output is correct
50 pkgmap[cp]["selected"].remove(cpv)
51 + all_selected.remove(cpv)
52 pkgmap[cp]["protected"].add(cpv)
53
54 del installed_sets
55
56 + numselected = len(all_selected)
57 + if not numselected:
58 + writemsg_level(
59 + "\n>>> No packages selected for removal by " + \
60 + unmerge_action + "\n")
61 + return 0
62 +
63 # Unmerge order only matters in some cases
64 if not ordered:
65 unordered = {}