1 |
commit: 7213586e1bdfbab66ddb21284eddbd9b51c28cb1 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Jan 1 23:23:46 2013 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Jan 1 23:23:46 2013 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7213586e |
7 |
|
8 |
repoman: handle EAPI 5 usex, bug #449678 |
9 |
|
10 |
--- |
11 |
pym/repoman/checks.py | 17 +++++++++++++---- |
12 |
1 files changed, 13 insertions(+), 4 deletions(-) |
13 |
|
14 |
diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py |
15 |
index c6c7ddb..80e0d14 100644 |
16 |
--- a/pym/repoman/checks.py |
17 |
+++ b/pym/repoman/checks.py |
18 |
@@ -480,6 +480,7 @@ class InheritEclass(LineCheck): |
19 |
self._disabled = any(x in inherited for x in self._exempt_eclasses) |
20 |
else: |
21 |
self._disabled = False |
22 |
+ self._eapi = pkg.eapi |
23 |
|
24 |
def check(self, num, line): |
25 |
if not self._inherit: |
26 |
@@ -488,10 +489,14 @@ class InheritEclass(LineCheck): |
27 |
if self._disabled or self._ignore_missing: |
28 |
return |
29 |
s = self._func_re.search(line) |
30 |
- if s: |
31 |
- self._func_call = True |
32 |
- return '%s.eclass is not inherited, but "%s" found at line: %s' % \ |
33 |
- (self._eclass, s.group(3), '%d') |
34 |
+ if s is not None: |
35 |
+ func_name = s.group(3) |
36 |
+ eapi_func = _eclass_eapi_functions.get(func_name) |
37 |
+ if eapi_func is None or not eapi_func(self._eapi): |
38 |
+ self._func_call = True |
39 |
+ return ('%s.eclass is not inherited, ' |
40 |
+ 'but "%s" found at line: %s') % \ |
41 |
+ (self._eclass, func_name, '%d') |
42 |
elif not self._func_call: |
43 |
self._func_call = self._func_re.search(line) |
44 |
|
45 |
@@ -500,6 +505,10 @@ class InheritEclass(LineCheck): |
46 |
self.repoman_check_name = 'inherit.unused' |
47 |
yield 'no function called from %s.eclass; please drop' % self._eclass |
48 |
|
49 |
+_eclass_eapi_functions = { |
50 |
+ "usex" : lambda eapi: eapi not in ("0", "1", "2", "3", "4") |
51 |
+} |
52 |
+ |
53 |
# eclasses that export ${ECLASS}_src_(compile|configure|install) |
54 |
_eclass_export_functions = ( |
55 |
'ant-tasks', 'apache-2', 'apache-module', 'aspell-dict', |