From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-600618-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id 665FA1381F3
	for <garchives@archives.gentoo.org>; Tue, 18 Jun 2013 17:47:29 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id C4479E092C;
	Tue, 18 Jun 2013 17:47:23 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 4C4D8E092C
	for <gentoo-commits@lists.gentoo.org>; Tue, 18 Jun 2013 17:47:23 +0000 (UTC)
Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163])
	(using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 211BB33DFE8
	for <gentoo-commits@lists.gentoo.org>; Tue, 18 Jun 2013 17:47:22 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by hornbill.gentoo.org (Postfix) with ESMTP id BD0C9E468F
	for <gentoo-commits@lists.gentoo.org>; Tue, 18 Jun 2013 17:47:20 +0000 (UTC)
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" <zmedico@gentoo.org>
Message-ID: <1371577619.a2a41572a696bd280a5004794f9067b31dde6b48.zmedico@gentoo>
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/repository/
X-VCS-Repository: proj/portage
X-VCS-Files: pym/portage/repository/config.py
X-VCS-Directories: pym/portage/repository/
X-VCS-Committer: zmedico
X-VCS-Committer-Name: Zac Medico
X-VCS-Revision: a2a41572a696bd280a5004794f9067b31dde6b48
X-VCS-Branch: master
Date: Tue, 18 Jun 2013 17:47:20 +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
X-Archives-Salt: f19ac687-d135-4fdc-b9f5-3a9c2ddee4bf
X-Archives-Hash: 22dda039cd38f940e525a9e7378d0c19

commit:     a2a41572a696bd280a5004794f9067b31dde6b48
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 18 17:46:59 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Jun 18 17:46:59 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a2a41572

RepoConfigLoader: fix main-repo priority default

This ensures that the main-repo default priority is set to -1000
in all cases where it's appropriate.

---
 pym/portage/repository/config.py | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py
index a63bc9c..56a9ea4 100644
--- a/pym/portage/repository/config.py
+++ b/pym/portage/repository/config.py
@@ -355,8 +355,10 @@ class RepoConfigLoader(object):
 	def _add_repositories(portdir, portdir_overlay, prepos, ignored_map, ignored_location_map):
 		"""Add overlays in PORTDIR_OVERLAY as repositories"""
 		overlays = []
+		portdir_orig = None
 		if portdir:
 			portdir = normalize_path(portdir)
+			portdir_orig = portdir
 			overlays.append(portdir)
 		try:
 			port_ov = [normalize_path(i) for i in shlex_split(portdir_overlay)]
@@ -412,11 +414,15 @@ class RepoConfigLoader(object):
 							if old_location == portdir:
 								portdir = repo.user_location
 
-					if ov == portdir and portdir not in port_ov:
-						repo.priority = -1000
-					elif repo.priority is None:
-						repo.priority = base_priority
-						base_priority += 1
+					if repo.priority is None:
+						if base_priority == 0 and ov == portdir_orig:
+							# If it's the original PORTDIR setting and it's not
+							# in PORTDIR_OVERLAY, then it will be assigned a
+							# special priority setting later.
+							pass
+						else:
+							repo.priority = base_priority
+							base_priority += 1
 
 					prepos[repo.name] = repo
 				else:
@@ -556,18 +562,21 @@ class RepoConfigLoader(object):
 		prepos_order = [repo.name for (key, repo) in prepos_order
 			if repo.name == key and repo.location is not None]
 
-		if prepos['DEFAULT'].main_repo is None or \
-			prepos['DEFAULT'].main_repo not in prepos:
+		main_repo = prepos['DEFAULT'].main_repo
+		if main_repo is None or main_repo not in prepos:
 			#setting main_repo if it was not set in repos.conf
-			if portdir in location_map:
-				prepos['DEFAULT'].main_repo = location_map[portdir]
-			elif portdir in ignored_location_map:
-				prepos['DEFAULT'].main_repo = ignored_location_map[portdir]
+			main_repo = location_map.get(portdir)
+			if main_repo is not None:
+				prepos['DEFAULT'].main_repo = main_repo
 			else:
 				prepos['DEFAULT'].main_repo = None
 				if not portage._sync_disabled_warnings:
 					writemsg(_("!!! main-repo not set in DEFAULT and PORTDIR is empty.\n"), noiselevel=-1)
 
+		if main_repo is not None and prepos[main_repo].priority is None:
+			# This happens if main-repo has been set in repos.conf.
+			prepos[main_repo].priority = -1000
+
 		self.prepos = prepos
 		self.prepos_order = prepos_order
 		self.ignored_repos = ignored_repos