summaryrefslogtreecommitdiffstats
path: root/bin/portageq
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-12-21 11:53:43 +0000
committerZac Medico <zmedico@gentoo.org>2007-12-21 11:53:43 +0000
commit1bf28a9631fbf18bab6ff80d6986a858bfb62d6d (patch)
treee7fa325f277a6150a2f6d17d04c47dbc630b5ca6 /bin/portageq
parent52f24ac493579463399f836f464c530495f1650f (diff)
downloadportage-1bf28a9631fbf18bab6ff80d6986a858bfb62d6d.tar.gz
portage-1bf28a9631fbf18bab6ff80d6986a858bfb62d6d.tar.bz2
portage-1bf28a9631fbf18bab6ff80d6986a858bfb62d6d.zip
Implement a `portageq contents <root> <category/package>` command
that lists all the files that are installed for a given package, with one file listed on each line. (trunk r9035) svn path=/main/branches/2.1.2/; revision=9037
Diffstat (limited to 'bin/portageq')
-rwxr-xr-xbin/portageq25
1 files changed, 25 insertions, 0 deletions
diff --git a/bin/portageq b/bin/portageq
index 8ffac0b75..fb5decc45 100755
--- a/bin/portageq
+++ b/bin/portageq
@@ -124,6 +124,31 @@ def metadata(argv):
metadata.uses_root = True
+def contents(argv):
+ """<root> <category/package>
+ List the files that are installed for a given package, with
+ one file listed on each line. All file names will begin with
+ <root>.
+ """
+ if len(argv) != 2:
+ print "ERROR: expected 2 parameters, got %d!" % len(argv)
+ return 2
+
+ root, cpv = argv
+ vartree = portage.db[root]["vartree"]
+ if not vartree.dbapi.cpv_exists(cpv):
+ sys.stderr.write("Package not found: '%s'\n" % cpv)
+ return 1
+ cat, pkg = portage.catsplit(cpv)
+ db = portage.dblink(cat, pkg, root, vartree.settings,
+ treetype="vartree", vartree=vartree)
+ file_list = db.getcontents().keys()
+ file_list.sort()
+ for f in file_list:
+ sys.stdout.write("%s\n" % f)
+ sys.stdout.flush()
+contents.uses_root = True
+
def owners(argv):
"""<root> [<filename>]+
Given a list of files, print the packages that own the files and which