Gentoo Archives: gentoo-portage-dev

From: Chris Reffett <creffett@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Chris Reffett <creffett@g.o>
Subject: [gentoo-portage-dev] [PATCH v2] 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 14:34:26
Message-Id: 1389796389-9917-1-git-send-email-creffett@gentoo.org
1 ---
2 pym/repoman/checks.py | 29 +++++++++++++++++++++++++++++
3 1 file changed, 29 insertions(+)
4
5 diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py
6 index 85aa065..5c55b0d 100644
7 --- a/pym/repoman/checks.py
8 +++ b/pym/repoman/checks.py
9 @@ -731,6 +731,21 @@ class DeprecatedHasq(LineCheck):
10 re = re.compile(r'(^|.*\b)hasq\b')
11 error = errors.HASQ_ERROR
12
13 +# EAPI <2 checks
14 +class Eapi01UndefinedPhases(LineCheck):
15 + repoman_check_name = 'EAPI.incompatible'
16 + src_configprepare_re = re.compile(r'\s*src_(configure|prepare)\s*\(\)')
17 +
18 + def check_eapi(self, eapi):
19 + return eapi in ('0', '1')
20 +
21 + def check(self, num, line):
22 + m = self.src_configprepare__re.match(line)
23 + if m is not None:
24 + return ("%s" % m.group(1)) + \
25 + " phase is not defined in EAPI=0/1 on line: %d"
26 +
27 +
28 # EAPI-3 checks
29 class Eapi3DeprecatedFuncs(LineCheck):
30 repoman_check_name = 'EAPI.deprecated'
31 @@ -745,6 +760,20 @@ class Eapi3DeprecatedFuncs(LineCheck):
32 return ("'%s'" % m.group(1)) + \
33 " has been deprecated in EAPI=3 on line: %d"
34
35 +# EAPI <4 checks
36 +class Eapi0123UndefinedPhases(LineCheck):
37 + repoman_check_name = 'EAPI.incompatible'
38 + pkg_pretend_re = re.compile(r'\s*pkg_pretend\s*\(\)')
39 +
40 + def check_eapi(self, eapi):
41 + return eapi in ('0', '1', '2', '3')
42 +
43 + def check(self, num, line):
44 + m = self.pkg_pretend_re.match(line)
45 + if m is not None:
46 + return ("%s" % m.group(1)) + \
47 + " phase is not defined in EAPI < 4 on line: %d"
48 +
49 # EAPI-4 checks
50 class Eapi4IncompatibleFuncs(LineCheck):
51 repoman_check_name = 'EAPI.incompatible'
52 --
53 1.8.5.1