extended find_packages to optionally return masked packages
authorgenone <genone@gentoo.org>
Fri, 23 Jan 2004 05:06:08 +0000 (05:06 -0000)
committergenone <genone@gentoo.org>
Fri, 23 Jan 2004 05:06:08 +0000 (05:06 -0000)
(needed for etcat -v to function properly)

svn path=/; revision=72

trunk/src/etcat/etcat
trunk/src/gentoolkit/gentoolkit.py

index 2ef5b9ffaad30a31c1cd41c87b7afdecfdac5b44..e4e03f73699c98d557213b5d8835333935d652b9 100755 (executable)
@@ -242,10 +242,12 @@ def changes(query, matches):
 # `-------------------------------------------------------'            
                
 def versions(query, matches):
+       # this function should also report masked packages
+       matches = gentoolkit.find_packages(query, masked=True)
        if not report_matches(query,matches):
                return
 
-               # sorting result list
+       # sorting result list
        matches = gentoolkit.sort_package_list(matches)
                
        # FIXME: old version printed result of regex search on name,
@@ -651,7 +653,7 @@ def main():
                                        print red("!!!"), "    "+p
                        else:
                                print red("!!!"), "Internal portage error, terminating"
-                               if len(e[0])):
+                               if len(e[0]):
                                        print red("!!!"), e[0]
                        sys.exit(2)
                function = globals()[action]
index 14241ee0f8ae7319789e556581f7f41f6cb0bb98..b300c39e43a7357723476abe5bf249ca3befc16f 100644 (file)
@@ -181,10 +181,12 @@ class Package:
 # Global helper functions
 #
 
-def find_packages(search_key):
+def find_packages(search_key, masked=False):
        """Returns a list of Package objects that matched the search key."""
-       # FIXME: this one failes if search_key contains version suffix
-       t=portage.portdb.match(search_key)
+       if masked:
+               t=portage.portdb.xmatch("match-all", search_key)
+       else:
+               t=portage.portdb.match(search_key)
        return [Package(x) for x in t]
 
 def find_best_match(search_key):