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-392478-garchives=archives.gentoo.org@lists.gentoo.org>)
	id 1RF8qQ-0002Jl-5m
	for garchives@archives.gentoo.org; Sat, 15 Oct 2011 18:20:26 +0000
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 0323421C1FC;
	Sat, 15 Oct 2011 18:20:18 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	by pigeon.gentoo.org (Postfix) with ESMTP id CAEAE21C1FC
	for <gentoo-commits@lists.gentoo.org>; Sat, 15 Oct 2011 18:20:18 +0000 (UTC)
Received: from pelican.gentoo.org (unknown [66.219.59.40])
	(using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 4C05E1B4009
	for <gentoo-commits@lists.gentoo.org>; Sat, 15 Oct 2011 18:20:18 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by pelican.gentoo.org (Postfix) with ESMTP id 5101080042
	for <gentoo-commits@lists.gentoo.org>; Sat, 15 Oct 2011 18:20:17 +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: <c6cd30c6165d39bf3cd040b3dc29bfec4323bbf2.zmedico@gentoo>
Subject: [gentoo-commits] proj/portage:master commit in: bin/
X-VCS-Repository: proj/portage
X-VCS-Files: bin/repoman
X-VCS-Directories: bin/
X-VCS-Committer: zmedico
X-VCS-Committer-Name: Zac Medico
X-VCS-Revision: c6cd30c6165d39bf3cd040b3dc29bfec4323bbf2
Date: Sat, 15 Oct 2011 18:20:17 +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: 0ff489eb4fcae1e6b061de9104ac80b2

commit:     c6cd30c6165d39bf3cd040b3dc29bfec4323bbf2
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 15 18:20:06 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Oct 15 18:20:06 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a=
=3Dcommit;h=3Dc6cd30c6

repoman: validate categories for vcs files

---
 bin/repoman |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/bin/repoman b/bin/repoman
index ebe06f8..2a6d782 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -682,7 +682,7 @@ for path in set([portdir, repodir]):
 		os.path.join(path, 'profiles', 'categories')))
 repoman_settings.categories =3D tuple(sorted(
 	portage.util.stack_lists([categories], incremental=3D1)))
-del categories
+categories =3D frozenset(repoman_settings.categories)
=20
 portdb.settings =3D repoman_settings
 root_config =3D RootConfig(repoman_settings, trees[root], None)
@@ -870,7 +870,7 @@ scanlist=3D[]
 if repolevel=3D=3D2:
 	#we are inside a category directory
 	catdir=3Dreposplit[-1]
-	if catdir not in repoman_settings.categories:
+	if catdir not in categories:
 		caterror(catdir)
 	mydirlist=3Dos.listdir(startdir)
 	for x in mydirlist:
@@ -880,7 +880,7 @@ if repolevel=3D=3D2:
 			scanlist.append(catdir+"/"+x)
 	repo_subdir =3D catdir + os.sep
 elif repolevel=3D=3D1:
-	for x in repoman_settings.categories:
+	for x in categories:
 		if not os.path.isdir(startdir+"/"+x):
 			continue
 		for y in os.listdir(startdir+"/"+x):
@@ -891,7 +891,7 @@ elif repolevel=3D=3D1:
 	repo_subdir =3D ""
 elif repolevel=3D=3D3:
 	catdir =3D reposplit[-2]
-	if catdir not in repoman_settings.categories:
+	if catdir not in categories:
 		caterror(catdir)
 	scanlist.append(catdir+"/"+reposplit[-1])
 	repo_subdir =3D scanlist[-1] + os.sep
@@ -916,23 +916,25 @@ def vcs_files_to_cps(vcs_file_iter):
 	modified_cps =3D []
=20
 	if repolevel =3D=3D 3:
-		if next(vcs_file_iter, None) is not None:
+		if reposplit[-2] in categories and \
+			next(vcs_file_iter, None) is not None:
 			modified_cps.append("/".join(reposplit[-2:]))
=20
 	elif repolevel =3D=3D 2:
 		category =3D reposplit[-1]
-		for filename in vcs_file_iter:
-			f_split =3D filename.split(os.sep)
-			# ['.', pn,...]
-			if len(f_split) > 2:
-				modified_cps.append(category + "/" + f_split[1])
+		if category in categories:
+			for filename in vcs_file_iter:
+				f_split =3D filename.split(os.sep)
+				# ['.', pn,...]
+				if len(f_split) > 2:
+					modified_cps.append(category + "/" + f_split[1])
=20
 	else:
 		# repolevel =3D=3D 1
 		for filename in vcs_file_iter:
 			f_split =3D filename.split(os.sep)
 			# ['.', category, pn,...]
-			if len(f_split) > 3:
+			if len(f_split) > 3 and f_split[1] in categories:
 				modified_cps.append("/".join(f_split[1:3]))
=20
 	return frozenset(modified_cps)