From 63afcf175f3f6e15474dffaf77308c475d98141d Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 21 Dec 2007 11:36:08 +0000 Subject: Implement a `portageq contents ` command that lists all the files that are installed for a given package, with one file listed on each line. svn path=/main/trunk/; revision=9035 --- bin/portageq | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'bin') diff --git a/bin/portageq b/bin/portageq index ea97c3e73..a29669a24 100755 --- a/bin/portageq +++ b/bin/portageq @@ -123,6 +123,31 @@ def metadata(argv): metadata.uses_root = True +def contents(argv): + """ + List the files that are installed for a given package, with + one file listed on each line. All file names will begin with + . + """ + 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): """ []+ Given a list of files, print the packages that own the files and which -- cgit v1.2.3-1-g7c22