summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfuzzyray <fuzzyray@gentoo.org>2006-12-12 20:15:58 +0000
committerfuzzyray <fuzzyray@gentoo.org>2006-12-12 20:15:58 +0000
commit2d1da63195665189c7974e936eb8de3cf5177684 (patch)
tree80b54ff1ed190b8c916c37abe02270feda2f53eb
parent32eed5d0a15c68cd431afd619ddbf1d9f5e006ef (diff)
downloadgentoolkit-2d1da63195665189c7974e936eb8de3cf5177684.tar.gz
Fix equery depends command to actually list all dependencies
svn path=/; revision=326
-rwxr-xr-xtrunk/src/equery/equery87
1 files changed, 52 insertions, 35 deletions
diff --git a/trunk/src/equery/equery b/trunk/src/equery/equery
index 4a76c9a..937dd06 100755
--- a/trunk/src/equery/equery
+++ b/trunk/src/equery/equery
@@ -1081,7 +1081,10 @@ class CmdListDepends(Command):
else:
packages = gentoolkit.find_all_packages()
+ packages = gentoolkit.sort_package_list(packages)
+
if not opts["onlyDirect"]:
+ # TODO Fix indirect dependency matching
print_info(4, "Caching indirect dependencies...")
depscache = {"":[]}
for pkg in packages:
@@ -1108,49 +1111,63 @@ class CmdListDepends(Command):
except KeyError, e:
# If the ebuild is not found...
continue
+ # Remove duplicate deps
+ deps = unique_array(deps)
isdep = 0
- for x in deps:
- cpvs=gentoolkit.split_package_name(x[2])
- cat_match=0
- ver_match=0
- name_match=0
- if not isdepend[0] or \
- cpvs[0] == isdepend[0]:
- cat_match=1
- if not isdepend[2] or \
- ( cpvs[2] == isdepend[2] and \
- (isdepend[3] or \
- isdepend[3] == "r0" or \
- cpvs[3] == isdepend[3])):
- ver_match=1
- if cpvs[1] == isdepend[1]:
- name_match=1
- if cat_match and ver_match and name_match:
- if not isdep:
- if x[1]:
- print pkg.get_cpv(),
- if Config["verbosityLevel"] >= 4:
- print " (" +string.join(x[1],"&")+ " ? " + x[0]+x[2] + ")"
+ for dependency in deps:
+ # TODO determine if dependency is enabled by USE flag
+ # Find all packages matching the dependency
+ Config["verbosityLevel"] = 4
+ for x in gentoolkit.find_packages(dependency[0]+dependency[2]):
+ cpvs=gentoolkit.split_package_name(x.get_cpv())
+ cat_match=0
+ name_match=0
+ ver_match=0
+ # Match Category
+ if not isdepend[0] or \
+ cpvs[0] == isdepend[0]:
+ cat_match=1
+ # Match Name
+ if cpvs[1] == isdepend[1]:
+ name_match=1
+ # Match Version
+ if not isdepend[2] or \
+ ( cpvs[2] == isdepend[2] and \
+ (isdepend[3] or \
+ isdepend[3] == "r0" or \
+ cpvs[3] == isdepend[3])):
+ ver_match=1
+ if cat_match and ver_match and name_match:
+ if not isdep:
+ if dependency[1]:
+ print pkg.get_cpv(),
+ if Config["verbosityLevel"] >= 4:
+ print "(" +string.join(dependency[1],"&")+ "? " + \
+ dependency[0]+dependency[2] + ")"
+ else:
+ print
else:
- print
- else:
- print pkg.get_cpv(),
- if Config["verbosityLevel"] >= 4:
- print " (" + x[0]+x[2] + ")"
+ print pkg.get_cpv(),
+ if Config["verbosityLevel"] >= 4:
+ print "(" + dependency[0]+dependency[2] + ")"
+ else:
+ print
+ isdep = 1
+ elif Config["verbosityLevel"] >= 4:
+ if dependency[1]:
+ print " "*len(pkg.get_cpv()) + \
+ " (" + string.join(dependency[1],"&")+ " ? " + \
+ dependency[0]+dependency[2] + ")"
else:
- print
- isdep = 1
- elif Config["verbosityLevel"] >= 4:
- if x[1]:
- print " "*len(pkg.get_cpv()) + " (" +string.join(x[1],"&")+ " ? " + x[0]+x[2] + ")"
- else:
- print " "*len(pkg.get_cpv()) + " (" + x[0]+x[2] + ")"
+ print " "*len(pkg.get_cpv()) + " (" + \
+ dependency[0]+dependency[2] + ")"
if isdep and not opts["onlyDirect"] :
subdeps(pkg.get_cpv(), " ")
def shortHelp(self):
- return pp.localoption("<local-opts> ") + pp.pkgquery("pkgspec") + " - list all direct dependencies matching " + pp.pkgquery("pkgspec")
+ return pp.localoption("<local-opts> ") + pp.pkgquery("pkgspec") + " - list all direct dependencies matching " + \
+ pp.pkgquery("pkgspec")
def longHelp(self):
return "List all direct dependencies matching a query pattern" + \