summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-08-08 22:03:54 +0000
committerZac Medico <zmedico@gentoo.org>2009-08-08 22:03:54 +0000
commit0ef86aac2383f8dbb5edd379d1aa08e3dfca2aae (patch)
treedc2c2d9ce27b33b66435649770f30088bda74a47
parentf1d704b0d73ca9b42bc90c0cb078295b6a8d99b1 (diff)
downloadportage-0ef86aac2383f8dbb5edd379d1aa08e3dfca2aae.tar.gz
portage-0ef86aac2383f8dbb5edd379d1aa08e3dfca2aae.tar.bz2
portage-0ef86aac2383f8dbb5edd379d1aa08e3dfca2aae.zip
Use writemsg_stdout() for safe unicode output.
svn path=/main/trunk/; revision=13953
-rwxr-xr-xbin/portageq29
1 files changed, 15 insertions, 14 deletions
diff --git a/bin/portageq b/bin/portageq
index 941c5b807..e18760ce8 100755
--- a/bin/portageq
+++ b/bin/portageq
@@ -143,8 +143,7 @@ def metadata(argv):
try:
values = trees[root][type_map[pkgtype]].dbapi.aux_get(
pkgspec, metakeys)
- for value in values:
- print value
+ writemsg_stdout(''.join('%s\n' % x for x in values), noiselevel=-1)
except KeyError:
print >> sys.stderr, "Package not found: '%s'" % pkgspec
sys.exit(1)
@@ -169,11 +168,8 @@ def contents(argv):
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()
+ writemsg_stdout(''.join('%s\n' % x for x in sorted(db.getcontents())),
+ noiselevel=-1)
contents.uses_root = True
def owners(argv):
@@ -222,14 +218,17 @@ def owners(argv):
owners = vardb._owners.get_owners(files)
+ msg = []
for pkg, owned_files in owners.iteritems():
cpv = pkg.mycpv
- sys.stdout.write("%s\n" % cpv)
+ msg.append("%s\n" % cpv)
for f in sorted(owned_files):
- sys.stdout.write("\t%s\n" % \
+ msg.append("\t%s\n" % \
os.path.join(root, f.lstrip(os.path.sep)))
+
+ writemsg_stdout(''.join(msg), noiselevel=-1)
+
if owners:
- sys.stdout.flush()
return 0
sys.stderr.write("None of the installed packages claim the file(s).\n")
@@ -529,12 +528,14 @@ def list_preserved_libs(argv):
sys.exit(2)
mylibs = portage.db[argv[0]]["vartree"].dbapi.plib_registry.getPreservedLibs()
rValue = 0
- for cpv in mylibs:
- print cpv,
+ msg = []
+ for cpv in sorted(mylibs):
+ msg.append(cpv)
for path in mylibs[cpv]:
- print path,
+ msg.append(' ' + path)
rValue = 1
- print
+ msg.append('\n')
+ writemsg_stdout(''.join(msg), noiselevel=-1)
return rValue
list_preserved_libs.uses_root = True