1 |
commit: 7acbff42e2ff9a4521efb7fbf2cb69f17944b53c |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed May 30 23:56:33 2012 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed May 30 23:56:33 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7acbff42 |
7 |
|
8 |
InheritEclass: support subclass inherited_api |
9 |
|
10 |
--- |
11 |
pym/repoman/checks.py | 23 ++++++++++++++++++----- |
12 |
1 files changed, 18 insertions(+), 5 deletions(-) |
13 |
|
14 |
diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py |
15 |
index 5d56888..cd21fd9 100644 |
16 |
--- a/pym/repoman/checks.py |
17 |
+++ b/pym/repoman/checks.py |
18 |
@@ -461,13 +461,16 @@ class InheritEclass(LineCheck): |
19 |
""" |
20 |
|
21 |
def __init__(self, eclass, funcs=None, comprehensive=False, |
22 |
- exempt_eclasses=None): |
23 |
+ exempt_eclasses=None, **kwargs): |
24 |
self._eclass = eclass |
25 |
- self._funcs = funcs |
26 |
self._comprehensive = comprehensive |
27 |
self._exempt_eclasses = exempt_eclasses |
28 |
- self._inherit_re = re.compile(r'^\s*inherit\s(.*\s)?%s(\s|$)' % self._eclass) |
29 |
- self._func_re = re.compile(r'\b(' + '|'.join(self._funcs) + r')\b') |
30 |
+ inherit_re = eclass |
31 |
+ subclasses = _eclass_subclass_info.get(eclass) |
32 |
+ if subclasses is not None: |
33 |
+ inherit_re = '(%s)' % '|'.join([eclass] + list(subclasses)) |
34 |
+ self._inherit_re = re.compile(r'^\s*inherit\s(.*\s)?%s(\s|$)' % inherit_re) |
35 |
+ self._func_re = re.compile(r'\b(' + '|'.join(funcs) + r')\b') |
36 |
|
37 |
def new(self, pkg): |
38 |
self.repoman_check_name = 'inherit.missing' |
39 |
@@ -526,7 +529,9 @@ _eclass_info = { |
40 |
'comprehensive': False, |
41 |
|
42 |
# These are "eclasses are the whole ebuild" type thing. |
43 |
- 'exempt_eclasses': frozenset(['toolchain', 'toolchain-binutils']) |
44 |
+ 'exempt_eclasses': ('toolchain', 'toolchain-binutils'), |
45 |
+ |
46 |
+ #'inherited_api': ('multilib', 'user',), |
47 |
}, |
48 |
|
49 |
'flag-o-matic': { |
50 |
@@ -574,6 +579,14 @@ _eclass_info = { |
51 |
} |
52 |
} |
53 |
|
54 |
+_eclass_subclass_info = {} |
55 |
+ |
56 |
+for k, v in _eclass_info.items(): |
57 |
+ inherited_api = v.get('inherited_api') |
58 |
+ if inherited_api is not None: |
59 |
+ for parent in inherited_api: |
60 |
+ _eclass_subclass_info.setdefault(parent, set()).add(k) |
61 |
+ |
62 |
class IUseUndefined(LineCheck): |
63 |
""" |
64 |
Make sure the ebuild defines IUSE (style guideline |