Fix --clean <atom> so that it considers all packages within a given slot when
authorZac Medico <zmedico@gentoo.org>
Sun, 21 Dec 2008 06:47:23 +0000 (06:47 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 21 Dec 2008 06:47:23 +0000 (06:47 -0000)
it's deciding which packages to keep, rather than just considering the ones
matched by the given atom. Any packages not matching the given atom are protected
from being unmerged. Thanks to Mart Raudsepp <leio@g.o> for reporting.

svn path=/main/trunk/; revision=12272

pym/_emerge/__init__.py

index da478e6d6482eb1cafc8f5219e2eaa18b3c5e13b..348b2c20bac0a6b8d8b0ea2968c6a7c500b310f4 100644 (file)
@@ -11064,7 +11064,14 @@ def unmerge(root_config, myopts, unmerge_action,
                                        if myslot not in slotmap:
                                                slotmap[myslot] = {}
                                        slotmap[myslot][localtree.dbapi.cpv_counter(mypkg)] = mypkg
-                               
+
+                               for mypkg in vartree.dbapi.cp_list(
+                                       portage.dep_getkey(mymatch[0])):
+                                       myslot = vartree.getslot(mypkg)
+                                       if myslot not in slotmap:
+                                               slotmap[myslot] = {}
+                                       slotmap[myslot][vartree.dbapi.cpv_counter(mypkg)] = mypkg
+
                                for myslot in slotmap:
                                        counterkeys = slotmap[myslot].keys()
                                        if not counterkeys:
@@ -11073,6 +11080,14 @@ def unmerge(root_config, myopts, unmerge_action,
                                        pkgmap[mykey]["protected"].add(
                                                slotmap[myslot][counterkeys[-1]])
                                        del counterkeys[-1]
+
+                                       for counter in counterkeys[:]:
+                                               mypkg = slotmap[myslot][counter]
+                                               if mypkg not in mymatch:
+                                                       counterkeys.remove(counter)
+                                                       pkgmap[mykey]["protected"].add(
+                                                               slotmap[myslot][counter])
+
                                        #be pretty and get them in order of merge:
                                        for ckey in counterkeys:
                                                mypkg = slotmap[myslot][ckey]