Gentoo Archives: gentoo-commits

From: Chris Reffett <creffett@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/repoman/
Date: Mon, 27 Jan 2014 03:13:53
Message-Id: 1390792324.00560e0b22059ffb42d965b4ef625950ab987afc.creffett@gentoo
1 commit: 00560e0b22059ffb42d965b4ef625950ab987afc
2 Author: Chris Reffett <creffett <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jan 14 00:01:25 2014 +0000
4 Commit: Chris Reffett <creffett <AT> gentoo <DOT> org>
5 CommitDate: Mon Jan 27 03:12:04 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=00560e0b
7
8 Add src_{prepare, configure} and pkg_pretend checks to repoman
9
10 EAPI 0/1: Warn if src_configure/src_pretend used
11 EAPI < 4: Warn if pkg_pretend is used
12 Fixes bug 379491.
13
14 Acked-by: Mike Frysinger <vapier <AT> gentoo.org>
15
16 ---
17 pym/repoman/checks.py | 33 +++++++++++++++++++++++++++++++--
18 1 file changed, 31 insertions(+), 2 deletions(-)
19
20 diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py
21 index 85aa065..8032b28 100644
22 --- a/pym/repoman/checks.py
23 +++ b/pym/repoman/checks.py
24 @@ -1,5 +1,5 @@
25 # repoman: Checks
26 -# Copyright 2007-2013 Gentoo Foundation
27 +# Copyright 2007-2014 Gentoo Foundation
28 # Distributed under the terms of the GNU General Public License v2
29
30 """This module contains functions used in Repoman to ascertain the quality
31 @@ -15,7 +15,7 @@ import repoman.errors as errors
32 import portage
33 from portage.eapi import eapi_supports_prefix, eapi_has_implicit_rdepend, \
34 eapi_has_src_prepare_and_src_configure, eapi_has_dosed_dohard, \
35 - eapi_exports_AA
36 + eapi_exports_AA, eapi_has_pkg_pretend
37
38 class LineCheck(object):
39 """Run a check on a line of an ebuild."""
40 @@ -731,6 +731,21 @@ class DeprecatedHasq(LineCheck):
41 re = re.compile(r'(^|.*\b)hasq\b')
42 error = errors.HASQ_ERROR
43
44 +# EAPI <2 checks
45 +class UndefinedSrcPrepareSrcConfigurePhases(LineCheck):
46 + repoman_check_name = 'EAPI.incompatible'
47 + src_configprepare_re = re.compile(r'\s*(src_configure|src_prepare)\s*\(\)')
48 +
49 + def check_eapi(self, eapi):
50 + return not eapi_has_src_prepare_and_src_configure(eapi)
51 +
52 + def check(self, num, line):
53 + m = self.src_configprepare_re.match(line)
54 + if m is not None:
55 + return ("'%s'" % m.group(1)) + \
56 + " phase is not defined in EAPI < 2 on line: %d"
57 +
58 +
59 # EAPI-3 checks
60 class Eapi3DeprecatedFuncs(LineCheck):
61 repoman_check_name = 'EAPI.deprecated'
62 @@ -745,6 +760,20 @@ class Eapi3DeprecatedFuncs(LineCheck):
63 return ("'%s'" % m.group(1)) + \
64 " has been deprecated in EAPI=3 on line: %d"
65
66 +# EAPI <4 checks
67 +class UndefinedPkgPretendPhase(LineCheck):
68 + repoman_check_name = 'EAPI.incompatible'
69 + pkg_pretend_re = re.compile(r'\s*(pkg_pretend)\s*\(\)')
70 +
71 + def check_eapi(self, eapi):
72 + return not eapi_has_pkg_pretend(eapi)
73 +
74 + def check(self, num, line):
75 + m = self.pkg_pretend_re.match(line)
76 + if m is not None:
77 + return ("'%s'" % m.group(1)) + \
78 + " phase is not defined in EAPI < 4 on line: %d"
79 +
80 # EAPI-4 checks
81 class Eapi4IncompatibleFuncs(LineCheck):
82 repoman_check_name = 'EAPI.incompatible'