1 |
commit: 2959902eb75c4af024909efdb13db497351362b8 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Jun 2 04:52:17 2012 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Jun 2 04:52:17 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2959902e |
7 |
|
8 |
InheritEclass: add stable / conservative mode |
9 |
|
10 |
--- |
11 |
pym/portage/const.py | 1 + |
12 |
pym/repoman/checks.py | 30 ++++++++++++++++++++++++++++-- |
13 |
2 files changed, 29 insertions(+), 2 deletions(-) |
14 |
|
15 |
diff --git a/pym/portage/const.py b/pym/portage/const.py |
16 |
index 5d6aabc..3744e11 100644 |
17 |
--- a/pym/portage/const.py |
18 |
+++ b/pym/portage/const.py |
19 |
@@ -165,6 +165,7 @@ _ENABLE_DYN_LINK_MAP = True |
20 |
_ENABLE_PRESERVE_LIBS = True |
21 |
_ENABLE_REPO_NAME_WARN = True |
22 |
_ENABLE_SET_CONFIG = True |
23 |
+_ENABLE_INHERIT_CHECK = True |
24 |
|
25 |
|
26 |
# The definitions above will differ between branches, so it's useful to have |
27 |
|
28 |
diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py |
29 |
index 4d37187..461e216 100644 |
30 |
--- a/pym/repoman/checks.py |
31 |
+++ b/pym/repoman/checks.py |
32 |
@@ -14,6 +14,7 @@ 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 |
+from portage.const import _ENABLE_INHERIT_CHECK |
37 |
|
38 |
class LineCheck(object): |
39 |
"""Run a check on a line of an ebuild.""" |
40 |
@@ -461,10 +462,11 @@ class InheritEclass(LineCheck): |
41 |
""" |
42 |
|
43 |
def __init__(self, eclass, funcs=None, comprehensive=False, |
44 |
- exempt_eclasses=None, **kwargs): |
45 |
+ exempt_eclasses=None, ignore_missing=False, **kwargs): |
46 |
self._eclass = eclass |
47 |
self._comprehensive = comprehensive |
48 |
self._exempt_eclasses = exempt_eclasses |
49 |
+ self._ignore_missing = ignore_missing |
50 |
inherit_re = eclass |
51 |
subclasses = _eclass_subclass_info.get(eclass) |
52 |
if subclasses is not None: |
53 |
@@ -487,7 +489,7 @@ class InheritEclass(LineCheck): |
54 |
if not self._inherit: |
55 |
self._inherit = self._inherit_re.match(line) |
56 |
if not self._inherit: |
57 |
- if self._disabled: |
58 |
+ if self._disabled or self._ignore_missing: |
59 |
return |
60 |
s = self._func_re.search(line) |
61 |
if s: |
62 |
@@ -591,6 +593,30 @@ for k, v in _eclass_info.items(): |
63 |
for parent in inherited_api: |
64 |
_eclass_subclass_info.setdefault(parent, set()).add(k) |
65 |
|
66 |
+if not _ENABLE_INHERIT_CHECK: |
67 |
+ # Since the InheritEclass check is experimental, in the stable branch |
68 |
+ # we emulate the old eprefixify.defined and inherit.autotools checks. |
69 |
+ _eclass_info = { |
70 |
+ 'autotools': { |
71 |
+ 'funcs': ( |
72 |
+ 'eaclocal', 'eautoconf', 'eautoheader', |
73 |
+ 'eautomake', 'eautoreconf', '_elibtoolize', |
74 |
+ 'eautopoint' |
75 |
+ ), |
76 |
+ 'comprehensive': True, |
77 |
+ 'ignore_missing': True, |
78 |
+ 'exempt_eclasses': ('git', 'git-2', 'subversion', 'autotools-utils') |
79 |
+ }, |
80 |
+ |
81 |
+ 'prefix': { |
82 |
+ 'funcs': ( |
83 |
+ 'eprefixify', |
84 |
+ ), |
85 |
+ 'comprehensive': False |
86 |
+ } |
87 |
+ } |
88 |
+ _eclass_subclass_info = {} |
89 |
+ |
90 |
class IUseUndefined(LineCheck): |
91 |
""" |
92 |
Make sure the ebuild defines IUSE (style guideline |