From: Zac Medico Date: Tue, 18 Jun 2013 17:46:59 +0000 (-0700) Subject: RepoConfigLoader: fix main-repo priority default X-Git-Tag: v2.2.0_alpha181~3 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a2a41572a696bd280a5004794f9067b31dde6b48;p=portage.git 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. --- diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py index a63bc9ca1..56a9ea493 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