Fix RepoConfigLoader so that it's possible to use PORTDIR_OVERLAY
authorZac Medico <zmedico@gentoo.org>
Tue, 28 Sep 2010 19:59:13 +0000 (12:59 -0700)
committerZac Medico <zmedico@gentoo.org>
Tue, 28 Sep 2010 19:59:13 +0000 (12:59 -0700)
to override the repo that PORTDIR refers to.

This fixes a regression which prevented a common repoman use case
from working in which the user has PORTDIR refering to a rsync
tree and has a separate cvs tree with the same repo_name as
PORTDIR. When the user tries to use repoman with the cvs tree,
the cvs repo is appended to PORTDIR_OVERLAY and we want it to
override the conflicting PORTDIR setting.

pym/portage/repository/config.py

index 0d44120820c27a9a4daa6064333320d06cff1860..e79cddb7012fd55f47d04f88986ab422f2e316f9 100644 (file)
@@ -134,11 +134,11 @@ class RepoConfigLoader(object):
                def add_overlays(portdir, portdir_overlay, prepos, ignored_map, ignored_location_map):
                        """Add overlays in PORTDIR_OVERLAY as repositories"""
                        overlays = []
-                       port_ov = [normalize_path(i) for i in shlex_split(portdir_overlay)]
-                       overlays.extend(port_ov)
                        if portdir:
                                portdir = normalize_path(portdir)
                                overlays.append(portdir)
+                       port_ov = [normalize_path(i) for i in shlex_split(portdir_overlay)]
+                       overlays.extend(port_ov)
                        if overlays:
                                #overlay priority is negative because we want them to be looked before any other repo
                                base_priority = -1
@@ -196,6 +196,8 @@ class RepoConfigLoader(object):
                prepos_order.sort(key=repo_priority, reverse=True)
 
                if portdir:
+                       if portdir not in location_map:
+                               portdir = prepos[ignored_location_map[portdir]].location
                        portdir_repo = prepos[location_map[portdir]]
                        portdir_sync = settings.get('SYNC', '')
                        #if SYNC variable is set and not overwritten by repos.conf