From cb6e7e4786c7c13ab9905fe76f44c943e716a41f Mon Sep 17 00:00:00 2001 From: genone Date: Fri, 23 Jan 2004 05:06:08 +0000 Subject: [PATCH] extended find_packages to optionally return masked packages (needed for etcat -v to function properly) svn path=/; revision=72 --- trunk/src/etcat/etcat | 6 ++++-- trunk/src/gentoolkit/gentoolkit.py | 8 +++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/trunk/src/etcat/etcat b/trunk/src/etcat/etcat index 2ef5b9f..e4e03f7 100755 --- a/trunk/src/etcat/etcat +++ b/trunk/src/etcat/etcat @@ -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] diff --git a/trunk/src/gentoolkit/gentoolkit.py b/trunk/src/gentoolkit/gentoolkit.py index 14241ee..b300c39 100644 --- a/trunk/src/gentoolkit/gentoolkit.py +++ b/trunk/src/gentoolkit/gentoolkit.py @@ -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): -- 2.26.2