fix for bug 41300
authorgenone <genone@gentoo.org>
Mon, 16 Feb 2004 14:08:03 +0000 (14:08 -0000)
committergenone <genone@gentoo.org>
Mon, 16 Feb 2004 14:08:03 +0000 (14:08 -0000)
svn path=/; revision=84

trunk/src/equery/equery

index 104b68af1155bc2ae1c82e49f326fc8c0875c544..c534a4fac862924b22afa1f1a54f5ec19d57e1e9 100755 (executable)
@@ -267,6 +267,10 @@ class CmdDisplayUSEs(Command):
                
                matches = gentoolkit.find_packages(query)
 
+               if not matches:
+                       print yellow("No matching packages found for \"%s\"" % query)
+                       return
+
                useflags = gentoolkit.settings["USE"].split()   
                usedesc = {}
                uselocaldesc = {}
@@ -307,9 +311,14 @@ class CmdDisplayUSEs(Command):
                print "[ Legend    : (U) Col 1 - Current USE flags        ]"
                print "[           : (I) Col 2 - Installed With USE flags ]"
 
+               if filter(gentoolkit.Package.is_installed, matches):
+                       only_installed = True
+               else:
+                       only_installed = False
+
                # Iterate through matches, printing a report for each package
                for p in matches:
-                       if not p.is_installed():
+                       if not p.is_installed() and only_installed:
                                continue
        
                        bestver = p.get_cpv()
@@ -321,7 +330,11 @@ class CmdDisplayUSEs(Command):
                                usevar = []
 
                        inuse = []
-                       used = p.get_use_vars().split()
+                       if p.is_installed():
+                               used = p.get_use_vars().split()
+                       else:
+                               # cosmetic issue here as noninstalled packages don't have "used" flags
+                               used = useflags
 
                        # store (inuse, inused, flag, desc)
                        output = []