From a0adfb21ec64da8013265adfb2ed9ffb18e6a2b4 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 8 Oct 2012 07:34:09 -0700 Subject: repoman: check EXTRA_ECONF/EMAKE, bug #437348 --- bin/repoman | 2 +- man/repoman.1 | 2 +- pym/repoman/checks.py | 15 ++++++++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/bin/repoman b/bin/repoman index ff3f8f765..8dd85d011 100755 --- a/bin/repoman +++ b/bin/repoman @@ -372,7 +372,7 @@ qahelp={ "metadata.missing":"Missing metadata.xml files", "metadata.bad":"Bad metadata.xml files", "metadata.warning":"Warnings in metadata.xml files", - "portage.internal":"The ebuild uses an internal Portage function", + "portage.internal":"The ebuild uses an internal Portage function or variable", "virtual.oldstyle":"The ebuild PROVIDEs an old-style virtual (see GLEP 37)", "virtual.suspect":"Ebuild contains a package that usually should be pulled via virtual/, not directly.", "usage.obsolete":"The ebuild makes use of an obsolete construct", diff --git a/man/repoman.1 b/man/repoman.1 index 8f8ad65a4..6dd75e87d 100644 --- a/man/repoman.1 +++ b/man/repoman.1 @@ -320,7 +320,7 @@ Missing metadata.xml files Warnings in metadata.xml files .TP .B portage.internal -The ebuild uses an internal Portage function +The ebuild uses an internal Portage function or variable .TP .B upstream.workaround The ebuild works around an upstream bug, an upstream bug should be filed and diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py index 7e3d4b875..b47028ca7 100644 --- a/pym/repoman/checks.py +++ b/pym/repoman/checks.py @@ -785,6 +785,19 @@ class PortageInternal(LineCheck): if m is not None: return ("'%s'" % m.group(2)) + " called on line: %d" +class PortageInternalVariableAssignment(LineCheck): + + repoman_check_name = 'portage.internal' + internal_assignment = re.compile(r'\s*(export\s+)?(EXTRA_ECONF|EXTRA_EMAKE)\+?=') + + def check(self, num, line): + match = self.internal_assignment.match(line) + e = None + if match is not None: + e = 'Assignment to variable %s' % match.group(2) + e += ' on line: %d' + return e + _constant_checks = tuple(chain((c() for c in ( EbuildHeader, EbuildWhitespace, EbuildBlankLine, EbuildQuote, EbuildAssignment, Eapi3EbuildAssignment, EbuildUselessDodoc, @@ -796,7 +809,7 @@ _constant_checks = tuple(chain((c() for c in ( SrcCompileEconf, Eapi3DeprecatedFuncs, NoOffsetWithHelpers, Eapi4IncompatibleFuncs, Eapi4GoneVars, BuiltWithUse, PreserveOldLib, SandboxAddpredict, PortageInternal, - DeprecatedUseq, DeprecatedHasq)), + PortageInternalVariableAssignment, DeprecatedUseq, DeprecatedHasq)), (InheritEclass(k, **kwargs) for k, kwargs in _eclass_info.items()))) _here_doc_re = re.compile(r'.*\s<<[-]?(\w+)$') -- cgit v1.2.3-1-g7c22