commit:     f91508ed8323ec4022989b377cc6e4176d273413
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 24 18:12:41 2019 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Apr 24 18:17:11 2019 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=f91508ed

RepoConfigLoader: fix default_portdir value (bug 478544)

Fixes: a859556ffaa4 ("Update /usr/portage references (bug 378603)")
Bug: https://bugs.gentoo.org/478544
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 lib/portage/repository/config.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/portage/repository/config.py b/lib/portage/repository/config.py
index 67a6897f7..2b2b1e151 100644
--- a/lib/portage/repository/config.py
+++ b/lib/portage/repository/config.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2018 Gentoo Foundation
+# Copyright 2010-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 from __future__ import unicode_literals
@@ -733,8 +733,11 @@ class RepoConfigLoader(object):
                        location_map.clear()
                        treemap.clear()
 
-               default_portdir = os.path.join(os.sep,
-                       settings['EPREFIX'].lstrip(os.sep), 'usr', 'portage')
+               repo_locations = frozenset(repo.location for repo in 
prepos.values())
+               for repo_location in ('var/db/repos/gentoo', 'usr/portage'):
+                       default_portdir = os.path.join(os.sep, 
settings['EPREFIX'].lstrip(os.sep), repo_location)
+                       if default_portdir in repo_locations:
+                               break
 
                # If PORTDIR_OVERLAY contains a repo with the same repo_name as
                # PORTDIR, then PORTDIR is overridden.

Reply via email to