From 34771ed5f8e4df5d744afc59df22c7dd0e91a1f1 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 30 Mar 2008 04:26:32 +0000 Subject: [PATCH] * Make code a bit less prone to potentially hidden TypeError like bugs. * Bug #211365 - Use catpkgsplit() instead of pkgsplit() for a cpv. (trunk r9614:9616) svn path=/main/branches/2.1.2/; revision=9617 --- bin/emerge | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/bin/emerge b/bin/emerge index e139e2a23..477bff713 100755 --- a/bin/emerge +++ b/bin/emerge @@ -3347,7 +3347,7 @@ class depgraph: #we need to use "--emptrytree" testing here rather than "empty" param testing because "empty" #param is used for -u, where you still *do* want to see when something is being upgraded. - myoldbest = "" + myoldbest = [] myinslotlist = None installed_versions = vardb.match(portage.cpv_getkey(pkg_key)) if vardb.cpv_exists(pkg_key): @@ -3370,9 +3370,10 @@ class depgraph: portage.cpv_getkey(pkg_key): myinslotlist = None if myinslotlist: - myoldbest = portage.best(myinslotlist) + myoldbest = myinslotlist[:] addl = " " + fetch - if portage.pkgcmp(portage.pkgsplit(x[2]), portage.pkgsplit(myoldbest)) < 0: + if not portage_dep.cpvequal(pkg_key, + portage.best([pkg_key] + myoldbest)): # Downgrade in slot addl += turquoise("U")+blue("D") if ordered: @@ -3420,7 +3421,7 @@ class depgraph: cur_use = [flag for flag in cur_use if flag in cur_iuse] if myoldbest and myinslotlist: - pkg = myoldbest + pkg = myoldbest[0] else: pkg = x[2] if self.trees[x[1]]["vartree"].dbapi.cpv_exists(pkg): @@ -3587,16 +3588,17 @@ class depgraph: indent = " " * depth - if myoldbest: - if myinslotlist: - myoldbest = [myoldbest] + # Convert myoldbest from a list to a string. + if not myoldbest: + myoldbest = "" + else: for pos, key in enumerate(myoldbest): - key = portage.pkgsplit(key)[1] + "-" + portage.pkgsplit(key)[2] + key = portage.catpkgsplit(key)[2] + \ + "-" + portage.catpkgsplit(key)[3] if key[-3:] == "-r0": key = key[:-3] myoldbest[pos] = key myoldbest = blue("["+", ".join(myoldbest)+"]") - pkg_cp = xs[0] root_config = self.roots[myroot] -- 2.26.2