From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1RCgFN-0000lp-V0 for garchives@archives.gentoo.org; Sat, 08 Oct 2011 23:24:02 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C94DD21C2B3; Sat, 8 Oct 2011 23:23:52 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 8862321C2B3 for ; Sat, 8 Oct 2011 23:23:52 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id F14981B4001 for ; Sat, 8 Oct 2011 23:23:51 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 4ABB780042 for ; Sat, 8 Oct 2011 23:23:51 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <5628dac1538985af640102654bce60a8e526daeb.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: 5628dac1538985af640102654bce60a8e526daeb Date: Sat, 8 Oct 2011 23:23:51 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: bdd70e8bcb447b20777343288cde4443 commit: 5628dac1538985af640102654bce60a8e526daeb Author: Zac Medico gentoo org> AuthorDate: Sat Oct 8 23:23:39 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Sat Oct 8 23:23:39 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D5628dac1 get_masters: protect against infinite recursion We can't have portage crash because of circular deps in layout.conf. --- pym/portage/repository/config.py | 53 +++++++++++++++++++++-----------= ----- 1 files changed, 30 insertions(+), 23 deletions(-) diff --git a/pym/portage/repository/config.py b/pym/portage/repository/co= nfig.py index 1d042ac..c5da4f6 100644 --- a/pym/portage/repository/config.py +++ b/pym/portage/repository/config.py @@ -484,38 +484,45 @@ class RepoConfigLoader(object): self._prepos_changed =3D True self._repo_location_list =3D [] =20 - def get_masters(repo_name, repo, recurse=3DTrue): + def get_masters(start_repo): master_repos =3D [] - if repo.masters is None: - if self.mainRepo() and repo_name !=3D self.mainRepo().name: - master_repos =3D [self.mainRepo()] + stack =3D [start_repo] + traversed =3D set() + while stack: + repo =3D stack.pop() + if repo.name in traversed: + continue + traversed.add(repo.name) + if repo is not start_repo: + master_repos.append(repo) + if repo.masters is None: + main_repo =3D self.mainRepo() + if main_repo is not None and \ + main_repo is not start_repo: + stack.append(main_repo) else: - master_repos =3D [] - else: - for master in repo.masters: - if isinstance(master, RepoConfig): - master_repos.append(master) - else: - if master not in prepos: - layout_filename =3D os.path.join(repo.user_location, - "metadata", "layout.conf") - writemsg_level(_("Unavailable repository '%s' " \ - "referenced by masters entry in '%s'\n") % \ - (master_name, layout_filename), - level=3Dlogging.ERROR, noiselevel=3D-1) + for master in repo.masters: + if isinstance(master, RepoConfig): + stack.append(master) else: - master =3D prepos[master] - if recurse: - master_repos.extend(get_masters(master.name, master) + [master]) + if master not in prepos: + layout_filename =3D os.path.join(repo.user_location, + "metadata", "layout.conf") + writemsg_level(_("Unavailable repository '%s' " \ + "referenced by masters entry in '%s'\n") % \ + (master, layout_filename), + level=3Dlogging.ERROR, noiselevel=3D-1) else: - master_repos.append(master) - return master_repos + stack.append(prepos[master]) + + master_repos.reverse() + return tuple(master_repos) =20 #The 'masters' key currently contains repo names. Replace them with th= e matching RepoConfig. for repo_name, repo in prepos.items(): if repo_name =3D=3D "DEFAULT": continue - repo.masters =3D tuple(get_masters(repo_name, repo)) + repo.masters =3D get_masters(repo) =20 #The 'eclass_overrides' key currently contains repo names. Replace the= m with the matching repo paths. for repo_name, repo in prepos.items():