summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-03-20 10:41:24 -0700
committerZac Medico <zmedico@gentoo.org>2011-03-26 12:20:13 -0700
commit61cdc29e485fd55509f21ceb0b9fefdacd664849 (patch)
tree7961fabb27ffa4f3b2ca34b544e48da8237df751 /bin
parentbcb6edaa19e18bc64b4517d60054bcd0420d0ea4 (diff)
downloadportage-61cdc29e485fd55509f21ceb0b9fefdacd664849.tar.gz
portage-61cdc29e485fd55509f21ceb0b9fefdacd664849.tar.bz2
portage-61cdc29e485fd55509f21ceb0b9fefdacd664849.zip
portageq owners: list orphans via stderr
Diffstat (limited to 'bin')
-rwxr-xr-xbin/portageq26
1 files changed, 21 insertions, 5 deletions
diff --git a/bin/portageq b/bin/portageq
index 2f254ca81..069ece238 100755
--- a/bin/portageq
+++ b/bin/portageq
@@ -255,6 +255,8 @@ def owners(argv):
pass
files = []
+ orphan_abs_paths = set()
+ orphan_basenames = set()
for f in argv[1:]:
f = portage.normalize_path(f)
is_basename = os.sep not in f
@@ -271,8 +273,10 @@ def owners(argv):
return 2
if is_basename:
files.append(f)
+ orphan_basenames.add(f)
else:
files.append(f[len(root)-1:])
+ orphan_abs_paths.add(f)
owners = vardb._owners.get_owners(files)
@@ -281,16 +285,28 @@ def owners(argv):
cpv = pkg.mycpv
msg.append("%s\n" % cpv)
for f in sorted(owned_files):
- msg.append("\t%s\n" % \
- os.path.join(root, f.lstrip(os.path.sep)))
+ f_abs = os.path.join(root, f.lstrip(os.path.sep))
+ msg.append("\t%s\n" % (f_abs,))
+ orphan_abs_paths.discard(f_abs)
+ if orphan_basenames:
+ orphan_basenames.discard(os.path.basename(f_abs))
writemsg_stdout(''.join(msg), noiselevel=-1)
+ if orphan_abs_paths or orphan_basenames:
+ orphans = []
+ orphans.extend(orphan_abs_paths)
+ orphans.extend(orphan_basenames)
+ orphans.sort()
+ msg = []
+ msg.append("None of the installed packages claim these files:\n")
+ for f in orphans:
+ msg.append("\t%s\n" % (f,))
+ sys.stderr.write("".join(msg))
+ sys.stderr.flush()
+
if owners:
return 0
-
- sys.stderr.write("None of the installed packages claim the file(s).\n")
- sys.stderr.flush()
return 1
owners.uses_root = True