Simplify generation of the cleanlist for depclean.
authorZac Medico <zmedico@gentoo.org>
Tue, 18 Jul 2006 03:52:13 +0000 (03:52 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 18 Jul 2006 03:52:13 +0000 (03:52 -0000)
svn path=/main/trunk/; revision=3915

bin/emerge

index 66bbcf6a1528b0bd8347cf94a52e385e8d11cda0..9fc2daba84b8e9e7061ff730b56cee7334376198 100755 (executable)
@@ -3254,38 +3254,20 @@ def action_depclean(settings, trees, ldpath_mtimes,
                        reallist.append(catpack)
                explicitly_required.add(x.split()[2])
 
+       
+       sys_world_unversioned = set()
+       from itertools import chain
+       for x in chain(syslist, worldlist):
+               sys_world_unversioned.add(portage.dep_getkey(x))
+
        cleanlist=[]
-       clean_unversioned = []
        for x in myvarlist:
                if x not in explicitly_required:
-                       cleanlist.append(x)
-                       clean_unversioned.append(portage.dep_getkey(x))
-
-       for x in syslist+worldlist:
-               myparts = portage.catpkgsplit(x)
-               if myparts:
-                       if myparts[0][0] in ('<','>','='):
-                               myparts[0] = myparts[0][1:]
-                       if myparts[0][0] in ('<','>','='):
-                               myparts[0] = myparts[0][1:]
-                       catpack=myparts[0]+"/"+myparts[1]
-               else:
-                       catpack=x
-               while True:
                        # We have to exempt all slots from the system and world sets since
                        # there's currently no way of knowing which slots the user may want
                        # to keep.
-                       try:
-                               idx = clean_unversioned.index(catpack) # raises ValueError
-                               del cleanlist[idx]
-                               del clean_unversioned[idx]
-                       except ValueError:
-                               break
-
-       #print "\n\n\nCleaning: "
-       #for x in cleanlist:
-       #       print x
-       #print
+                       if portage.dep_getkey(x) not in sys_world_unversioned:
+                               cleanlist.append(x)
 
        if len(cleanlist):
                unmerge(settings, myopts, vartree, "unmerge", cleanlist, ldpath_mtimes)