From cf92c061d62ab13205a59d082d2e4ffd918c1c39 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 2 Jun 2011 17:36:33 -0700 Subject: repository/config: PORTDIR/overlay priority tweak This ensures compatibility with previous portage versions for cases in which the user has added PORTDIR to PORTDIR_OVERLAY as a means to modify its priority relative to overlays when selecting ebuilds. --- pym/portage/package/ebuild/config.py | 4 ++-- pym/portage/repository/config.py | 28 ++++++++++++++++++---------- 2 files changed, 20 insertions(+), 12 deletions(-) (limited to 'pym') diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py index d1842f134..54ca8b33f 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -486,8 +486,8 @@ class config(object): # repoman controls PORTDIR_OVERLAY via the environment, so no # special cases are needed here. portdir_overlay = list(self.repositories.repoUserLocationList()) - if self["PORTDIR"] in portdir_overlay: - portdir_overlay.remove(self["PORTDIR"]) + if portdir_overlay and portdir_overlay[0] == self["PORTDIR"]: + portdir_overlay = portdir_overlay[1:] new_ov = [] if portdir_overlay: diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py index eb44b17f8..c5b779051 100644 --- a/pym/portage/repository/config.py +++ b/pym/portage/repository/config.py @@ -242,21 +242,25 @@ class RepoConfigLoader(object): if old_location is not None and old_location != repo.location: ignored_map.setdefault(repo.name, []).append(old_location) ignored_location_map[old_location] = repo.name + if old_location == portdir: + portdir = repo.user_location prepos[repo.name].update(repo) + repo = prepos[repo.name] else: prepos[repo.name] = repo - repo = prepos[repo.name] - if repo.priority is None: - if ov == portdir and portdir not in port_ov: - repo.priority = -1000 - else: - repo.priority = base_priority - base_priority += 1 + if ov == portdir and portdir not in port_ov: + repo.priority = -1000 + else: + repo.priority = base_priority + base_priority += 1 else: writemsg(_("!!! Invalid PORTDIR_OVERLAY" " (not a dir): '%s'\n") % ov, noiselevel=-1) + + return portdir + def repo_priority(r): """ Key funtion for comparing repositories by priority. @@ -274,11 +278,15 @@ class RepoConfigLoader(object): ignored_location_map = {} portdir = settings.get('PORTDIR', '') - if portdir and portdir.strip(): - portdir = os.path.realpath(portdir) portdir_overlay = settings.get('PORTDIR_OVERLAY', '') parse(paths, prepos, ignored_map, ignored_location_map) - add_overlays(portdir, portdir_overlay, prepos, ignored_map, ignored_location_map) + # If PORTDIR_OVERLAY contains a repo with the same repo_name as + # PORTDIR, then PORTDIR is overridden. + portdir = add_overlays(portdir, portdir_overlay, prepos, + ignored_map, ignored_location_map) + if portdir and portdir.strip(): + portdir = os.path.realpath(portdir) + ignored_repos = tuple((repo_name, tuple(paths)) \ for repo_name, paths in ignored_map.items()) -- cgit v1.2.3-1-g7c22