From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org)
	by finch.gentoo.org with esmtp (Exim 4.60)
	(envelope-from <gentoo-commits+bounces-327141-garchives=archives.gentoo.org@lists.gentoo.org>)
	id 1Q1MdG-0003qq-2y
	for garchives@archives.gentoo.org; Sun, 20 Mar 2011 17:41:38 +0000
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 9E0B31C035;
	Sun, 20 Mar 2011 17:41:30 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	by pigeon.gentoo.org (Postfix) with ESMTP id 5B4491C035
	for <gentoo-commits@lists.gentoo.org>; Sun, 20 Mar 2011 17:41:30 +0000 (UTC)
Received: from pelican.gentoo.org (unknown [66.219.59.40])
	(using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id E9D951B404E
	for <gentoo-commits@lists.gentoo.org>; Sun, 20 Mar 2011 17:41:29 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by pelican.gentoo.org (Postfix) with ESMTP id 2774A8006A
	for <gentoo-commits@lists.gentoo.org>; Sun, 20 Mar 2011 17:41:29 +0000 (UTC)
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" <zmedico@gentoo.org>
Message-ID: <de88819ff3240d31260a449d226037d1228a8d07.zmedico@gentoo>
Subject: [gentoo-commits] proj/portage:master commit in: bin/
X-VCS-Repository: proj/portage
X-VCS-Files: bin/portageq
X-VCS-Directories: bin/
X-VCS-Committer: zmedico
X-VCS-Committer-Name: Zac Medico
X-VCS-Revision: de88819ff3240d31260a449d226037d1228a8d07
Date: Sun, 20 Mar 2011 17:41:29 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: quoted-printable
X-Archives-Salt: 
X-Archives-Hash: 70b345f3a0b1fb2b4b0b63723b9a6c5b

commit:     de88819ff3240d31260a449d226037d1228a8d07
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 20 17:41:24 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Mar 20 17:41:24 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a=
=3Dcommit;h=3Dde88819f

portageq owners: list orphans via stderr

---
 bin/portageq |   26 +++++++++++++++++++++-----
 1 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/bin/portageq b/bin/portageq
index 2f254ca..069ece2 100755
--- a/bin/portageq
+++ b/bin/portageq
@@ -255,6 +255,8 @@ def owners(argv):
 		pass
=20
 	files =3D []
+	orphan_abs_paths =3D set()
+	orphan_basenames =3D set()
 	for f in argv[1:]:
 		f =3D portage.normalize_path(f)
 		is_basename =3D 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)
=20
 	owners =3D vardb._owners.get_owners(files)
=20
@@ -281,16 +285,28 @@ def owners(argv):
 		cpv =3D 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 =3D 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))
=20
 	writemsg_stdout(''.join(msg), noiselevel=3D-1)
=20
+	if orphan_abs_paths or orphan_basenames:
+		orphans =3D []
+		orphans.extend(orphan_abs_paths)
+		orphans.extend(orphan_basenames)
+		orphans.sort()
+		msg =3D []
+		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
=20
 owners.uses_root =3D True