1 |
--- |
2 |
pym/repoman/checks.py | 31 ++++++++++++++++++++++++++++++- |
3 |
1 file changed, 30 insertions(+), 1 deletion(-) |
4 |
|
5 |
diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py |
6 |
index 85aa065..c814fa7 100644 |
7 |
--- a/pym/repoman/checks.py |
8 |
+++ b/pym/repoman/checks.py |
9 |
@@ -15,7 +15,7 @@ import repoman.errors as errors |
10 |
import portage |
11 |
from portage.eapi import eapi_supports_prefix, eapi_has_implicit_rdepend, \ |
12 |
eapi_has_src_prepare_and_src_configure, eapi_has_dosed_dohard, \ |
13 |
- eapi_exports_AA |
14 |
+ eapi_exports_AA, eapi_has_pkg_pretend |
15 |
|
16 |
class LineCheck(object): |
17 |
"""Run a check on a line of an ebuild.""" |
18 |
@@ -731,6 +731,21 @@ class DeprecatedHasq(LineCheck): |
19 |
re = re.compile(r'(^|.*\b)hasq\b') |
20 |
error = errors.HASQ_ERROR |
21 |
|
22 |
+# EAPI <2 checks |
23 |
+class UndefinedSrcPrepareSrcConfigurePhases(LineCheck): |
24 |
+ repoman_check_name = 'EAPI.incompatible' |
25 |
+ src_configprepare_re = re.compile(r'\s*(src_configure|src_prepare)\s*\(\)') |
26 |
+ |
27 |
+ def check_eapi(self, eapi): |
28 |
+ return not eapi_has_src_prepare_and_src_configure(eapi) |
29 |
+ |
30 |
+ def check(self, num, line): |
31 |
+ m = self.src_configprepare_re.match(line) |
32 |
+ if m is not None: |
33 |
+ return ("'%s'" % m.group(1)) + \ |
34 |
+ " phase is not defined in EAPI < 2 on line: %d" |
35 |
+ |
36 |
+ |
37 |
# EAPI-3 checks |
38 |
class Eapi3DeprecatedFuncs(LineCheck): |
39 |
repoman_check_name = 'EAPI.deprecated' |
40 |
@@ -745,6 +760,20 @@ class Eapi3DeprecatedFuncs(LineCheck): |
41 |
return ("'%s'" % m.group(1)) + \ |
42 |
" has been deprecated in EAPI=3 on line: %d" |
43 |
|
44 |
+# EAPI <4 checks |
45 |
+class UndefinedPkgPretendPhase(LineCheck): |
46 |
+ repoman_check_name = 'EAPI.incompatible' |
47 |
+ pkg_pretend_re = re.compile(r'\s*(pkg_pretend)\s*\(\)') |
48 |
+ |
49 |
+ def check_eapi(self, eapi): |
50 |
+ return not eapi_has_pkg_pretend(eapi) |
51 |
+ |
52 |
+ def check(self, num, line): |
53 |
+ m = self.pkg_pretend_re.match(line) |
54 |
+ if m is not None: |
55 |
+ return ("'%s'" % m.group(1)) + \ |
56 |
+ " phase is not defined in EAPI < 4 on line: %d" |
57 |
+ |
58 |
# EAPI-4 checks |
59 |
class Eapi4IncompatibleFuncs(LineCheck): |
60 |
repoman_check_name = 'EAPI.incompatible' |
61 |
-- |
62 |
1.8.5.1 |