From 2e93dbf5a3181abd47fc5529d07ed372bef3b462 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 17 Jul 2006 23:57:40 +0000 Subject: Fix depclean so that it cleans unneeded slots (unless they are exempted by the system or world sets). See bug #140591. svn path=/main/trunk/; revision=3914 --- bin/emerge | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'bin/emerge') diff --git a/bin/emerge b/bin/emerge index 953d9bb58..66bbcf6a1 100755 --- a/bin/emerge +++ b/bin/emerge @@ -3193,7 +3193,7 @@ def action_depclean(settings, trees, ldpath_mtimes, vartree = trees[settings["ROOT"]]["vartree"] syslist = getlist(settings, "system") worldlist = getlist(settings, "world") - myvarlist = vartree.dbapi.cp_all() + myvarlist = vartree.dbapi.cpv_all() if not syslist: print "\n!!! You have no system list.", @@ -3235,6 +3235,7 @@ def action_depclean(settings, trees, ldpath_mtimes, sys.exit(1) reallist=[] + explicitly_required = set() for x in alldeps: myparts=portage.catpkgsplit(string.split(x)[2]) if not myparts: @@ -3251,12 +3252,14 @@ def action_depclean(settings, trees, ldpath_mtimes, catpack=myparts[0]+"/"+myparts[1] if catpack not in reallist: reallist.append(catpack) + explicitly_required.add(x.split()[2]) cleanlist=[] + clean_unversioned = [] for x in myvarlist: - if x not in reallist: - if x not in cleanlist: - cleanlist.append(x) + 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) @@ -3268,8 +3271,16 @@ def action_depclean(settings, trees, ldpath_mtimes, catpack=myparts[0]+"/"+myparts[1] else: catpack=x - if catpack in cleanlist: - cleanlist.remove(catpack) + 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: -- cgit v1.2.3-1-g7c22