Gentoo Archives: gentoo-portage-dev

From: Chris Reffett <creffett@g.o>
To: gentoo-portage-dev@l.g.o
Subject: [gentoo-portage-dev] [PATCH v3] 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 21:04:11
Message-Id: 1389819791-17726-1-git-send-email-creffett@gentoo.org
1 ---
2 pym/repoman/checks.py | 29 +++++++++++++++++++++++++++++
3 1 file changed, 29 insertions(+)
4
5 Ignore v2, I apparently didn't commit all of my changes and so that patch
6 won't work. Undid the compression of the src_prepare/src_configure regex,
7 because the way that the regex is set up means that it would output "prepare
8 phase is not defined in EAPI..." instead of "src_prepare" and I feel that
9 it's more intuitive to match the full name of the function instead of tacking
10 src_ in front of the output.
11
12
13 diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py
14 index 85aa065..c6860d8 100644
15 --- a/pym/repoman/checks.py
16 +++ b/pym/repoman/checks.py
17 @@ -731,6 +731,21 @@ class DeprecatedHasq(LineCheck):
18 re = re.compile(r'(^|.*\b)hasq\b')
19 error = errors.HASQ_ERROR
20
21 +# EAPI <2 checks
22 +class Eapi01UndefinedPhases(LineCheck):
23 + repoman_check_name = 'EAPI.incompatible'
24 + src_configprepare_re = re.compile(r'\s*(src_configure|src_prepare)\s*\(\)')
25 +
26 + def check_eapi(self, eapi):
27 + return eapi in ('0', '1')
28 +
29 + def check(self, num, line):
30 + m = self.src_configprepare_re.match(line)
31 + if m is not None:
32 + return ("'%s'" % m.group(1)) + \
33 + " phase is not defined in EAPI < 2 on line: %d"
34 +
35 +
36 # EAPI-3 checks
37 class Eapi3DeprecatedFuncs(LineCheck):
38 repoman_check_name = 'EAPI.deprecated'
39 @@ -745,6 +760,20 @@ class Eapi3DeprecatedFuncs(LineCheck):
40 return ("'%s'" % m.group(1)) + \
41 " has been deprecated in EAPI=3 on line: %d"
42
43 +# EAPI <4 checks
44 +class Eapi0123UndefinedPhases(LineCheck):
45 + repoman_check_name = 'EAPI.incompatible'
46 + pkg_pretend_re = re.compile(r'\s*(pkg_pretend)\s*\(\)')
47 +
48 + def check_eapi(self, eapi):
49 + return eapi in ('0', '1', '2', '3')
50 +
51 + def check(self, num, line):
52 + m = self.pkg_pretend_re.match(line)
53 + if m is not None:
54 + return ("'%s'" % m.group(1)) + \
55 + " phase is not defined in EAPI < 4 on line: %d"
56 +
57 # EAPI-4 checks
58 class Eapi4IncompatibleFuncs(LineCheck):
59 repoman_check_name = 'EAPI.incompatible'
60 --
61 1.8.5.1

Replies