repoman: add --experimental-inherit=<y|n> option
authorZac Medico <zmedico@gentoo.org>
Mon, 12 Aug 2013 20:54:12 +0000 (13:54 -0700)
committerZac Medico <zmedico@gentoo.org>
Mon, 12 Aug 2013 20:54:12 +0000 (13:54 -0700)
Enable experimental inherit.missing checks which may misbehave when the
internal eclass database becomes outdated.

bin/repoman
man/repoman.1
pym/portage/const.py
pym/repoman/checks.py

index 2f489341bf692acd245be3c210fcebc02b5a4903..731509db36c4e9a6e906374567df90b6a624415d 100755 (executable)
@@ -56,6 +56,7 @@ except (ImportError, SystemError, RuntimeError, Exception):
 from portage import os
 from portage import _encodings
 from portage import _unicode_encode
+import repoman.checks
 from repoman.checks import run_checks
 from repoman import utilities
 from repoman.herdbase import make_herd_base
@@ -174,6 +175,11 @@ def ParseArgs(argv, qahelp):
                help='for commit mode, call echangelog if ChangeLog is unmodified (or '
                'regardless of modification if \'force\' is specified)')
 
+       parser.add_argument('--experimental-inherit', choices=('y', 'n'),
+               metavar="<y|n>", default='n',
+               help='Enable experimental inherit.missing checks which may misbehave'
+                       ' when the internal eclass database becomes outdated')
+
        parser.add_argument('-f', '--force', dest='force', default=False, action='store_true',
                help='Commit with QA violations')
 
@@ -396,10 +402,6 @@ qawarnings = set((
 "IUSE.rubydeprecated",
 ))
 
-if portage.const._ENABLE_INHERIT_CHECK:
-       # This is experimental, so it's non-fatal.
-       qawarnings.add("inherit.missing")
-
 non_ascii_re = re.compile(r'[^\x00-\x7f]')
 
 missingvars = ["KEYWORDS", "LICENSE", "DESCRIPTION", "HOMEPAGE"]
@@ -499,6 +501,11 @@ if options.version:
        print("Portage", portage.VERSION)
        sys.exit(0)
 
+if options.experimental_inherit == 'y':
+       # This is experimental, so it's non-fatal.
+       qawarnings.add("inherit.missing")
+       repoman.checks._init(experimental_inherit=True)
+
 # Set this to False when an extraordinary issue (generally
 # something other than a QA issue) makes it impossible to
 # commit (like if Manifest generation fails).
index d4ced1dfb72407a6c513ccc74177124e6793ea02..3a0477145a039ca8380c81f54e59c8ed8cd85c79 100644 (file)
@@ -65,6 +65,10 @@ can be enabled by default for a particular repository by setting
 "update\-changelog = true" in metadata/layout.conf (see
 \fBportage(5)\fR).
 .TP
+\fB\-\-experimental\-inherit=<y|n>\fR
+Enable experimental inherit.missing checks which may misbehave when the
+internal eclass database becomes outdated.
+.TP
 \fB\-\-if\-modified=<y|n>\fR
 Only check packages that have uncommitted modifications
 .TP
index 1f660a1f2a7cc9c34399287357d25309925a3f55..0638170f33f9335f9a30979b0f5cebd4749f9f6c 100644 (file)
@@ -182,4 +182,3 @@ SUPPORTED_BINPKG_FORMATS = ("tar", "rpm")
 _DEPCLEAN_LIB_CHECK_DEFAULT = True
 _ENABLE_REPO_NAME_WARN  = True
 _ENABLE_SET_CONFIG      = True
-_ENABLE_INHERIT_CHECK   = True
index c60db3d02359f1dfdf18e9c949a5d3eedd7bba59..85aa065cb6db3dedd6147a43d4897dd6706a3d59 100644 (file)
@@ -16,7 +16,6 @@ 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."""
@@ -635,29 +634,6 @@ _eclass_info = {
        }
 }
 
-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
-               }
-       }
-
 class EMakeParallelDisabled(PhaseCheck):
        """Check for emake -j1 calls which disable parallelization."""
        repoman_check_name = 'upstream.workaround'
@@ -824,10 +800,39 @@ class PortageInternalVariableAssignment(LineCheck):
                return e
 
 _base_check_classes = (InheritEclass, LineCheck, PhaseCheck)
-_constant_checks = tuple(chain((v() for k, v in globals().items()
-       if isinstance(v, type) and issubclass(v, LineCheck) and v not in _base_check_classes),
-       (InheritEclass(k, **portage._native_kwargs(kwargs))
-       for k, kwargs in _eclass_info.items())))
+_constant_checks = None
+
+def _init(experimental_inherit=False):
+
+       global _constant_checks, _eclass_info
+
+       if not experimental_inherit:
+               # 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
+                       }
+               }
+
+       _constant_checks = tuple(chain((v() for k, v in globals().items()
+               if isinstance(v, type) and issubclass(v, LineCheck) and
+               v not in _base_check_classes),
+               (InheritEclass(k, **portage._native_kwargs(kwargs))
+               for k, kwargs in _eclass_info.items())))
 
 _here_doc_re = re.compile(r'.*\s<<[-]?(\w+)$')
 _ignore_comment_re = re.compile(r'^\s*#')
@@ -835,6 +840,8 @@ _ignore_comment_re = re.compile(r'^\s*#')
 def run_checks(contents, pkg):
        unicode_escape_codec = codecs.lookup('unicode_escape')
        unicode_escape = lambda x: unicode_escape_codec.decode(x)[0]
+       if _constant_checks is None:
+               _init()
        checks = _constant_checks
        here_doc_delim = None
        multiline = None