summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorliquidx <liquidx@gentoo.org>2003-04-24 23:46:31 +0000
committerliquidx <liquidx@gentoo.org>2003-04-24 23:46:31 +0000
commite7b9052d731a7c0c11d7eb2da6e450148b9756fe (patch)
treeb614bca6e065a993e3f2fd9d00736a39ccd68b42
parent2f4ffdb741e28ceb2b7dc5610b6b72d64f17cceb (diff)
downloadgentoolkit-e7b9052d731a7c0c11d7eb2da6e450148b9756fe.tar.gz
fix uses() to return stuff even if not installed
svn path=/; revision=20
-rwxr-xr-xtrunk/src/etcat/etcat19
1 files changed, 10 insertions, 9 deletions
diff --git a/trunk/src/etcat/etcat b/trunk/src/etcat/etcat
index 78185bc..10fd419 100755
--- a/trunk/src/etcat/etcat
+++ b/trunk/src/etcat/etcat
@@ -210,10 +210,8 @@ def pkgcmp(a,b):
def search(search_key):
matches = []
- cache = portage.db["/"]["vartree"]
for package in portage.portdb.cp_all():
package_parts=package.split("/")
- masked=0
if re.search(search_key.lower(), package_parts[1].lower()):
matches.append(package)
return matches
@@ -533,15 +531,16 @@ def uses(query):
print "[ : (I) Col 2 - Installed With USE flags ]"
for p in matches:
- curver = portage.db["/"]["vartree"].dep_bestmatch(p)
-
- if curver:
+ curver = portage.db["/"]["porttree"].dbapi.match(p)
+ bestver = portage.best(curver)
+ if bestver:
try:
- iuse = portage.db["/"]["porttree"].dbapi.aux_get(curver,["IUSE"])
+ iuse = portage.db["/"]["porttree"].dbapi.aux_get(bestver,["IUSE"])
except KeyError:
print "[ Error Occured. Ebuild not found for :", white(p), "]"
+ continue
else:
- print "[ No USE flags found for :", white(p), "]"
+ print "[ * No USE flags found for :", white(p), "]"
continue
if iuse: usevar = iuse[0].split()
@@ -553,8 +552,10 @@ def uses(query):
if installed:
try:
used = open(installed[-1] + "/USE").read().split()
- except:
+ except IOError:
used = []
+ else:
+ used = []
# store (inuse, inused, flag, desc)
output = []
@@ -578,7 +579,7 @@ def uses(query):
# pretty print
if output:
print
- print white(" U I ") + "[ Found these USE variables in : " + white(p) + " ]"
+ print white(" U I ") + "[ Found these USE variables in : " + white(bestver) + " ]"
maxflag_len = 0
for inuse, inused, u, desc in output:
if len(u) > maxflag_len: