public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Chris Reffett <creffett@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Subject: [gentoo-portage-dev] [PATCH v4] Add repoman check to warn if src_prepare/src_configure are used in EAPI 0/1 and if pkg_pretend is used in EAPI < 4. Fixes bug 379491.
Date: Wed, 15 Jan 2014 16:35:48 -0500	[thread overview]
Message-ID: <1389821748-18454-1-git-send-email-creffett@gentoo.org> (raw)

---
 pym/repoman/checks.py | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py
index 85aa065..c814fa7 100644
--- a/pym/repoman/checks.py
+++ b/pym/repoman/checks.py
@@ -15,7 +15,7 @@ import repoman.errors as errors
 import portage
 from portage.eapi import eapi_supports_prefix, eapi_has_implicit_rdepend, \
 	eapi_has_src_prepare_and_src_configure, eapi_has_dosed_dohard, \
-	eapi_exports_AA
+	eapi_exports_AA, eapi_has_pkg_pretend
 
 class LineCheck(object):
 	"""Run a check on a line of an ebuild."""
@@ -731,6 +731,21 @@ class DeprecatedHasq(LineCheck):
 	re = re.compile(r'(^|.*\b)hasq\b')
 	error = errors.HASQ_ERROR
 
+# EAPI <2 checks
+class UndefinedSrcPrepareSrcConfigurePhases(LineCheck):
+	repoman_check_name = 'EAPI.incompatible'
+	src_configprepare_re = re.compile(r'\s*(src_configure|src_prepare)\s*\(\)')
+
+	def check_eapi(self, eapi):
+		return not eapi_has_src_prepare_and_src_configure(eapi)
+
+	def check(self, num, line):
+		m = self.src_configprepare_re.match(line)
+		if m is not None:
+			return ("'%s'" % m.group(1)) + \
+				" phase is not defined in EAPI < 2 on line: %d"
+
+
 # EAPI-3 checks
 class Eapi3DeprecatedFuncs(LineCheck):
 	repoman_check_name = 'EAPI.deprecated'
@@ -745,6 +760,20 @@ class Eapi3DeprecatedFuncs(LineCheck):
 			return ("'%s'" % m.group(1)) + \
 				" has been deprecated in EAPI=3 on line: %d"
 
+# EAPI <4 checks
+class UndefinedPkgPretendPhase(LineCheck):
+	repoman_check_name = 'EAPI.incompatible'
+	pkg_pretend_re = re.compile(r'\s*(pkg_pretend)\s*\(\)')
+
+	def check_eapi(self, eapi):
+		return not eapi_has_pkg_pretend(eapi)
+
+	def check(self, num, line):
+		m = self.pkg_pretend_re.match(line)
+		if m is not None:
+			return ("'%s'" % m.group(1)) + \
+				" phase is not defined in EAPI < 4 on line: %d"
+
 # EAPI-4 checks
 class Eapi4IncompatibleFuncs(LineCheck):
 	repoman_check_name = 'EAPI.incompatible'
-- 
1.8.5.1



             reply	other threads:[~2014-01-15 21:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-15 21:35 Chris Reffett [this message]
2014-01-15 22:23 ` [gentoo-portage-dev] Re: [PATCH v4] Add repoman check to warn if src_prepare/src_configure are used in EAPI 0/1 and if pkg_pretend is used in EAPI < 4. Fixes bug 379491 Duncan
2014-01-15 22:54 ` [gentoo-portage-dev] " Tom Wijsman
2014-01-19  9:22 ` Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1389821748-18454-1-git-send-email-creffett@gentoo.org \
    --to=creffett@gentoo.org \
    --cc=gentoo-portage-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox