Change equery uses command to display the best matching
authorfuzzyray <fuzzyray@gentoo.org>
Wed, 11 Apr 2007 02:12:08 +0000 (02:12 -0000)
committerfuzzyray <fuzzyray@gentoo.org>
Wed, 11 Apr 2007 02:12:08 +0000 (02:12 -0000)
uninstalled package version if an uninstalled package is specified.
Changed the meaning of -a to mean display all versions. (Bug #152325)

svn path=/; revision=386

trunk/ChangeLog
trunk/src/equery/equery
trunk/src/equery/equery.1

index 7c6204a810cbddde9e3b4fd5333fb56e96ac99de..13a5da80d8aef274eb17d5d6f740f50fe43df471 100644 (file)
@@ -1,3 +1,8 @@
+2007-04-10: Paul Varner <fuzzyray@gentoo.org>
+       * equery: Change equery uses to command to display the best matching
+       uninstalled package version if an uninstalled package is specified.
+       Changed the meaning of -a to mean display all versions. (Bug #152325)
+
 2007-04-01: Alec Warner <antarus@gentoo.org>
        * eread: Fix path and fully qualified paths (Bug #172969)
 
index 72bef594102ba44496b49c5cafb4d8083f3c2d2a..50f2caef72da4035b528fd7f78c945cc01de01c0 100755 (executable)
@@ -447,7 +447,7 @@ class CmdDisplayUSEs(Command):
        """Advanced report of a package's USE flags"""
        def __init__(self):
                self.default_opts = {
-                       "installedOnly" : True
+                       "allPackages" : False
                        }
        def parseArgs(self, args):
 
@@ -467,7 +467,7 @@ class CmdDisplayUSEs(Command):
                                need_help = 1
                                break
                        elif x in ["-a", "--all"]:
-                               opts["installedOnly"] = False
+                               opts["allPackages"] = True
                        else:
                                query = x
 
@@ -484,8 +484,13 @@ class CmdDisplayUSEs(Command):
                if not Config["piping"] and Config["verbosityLevel"] >= 3:
                        print_info(3, "[ Searching for packages matching " + pp.pkgquery(query) + "... ]")
                
-               if opts["installedOnly"]:
+               if not opts["allPackages"]:
                        matches = gentoolkit.find_installed_packages(query, True)
+                       if not matches:
+                               matches = gentoolkit.find_packages(query, False)
+                               if matches:
+                                       matches = gentoolkit.sort_package_list(matches)
+                                       matches = matches[-1:]
                else:
                        matches = gentoolkit.find_packages(query, True)
 
@@ -533,12 +538,10 @@ class CmdDisplayUSEs(Command):
                        print_info(3, "[        : Right column (I) - USE flags packages was installed with ]")
 
                # Iterate through matches, printing a report for each package
+               matches = gentoolkit.sort_package_list(matches)
                matches_found = 0
                for p in matches:
 
-                       if not p.is_installed() and opts["installedOnly"]:
-                               continue
-       
                        matches_found += 1
                        
                        bestver = p.get_cpv()
@@ -615,8 +618,6 @@ class CmdDisplayUSEs(Command):
                if Config["verbosityLevel"] >= 2:
                        if matches_found == 0:
                                s = ""
-                               if opts["installedOnly"]:
-                                       s = "installed "
                                die(3, "No " + s + "packages found for " + pp.pkgquery(query))
                                
                                        
@@ -629,7 +630,7 @@ class CmdDisplayUSEs(Command):
                           "  " + pp.command("uses") + pp.localoption(" <local-opts> ") + pp.pkgquery("pkgspec") + \
                           "\n" + \
                           pp.localoption("<local-opts>") + " is: \n" + \
-                          "  " + pp.localoption("-a, --all") + " - include non-installed packages\n"
+                          "  " + pp.localoption("-a, --all") + " - include all package versions\n"
 
 
 class CmdDisplayDepGraph(Command):
index 576519dc34e274570fd6f0220fff5df656dac9f8..fa8d65786c0f8ae5c12d4d090bfb74091fecb369 100644 (file)
@@ -246,7 +246,7 @@ display USE flags for pkgspec.
 The only possible value for <local\-opts>, if specified, is:
 .br 
 .B \-a, \-\-all
-include non\-installed packages
+include all package versions
 .PP 
 .B which pkgspec 
 print full path to ebuild for package pkgspec