Add USE display when --verbose is not used. Only flags that are enabled,
authorJason Stubbs <jstubbs@gentoo.org>
Sun, 18 Dec 2005 16:41:37 +0000 (16:41 -0000)
committerJason Stubbs <jstubbs@gentoo.org>
Sun, 18 Dec 2005 16:41:37 +0000 (16:41 -0000)
have changed or are new but disabled are shown.

svn path=/main/trunk/; revision=2400

bin/emerge

index e668df5bb432287a50706050bdae3acf0606e139..d9f18b238d38bea2bc34c7a51998ffc44e270ba2 100755 (executable)
@@ -1470,18 +1470,14 @@ class depgraph:
                totalsize=0
 
                if "--verbose" in myopts:
-                       # Original USE display
+                       # Full USE display
                        def create_use_string(name, cur_iuse, cur_use, old_iuse, old_use, is_new):
-                               if name != "USE":
-                                       return ""
-                               usestrs=[]
+                               usestrs = []
                                for flag in cur_iuse:
-                                       if flag in portage.settings.usemask:
-                                               continue
                                        suffix = ""
                                        if flag in cur_use:
                                                color = red
-                                               prefix = "+"
+                                               prefix = ""
                                        else:
                                                color = blue
                                                prefix = "-"
@@ -1491,12 +1487,35 @@ class depgraph:
                                        usestrs.append(color(prefix+flag)+suffix)
                                ret = " ".join(usestrs)
                                if ret:
-                                       ret += " "
+                                       ret = '%s="%s" ' % (name, ret)
                                return ret
                else:
-                       # New compact USE display
+                       # Changed-since-previous USE display
                        def create_use_string(name, cur_iuse, cur_use, old_iuse, old_use, is_new):
-                               return ""
+                               enabled = []
+                               disabled = []
+                               for flag in cur_iuse:
+                                       if flag in cur_use:
+                                               if flag in old_use:
+                                                       enabled.append(red(flag))
+                                               else:
+                                                       enabled.append(green(flag)+"*")
+                                       else:
+                                               if flag in old_use:
+                                                       disabled.append(green("-"+flag)+"*")
+                                               elif is_new or flag not in old_iuse:
+                                                       disabled.append(blue("-"+flag))
+                               enabled = " ".join(enabled)
+                               disabled = " ".join(disabled)
+                               if enabled and disabled:
+                                       ret = enabled + " " + disabled
+                               elif enabled:
+                                       ret = enabled
+                               else:
+                                       ret = disabled
+                               if ret:
+                                       ret = '%s="%s" ' % (name, ret)
+                               return ret
 
                if "--verbose" in myopts:
                        overlays = string.split(portage.settings['PORTDIR_OVERLAY'])
@@ -1598,8 +1617,10 @@ class depgraph:
                                                cur_iuse = []
 
                                        cur_iuse = portage.unique_array(cur_iuse)
+                                       cur_iuse = [flag for flag in cur_iuse if flag not in portage.settings.usemask]
                                        cur_iuse.sort()
                                        cur_use = self.applied_useflags[x[2]]
+                                       cur_use = [flag for flag in cur_use if flag in cur_iuse]
 
                                        if myoldbest:
                                                pkg = myoldbest
@@ -1615,6 +1636,8 @@ class depgraph:
                                                old_iuse = []
                                                old_use = []
                                                is_new = True
+                                       old_iuse = [flag for flag in old_iuse if flag not in portage.settings.usemask]
+                                       old_use = [flag for flag in old_use if flag in old_iuse]
 
                                        use_expand = portage.settings["USE_EXPAND"].lower().split()
                                        use_expand.sort()