From de2ffe652eec8d00db12eae891d524db9c89e626 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 18 Jul 2006 03:52:13 +0000 Subject: Simplify generation of the cleanlist for depclean. svn path=/main/trunk/; revision=3915 --- bin/emerge | 34 ++++++++-------------------------- 1 file changed, 8 insertions(+), 26 deletions(-) (limited to 'bin/emerge') diff --git a/bin/emerge b/bin/emerge index 66bbcf6a1..9fc2daba8 100755 --- a/bin/emerge +++ b/bin/emerge @@ -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) -- cgit v1.2.3-1-g7c22