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 1SSDJM-0000qn-T8 for garchives@archives.gentoo.org; Wed, 09 May 2012 20:16:37 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 94A96E0793; Wed, 9 May 2012 20:16:28 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 4F9C4E0793 for ; Wed, 9 May 2012 20:16:28 +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 642051B4044 for ; Wed, 9 May 2012 20:16:27 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 2E89DE542D for ; Wed, 9 May 2012 20:16:26 +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: <1336594546.5958b9d406134a139cd66025eaf7bd650fb32b24.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/EbuildMetadataPhase.py pym/portage/package/ebuild/_eapi_invalid.py X-VCS-Directories: pym/portage/package/ebuild/ pym/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 5958b9d406134a139cd66025eaf7bd650fb32b24 X-VCS-Branch: master Date: Wed, 9 May 2012 20:16:26 +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: 699e718e-e1d9-4d25-923f-a8acdd38718e X-Archives-Hash: b1dd82aa08299520844c58297dbc6909 commit: 5958b9d406134a139cd66025eaf7bd650fb32b24 Author: Zac Medico gentoo org> AuthorDate: Wed May 9 20:00:32 2012 +0000 Commit: Zac Medico gentoo org> CommitDate: Wed May 9 20:15:46 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D5958b9d4 Split out eapi_invalid function. --- pym/_emerge/EbuildMetadataPhase.py | 48 +++++----------------= ------ pym/portage/package/ebuild/_eapi_invalid.py | 46 +++++++++++++++++++++= ++++ 2 files changed, 55 insertions(+), 39 deletions(-) diff --git a/pym/_emerge/EbuildMetadataPhase.py b/pym/_emerge/EbuildMetad= ataPhase.py index f89077e..b7af69d 100644 --- a/pym/_emerge/EbuildMetadataPhase.py +++ b/pym/_emerge/EbuildMetadataPhase.py @@ -5,17 +5,17 @@ from _emerge.SubProcess import SubProcess import sys from portage.cache.mappings import slot_dict_class import portage +portage.proxy.lazyimport.lazyimport(globals(), + 'portage.package.ebuild._eapi_invalid:eapi_invalid', +) from portage import os from portage import _encodings from portage import _unicode_decode from portage import _unicode_encode -from portage.dep import _repo_separator -from portage.elog import elog_process -from portage.elog.messages import eerror + import errno import fcntl import io -import textwrap =20 class EbuildMetadataPhase(SubProcess): =20 @@ -171,40 +171,10 @@ class EbuildMetadataPhase(SubProcess): self.returncode =3D 1 =20 def _eapi_invalid(self, metadata): - repo_name =3D self.portdb.getRepositoryName(self.repo_path) - - msg =3D [] - msg.extend(textwrap.wrap(("EAPI assignment in ebuild '%s%s%s' does not= " - " conform with PMS section 7.3.1:") % - (self.cpv, _repo_separator, repo_name), 70)) - - if not self._eapi: - # None means the assignment was not found, while an - # empty string indicates an (invalid) empty assingment. - msg.append( - "\tvalid EAPI assignment must" - " occur on or before line: %s" % - self._eapi_lineno) - else: - msg.append(("\tbash returned EAPI '%s' which does not match " - "assignment on line: %s") % - (metadata["EAPI"], self._eapi_lineno)) - - if 'parse-eapi-ebuild-head' in self.settings.features: - msg.extend(textwrap.wrap(("NOTE: This error will soon" - " become unconditionally fatal in a future version of Portage," - " but at this time, it can by made non-fatal by setting" - " FEATURES=3D-parse-eapi-ebuild-head in" - " make.conf."), 70)) + if metadata is not None: + eapi_var =3D metadata["EAPI"] else: - msg.extend(textwrap.wrap(("NOTE: This error will soon" - " become unconditionally fatal in a future version of Portage." - " At the earliest opportunity, please enable" - " FEATURES=3Dparse-eapi-ebuild-head in make.conf in order to" - " make this error fatal."), 70)) - - for line in msg: - eerror(line, phase=3D"other", key=3Dself.cpv) - elog_process(self.cpv, self.settings, - phasefilter=3D("other",)) + eapi_var =3D None + eapi_invalid(self, self.cpv, repo_name, self.settings, + eapi_var, self._eapi, self._eapi_lineno) diff --git a/pym/portage/package/ebuild/_eapi_invalid.py b/pym/portage/pa= ckage/ebuild/_eapi_invalid.py new file mode 100644 index 0000000..50a6978 --- /dev/null +++ b/pym/portage/package/ebuild/_eapi_invalid.py @@ -0,0 +1,46 @@ +# Copyright 2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +import textwrap + +from portage.dep import _repo_separator +from portage.elog import elog_process +from portage.elog.messages import eerror + +def eapi_invalid(self, cpv, repo_name, settings, + eapi_var, eapi_parsed, eapi_lineno): + + msg =3D [] + msg.extend(textwrap.wrap(("EAPI assignment in ebuild '%s%s%s' does not" + " conform with PMS section 7.3.1:") % + (cpv, _repo_separator, repo_name), 70)) + + if not eapi_parsed: + # None means the assignment was not found, while an + # empty string indicates an (invalid) empty assingment. + msg.append( + "\tvalid EAPI assignment must" + " occur on or before line: %s" % + eapi_lineno) + else: + msg.append(("\tbash returned EAPI '%s' which does not match " + "assignment on line: %s") % + (eapi_var, eapi_lineno)) + + if 'parse-eapi-ebuild-head' in settings.features: + msg.extend(textwrap.wrap(("NOTE: This error will soon" + " become unconditionally fatal in a future version of Portage," + " but at this time, it can by made non-fatal by setting" + " FEATURES=3D-parse-eapi-ebuild-head in" + " make.conf."), 70)) + else: + msg.extend(textwrap.wrap(("NOTE: This error will soon" + " become unconditionally fatal in a future version of Portage." + " At the earliest opportunity, please enable" + " FEATURES=3Dparse-eapi-ebuild-head in make.conf in order to" + " make this error fatal."), 70)) + + for line in msg: + eerror(line, phase=3D"other", key=3Dcpv) + elog_process(cpv, settings, + phasefilter=3D("other",))