summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-07-20 02:03:51 +0000
committerZac Medico <zmedico@gentoo.org>2007-07-20 02:03:51 +0000
commit7216cfddf9e9dd6cdfd0182fa0d445248755d740 (patch)
treeb26308d6938a166ce0b70a4e832985cca2a3e58a /bin
parent87e21d4ef9a09cac43d6077bd69692ccb57d0fbd (diff)
downloadportage-7216cfddf9e9dd6cdfd0182fa0d445248755d740.tar.gz
portage-7216cfddf9e9dd6cdfd0182fa0d445248755d740.tar.bz2
portage-7216cfddf9e9dd6cdfd0182fa0d445248755d740.zip
For bug #151653, make --prune keep the highest version whenever possible (even when there is one with a higher counter installed). (trunk r7311:7313)
svn path=/main/branches/2.1.2/; revision=7314
Diffstat (limited to 'bin')
-rwxr-xr-xbin/emerge27
1 files changed, 25 insertions, 2 deletions
diff --git a/bin/emerge b/bin/emerge
index be9d2fb89..918745c12 100755
--- a/bin/emerge
+++ b/bin/emerge
@@ -4073,9 +4073,32 @@ def unmerge(settings, myopts, vartree, unmerge_action, unmerge_files,
if y not in pkgmap[mykey]["selected"]:
pkgmap[mykey]["selected"].append(y)
numselected=numselected+len(mymatch)
-
+ elif unmerge_action == "prune":
+ if len(mymatch) == 1:
+ continue
+ best_version = mymatch[0]
+ best_slot = vartree.getslot(best_version)
+ best_counter = vartree.dbapi.cpv_counter(best_version)
+ for mypkg in mymatch[1:]:
+ myslot = vartree.getslot(mypkg)
+ mycounter = vartree.dbapi.cpv_counter(mypkg)
+ if (myslot == best_slot and mycounter > best_counter) or \
+ mypkg == portage.best([mypkg, best_version]):
+ if myslot == best_slot:
+ if mycounter < best_counter:
+ # On slot collision, keep the one with the
+ # highest counter since it is the most
+ # recently installed.
+ continue
+ best_version = mypkg
+ best_slot = myslot
+ best_counter = mycounter
+ pkgmap[mykey]["protected"].append(best_version)
+ pkgmap[mykey]["selected"] = [mypkg for mypkg in mymatch \
+ if mypkg != best_version]
+ numselected = numselected + len(pkgmap[mykey]["selected"])
else:
- #unmerge_action in ["prune", clean"]
+ # unmerge_action == "clean"
slotmap={}
for mypkg in mymatch:
if unmerge_action=="clean":