From 95d2c315c5a844c9f6154ee90dcc500d1825a68f Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 17 Feb 2008 00:29:23 +0000 Subject: Bug #201045 - Make unmerge() preserve the unmerge order of packages given to it by the user or depclean. svn path=/main/trunk/; revision=9346 --- pym/_emerge/__init__.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'pym') diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 90134d42e..c266f592e 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -4951,7 +4951,7 @@ def unmerge(root_config, myopts, unmerge_action, print darkgreen(newline+\ ">>> These are the packages that would be unmerged:") - pkgmap={} + pkgmap = [] numselected=0 for x in candidate_catpkgs: # cycle through all our candidate deps and determine @@ -4977,11 +4977,8 @@ def unmerge(root_config, myopts, unmerge_action, portage.writemsg("\n--- Couldn't find '%s' to %s.\n" % \ (x, unmerge_action), noiselevel=-1) continue - mykey = portage.key_expand( - portage.dep_getkey( - mymatch[0]), mydb=vartree.dbapi, settings=settings) - if not pkgmap.has_key(mykey): - pkgmap[mykey]={"protected":[], "selected":[], "omitted":[] } + pkgmap.append({"protected":[], "selected":[], "omitted":[] }) + mykey = len(pkgmap) - 1 if unmerge_action=="unmerge": for y in mymatch: if y not in pkgmap[mykey]["selected"]: @@ -5051,8 +5048,12 @@ def unmerge(root_config, myopts, unmerge_action, finally: if vdb_lock: portage.locks.unlockdir(vdb_lock) - for x in pkgmap: - for y in localtree.dep_match(x): + for x in xrange(len(pkgmap)): + selected = pkgmap[x]["selected"] + if not selected: + continue + cp = portage.cpv_getkey(selected[0]) + for y in localtree.dep_match(cp): if y not in pkgmap[x]["omitted"] and \ y not in pkgmap[x]["selected"] and \ y not in pkgmap[x]["protected"]: @@ -5060,16 +5061,16 @@ def unmerge(root_config, myopts, unmerge_action, if global_unmerge and not pkgmap[x]["selected"]: #avoid cluttering the preview printout with stuff that isn't getting unmerged continue - if not (pkgmap[x]["protected"] or pkgmap[x]["omitted"]) and (x in syslist): - print colorize("BAD","\a\n\n!!! '%s' is part of your system profile." % x) + if not (pkgmap[x]["protected"] or pkgmap[x]["omitted"]) and cp in syslist: + print colorize("BAD","\a\n\n!!! '%s' is part of your system profile." % cp) print colorize("WARN","\a!!! Unmerging it may be damaging to your system.\n") if "--pretend" not in myopts and "--ask" not in myopts: countdown(int(settings["EMERGE_WARNING_DELAY"]), colorize("UNMERGE_WARN", "Press Ctrl-C to Stop")) if "--quiet" not in myopts: - print "\n "+white(x) + print "\n "+bold(cp) else: - print white(x)+": ", + print bold(cp)+": ", for mytype in ["selected","protected","omitted"]: if "--quiet" not in myopts: portage.writemsg_stdout((mytype + ": ").rjust(14), noiselevel=-1) -- cgit v1.2.3-1-g7c22