InheritEclass: add stable / conservative mode
authorZac Medico <zmedico@gentoo.org>
Sat, 2 Jun 2012 04:52:17 +0000 (21:52 -0700)
committerZac Medico <zmedico@gentoo.org>
Sat, 2 Jun 2012 04:52:17 +0000 (21:52 -0700)
pym/portage/const.py
pym/repoman/checks.py

index 5d6aabc0db4452fa473750d7d68c7a7b89f60b10..3744e111f3256a98717d42a0d6b7990c9adec4e3 100644 (file)
@@ -165,6 +165,7 @@ _ENABLE_DYN_LINK_MAP    = True
 _ENABLE_PRESERVE_LIBS   = True
 _ENABLE_REPO_NAME_WARN  = True
 _ENABLE_SET_CONFIG      = True
+_ENABLE_INHERIT_CHECK   = True
 
 
 # The definitions above will differ between branches, so it's useful to have
index 4d3718730ace24a05a9b896b6ad06397b42934b6..461e216d61ad78071e64fdcea9ca2d9a8ff2bb5d 100644 (file)
@@ -14,6 +14,7 @@ import portage
 from portage.eapi import eapi_supports_prefix, eapi_has_implicit_rdepend, \
        eapi_has_src_prepare_and_src_configure, eapi_has_dosed_dohard, \
        eapi_exports_AA
+from portage.const import _ENABLE_INHERIT_CHECK
 
 class LineCheck(object):
        """Run a check on a line of an ebuild."""
@@ -461,10 +462,11 @@ class InheritEclass(LineCheck):
        """
 
        def __init__(self, eclass, funcs=None, comprehensive=False,
-               exempt_eclasses=None, **kwargs):
+               exempt_eclasses=None, ignore_missing=False, **kwargs):
                self._eclass = eclass
                self._comprehensive = comprehensive
                self._exempt_eclasses = exempt_eclasses
+               self._ignore_missing = ignore_missing
                inherit_re = eclass
                subclasses = _eclass_subclass_info.get(eclass)
                if subclasses is not None:
@@ -487,7 +489,7 @@ class InheritEclass(LineCheck):
                if not self._inherit:
                        self._inherit = self._inherit_re.match(line)
                if not self._inherit:
-                       if self._disabled:
+                       if self._disabled or self._ignore_missing:
                                return
                        s = self._func_re.search(line)
                        if s:
@@ -591,6 +593,30 @@ for k, v in _eclass_info.items():
                for parent in inherited_api:
                        _eclass_subclass_info.setdefault(parent, set()).add(k)
 
+if not _ENABLE_INHERIT_CHECK:
+       # Since the InheritEclass check is experimental, in the stable branch
+       # we emulate the old eprefixify.defined and inherit.autotools checks.
+       _eclass_info = {
+               'autotools': {
+                       'funcs': (
+                               'eaclocal', 'eautoconf', 'eautoheader',
+                               'eautomake', 'eautoreconf', '_elibtoolize',
+                               'eautopoint'
+                       ),
+                       'comprehensive': True,
+                       'ignore_missing': True,
+                       'exempt_eclasses': ('git', 'git-2', 'subversion', 'autotools-utils')
+               },
+
+               'prefix': {
+                       'funcs': (
+                               'eprefixify',
+                       ),
+                       'comprehensive': False
+               }
+       }
+       _eclass_subclass_info = {}
+
 class IUseUndefined(LineCheck):
        """
        Make sure the ebuild defines IUSE (style guideline