From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 4F995198005 for ; Sun, 10 Mar 2013 08:31:23 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D68D4E058A; Sun, 10 Mar 2013 08:31:21 +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 619EEE058A for ; Sun, 10 Mar 2013 08:31:21 +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 745B433DB7B for ; Sun, 10 Mar 2013 08:31:20 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 0D2D7E4079 for ; Sun, 10 Mar 2013 08:31:19 +0000 (UTC) From: "Zac Medico" 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" Message-ID: <1362904250.8860b8614530dd3d8e0e707f317b815d0f3bdf6c.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: 8860b8614530dd3d8e0e707f317b815d0f3bdf6c X-VCS-Branch: master Date: Sun, 10 Mar 2013 08:31:19 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 7af32656-b643-4ffd-8662-5d44536bf02e X-Archives-Hash: 3bc593bf25f0c1c8e05900154160870b commit: 8860b8614530dd3d8e0e707f317b815d0f3bdf6c Author: Zac Medico gentoo org> AuthorDate: Sun Mar 10 08:07:21 2013 +0000 Commit: Zac Medico gentoo org> CommitDate: Sun Mar 10 08:30:50 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=8860b861 RepoConfig: always map unaliased when available This fixes get_name_for_location so that it always returns the unaliased repo name, rather than (randomly) returning aliases. --- pym/portage/repository/config.py | 32 ++++++++++++++++++++++---------- 1 files changed, 22 insertions(+), 10 deletions(-) diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py index 5aef4f7..ef2e4f0 100644 --- a/pym/portage/repository/config.py +++ b/pym/portage/repository/config.py @@ -490,9 +490,15 @@ class RepoConfigLoader(object): for repo in prepos.values() if repo.location is not None and repo.missing_repo_name) - #Take aliases into account. - new_prepos = {} + # Do this before expanding aliases, so that location_map and + # treemap consistently map unaliased names whenever available. for repo_name, repo in prepos.items(): + if repo.location is not None: + location_map[repo.location] = repo_name + treemap[repo_name] = repo.location + + # Add alias mappings, but never replace unaliased mappings. + for repo_name, repo in list(prepos.items()): names = set() names.add(repo_name) if repo.aliases: @@ -500,17 +506,23 @@ class RepoConfigLoader(object): names.update(aliases) for name in names: - if name in new_prepos: + if name in prepos and prepos[name].location is not None: + if name == repo_name: + # unaliased names already handled earlier + continue writemsg_level(_("!!! Repository name or alias '%s', " + \ "defined for repository '%s', overrides " + \ "existing alias or repository.\n") % (name, repo_name), level=logging.WARNING, noiselevel=-1) - new_prepos[name] = repo - prepos = new_prepos - - for (name, r) in prepos.items(): - if r.location is not None: - location_map[r.location] = name - treemap[name] = r.location + # Never replace an unaliased mapping with + # an aliased mapping. + continue + prepos[name] = repo + if repo.location is not None: + if repo.location not in location_map: + # Never replace an unaliased mapping with + # an aliased mapping. + location_map[repo.location] = name + treemap[name] = repo.location # filter duplicates from aliases, by only including # items where repo.name == key