display versions of other slots for new-slot installs (bug #213790)
authorZac Medico <zmedico@gentoo.org>
Fri, 28 Mar 2008 12:36:04 +0000 (12:36 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 28 Mar 2008 12:36:04 +0000 (12:36 -0000)
(trunk r9488)

svn path=/main/branches/2.1.2/; revision=9566

bin/emerge

index 1b28dc760e06185147bd257ec7f6a5ddf8a71d06..95ab24baf80aae2c9465a2cb674147ec3b90333d 100755 (executable)
@@ -3395,7 +3395,8 @@ 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):
                                        addl="  "+yellow("R")+fetch+"  "
@@ -3417,21 +3418,22 @@ class depgraph:
                                                portage.cpv_getkey(pkg_key):
                                                myinslotlist = None
                                        if myinslotlist:
-                                               myoldbest=portage.best(myinslotlist)
-                                               addl="   "+fetch
+                                               myoldbest = portage.best(myinslotlist)
+                                               addl = "   " + fetch
                                                if portage.pkgcmp(portage.pkgsplit(x[2]), portage.pkgsplit(myoldbest)) < 0:
                                                        # Downgrade in slot
-                                                       addl+=turquoise("U")+blue("D")
+                                                       addl += turquoise("U")+blue("D")
                                                        if ordered:
                                                                counters.downgrades += 1
                                                else:
                                                        # Update in slot
-                                                       addl+=turquoise("U")+" "
+                                                       addl += turquoise("U") + " "
                                                        if ordered:
                                                                counters.upgrades += 1
                                        else:
                                                # New slot, mark it new.
-                                               addl=" "+green("NS")+fetch+"  "
+                                               addl = " " + green("NS") + fetch + "  "
+                                               myoldbest = vardb.match(portage.cpv_getkey(pkg_key))
                                                if ordered:
                                                        counters.newslot += 1
 
@@ -3444,11 +3446,11 @@ class depgraph:
                                                                portdb.findname(pkg_key),
                                                                inst_matches[0], pkg_key))
                                else:
-                                       addl=" "+green("N")+" "+fetch+"  "
+                                       addl = " " + green("N") + " " + fetch + "  "
                                        if ordered:
                                                counters.new += 1
 
-                               verboseadd=""
+                               verboseadd = ""
                                
                                if True:
                                        # USE flag display
@@ -3465,7 +3467,7 @@ class depgraph:
                                        cur_use = pkg_use
                                        cur_use = [flag for flag in cur_use if flag in cur_iuse]
 
-                                       if myoldbest:
+                                       if myoldbest and myinslotlist:
                                                pkg = myoldbest
                                        else:
                                                pkg = x[2]
@@ -3612,11 +3614,11 @@ class depgraph:
                                                show_repos = True
                                                verboseadd += teal("[%s]" % repoadd)
 
-                               xs=portage.pkgsplit(x[2])
-                               if xs[2]=="r0":
-                                       xs[2]=""
+                               xs = list(portage.pkgsplit(x[2]))
+                               if xs[2] == "r0":
+                                       xs[2] = ""
                                else:
-                                       xs[2]="-"+xs[2]
+                                       xs[2] = "-" + xs[2]
 
                                mywidth = 130
                                if "COLUMNWIDTH" in self.settings:
@@ -3628,16 +3630,22 @@ class depgraph:
                                                        "!!! Unable to parse COLUMNWIDTH='%s'\n" % \
                                                        self.settings["COLUMNWIDTH"], noiselevel=-1)
                                                del e
-                               oldlp=mywidth-30
-                               newlp=oldlp-30
+                               oldlp = mywidth - 30
+                               newlp = oldlp - 30
 
                                indent = " " * depth
 
                                if myoldbest:
-                                       myoldbest=portage.pkgsplit(myoldbest)[1]+"-"+portage.pkgsplit(myoldbest)[2]
-                                       if myoldbest[-3:]=="-r0":
-                                               myoldbest=myoldbest[:-3]
-                                       myoldbest=blue("["+myoldbest+"]")
+                                       if myinslotlist:
+                                               myoldbest = [myoldbest]
+                                       for key in myoldbest:
+                                               pos = myoldbest.index(key)
+                                               key = portage.pkgsplit(key)[1] + "-" + portage.pkgsplit(key)[2]
+                                               if key[-3:] == "-r0":
+                                                       key = key[:-3]
+                                               myoldbest[pos] = key
+                                       myoldbest = blue("["+", ".join(myoldbest)+"]")
+                                       
 
                                pkg_cp = xs[0]
                                root_config = self.roots[myroot]