For bug #142473, add 4 color classes corresponding to combinations of world/merge...
authorZac Medico <zmedico@gentoo.org>
Mon, 25 Jun 2007 10:41:36 +0000 (10:41 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 25 Jun 2007 10:41:36 +0000 (10:41 -0000)
svn path=/main/branches/2.1.2/; revision=7032

bin/emerge
pym/output.py

index ed6e71998d571f68fbb043e16a07a05e0d95fbc2..9f75bc7ee1ff969b34face91a56dc0920eb0c00b 100755 (executable)
@@ -2484,6 +2484,7 @@ class depgraph:
                        else:
                                mydbapi = self.trees[myroot][self.pkg_tree_map[pkg_type]].dbapi
                                pkg_status = x[3]
+                               pkg_merge = ordered and pkg_status != "nomerge"
                                binary_package = True
                                if "ebuild" == pkg_type:
                                        if "merge" == x[3] or \
@@ -2657,7 +2658,7 @@ class depgraph:
                                if verbosity == 3:
                                        # size verbose
                                        mysize=0
-                                       if x[0] == "ebuild" and ordered and x[-1] != "nomerge":
+                                       if pkg_type == "ebuild" and pkg_merge:
                                                try:
                                                        myfilesdict = portdb.getfetchsizes(pkg_key,
                                                                useflags=self.useFlags[myroot][pkg_key],
@@ -2717,23 +2718,32 @@ class depgraph:
                                                myoldbest=myoldbest[:-3]
                                        myoldbest=blue("["+myoldbest+"]")
 
-                               if xs[0] in worldlist:
-                                       pkgprint = bold
-                               else:
-                                       def pkgprint(pkg):
-                                               return pkg
+                               pkg_cp = xs[0]
+                               pkg_world = pkg_cp in worldlist
+
+                               def pkgprint(pkg):
+                                       if pkg_merge:
+                                               if pkg_world:
+                                                       return colorize("PKG_MERGE_WORLD", pkg)
+                                               else:
+                                                       return colorize("PKG_MERGE", pkg)
+                                       else:
+                                               if pkg_world:
+                                                       return colorize("PKG_NOMERGE_WORLD", pkg)
+                                               else:
+                                                       return colorize("PKG_NOMERGE", pkg)
 
                                if x[1]!="/":
                                        if myoldbest:
                                                myoldbest +=" "
                                        if "--columns" in self.myopts:
                                                if "--quiet" in self.myopts:
-                                                       myprint=addl+" "+indent+darkgreen(pkgprint(xs[0]))
+                                                       myprint=addl+" "+indent+pkgprint(pkg_cp)
                                                        myprint=myprint+darkblue(" "+xs[1]+xs[2])+" "
                                                        myprint=myprint+myoldbest
                                                        myprint=myprint+darkgreen("to "+x[1])
                                                else:
-                                                       myprint="["+x[0]+" "+addl+"] "+indent+darkgreen(pkgprint(xs[0]))
+                                                       myprint="["+pkgprint(pkg_type)+" "+addl+"] "+indent+pkgprint(pkg_cp)
                                                        if (newlp-nc_len(myprint)) > 0:
                                                                myprint=myprint+(" "*(newlp-nc_len(myprint)))
                                                        myprint=myprint+"["+darkblue(xs[1]+xs[2])+"] "
@@ -2742,21 +2752,21 @@ class depgraph:
                                                        myprint=myprint+myoldbest
                                                        myprint=myprint+darkgreen("to "+x[1])+" "+verboseadd
                                        else:
-                                               if x[-1] == "nomerge" or not ordered:
-                                                       myprint = darkblue("[nomerge      ] ")
+                                               if not pkg_merge:
+                                                       myprint = "[%s      ] " % pkgprint("nomerge")
                                                else:
                                                        myprint = "[" + pkg_type + " " + addl + "] "
-                                               myprint += indent + darkgreen(pkgprint(pkg_key)) + " " + \
+                                               myprint += indent + pkgprint(pkg_key) + " " + \
                                                        myoldbest + darkgreen("to " + myroot) + " " + \
                                                        verboseadd
                                else:
                                        if "--columns" in self.myopts:
                                                if "--quiet" in self.myopts:
-                                                       myprint=addl+" "+indent+darkgreen(pkgprint(xs[0]))
+                                                       myprint=addl+" "+indent+pkgprint(pkg_cp)
                                                        myprint=myprint+" "+green(xs[1]+xs[2])+" "
                                                        myprint=myprint+myoldbest
                                                else:
-                                                       myprint="["+x[0]+" "+addl+"] "+indent+darkgreen(pkgprint(xs[0]))
+                                                       myprint="["+pkgprint(pkg_type)+" "+addl+"] "+indent+pkgprint(pkg_cp)
                                                        if (newlp-nc_len(myprint)) > 0:
                                                                myprint=myprint+(" "*(newlp-nc_len(myprint)))
                                                        myprint=myprint+green(" ["+xs[1]+xs[2]+"] ")
@@ -2764,10 +2774,10 @@ class depgraph:
                                                                myprint=myprint+(" "*(oldlp-nc_len(myprint)))
                                                        myprint=myprint+myoldbest+"  "+verboseadd
                                        else:
-                                               if x[-1] == "nomerge" or not ordered:
-                                                       myprint=darkblue("[nomerge      ] "+indent+pkgprint(x[2])+" "+myoldbest+" ")+verboseadd
+                                               if not pkg_merge:
+                                                       myprint="["+pkgprint("nomerge")+"      ] "+indent+pkgprint(pkg_key)+" "+myoldbest+" "+verboseadd
                                                else:
-                                                       myprint="["+x[0]+" "+addl+"] "+indent+darkgreen(pkgprint(x[2]))+" "+myoldbest+" "+verboseadd
+                                                       myprint="["+pkgprint(pkg_type)+" "+addl+"] "+indent+pkgprint(pkg_key)+" "+myoldbest+" "+verboseadd
                                p.append(myprint)
 
                        mysplit = portage.pkgsplit(x[2])
index ab22275743495e4a73ec158314a7dd41db87ecdf..ca386a9f5a4f9b561c6aad414da40c22f1073958 100644 (file)
@@ -129,6 +129,10 @@ codes["INFORM"] = codes["darkgreen"]
 codes["UNMERGE_WARN"] = codes["red"]
 codes["SECURITY_WARN"] = codes["red"]
 codes["MERGE_LIST_PROGRESS"] = codes["yellow"]
+codes["PKG_MERGE"]           = codes["darkgreen"]
+codes["PKG_MERGE_WORLD"]     = codes["green"]
+codes["PKG_NOMERGE"]         = codes["darkblue"]
+codes["PKG_NOMERGE_WORLD"]   = codes["blue"]
 
 def parse_color_map():
        myfile = COLOR_MAP_FILE