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