diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-04-30 07:26:00 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-04-30 07:26:00 +0000 |
commit | e51e89fba425d03d653fc80b0e9f4eca9050118f (patch) | |
tree | 509f01b99240b67f7eef87c6b6a5e6c3666fdf98 | |
parent | Add dohard and doset helper which die for EAPI 3. TODO: Make the die (diff) | |
download | portage-e51e89fba425d03d653fc80b0e9f4eca9050118f.tar.gz portage-e51e89fba425d03d653fc80b0e9f4eca9050118f.tar.bz2 portage-e51e89fba425d03d653fc80b0e9f4eca9050118f.zip |
Add a new EAPI.definition check for cases in which EAPI is defined after an
inherit call. Thanks to Markus Meier <maekke@g.o> for the initial patch.
(trunk r13401)
svn path=/main/branches/2.1.6/; revision=13542
-rwxr-xr-x | bin/repoman | 1 | ||||
-rw-r--r-- | man/repoman.1 | 3 | ||||
-rw-r--r-- | pym/repoman/checks.py | 19 | ||||
-rw-r--r-- | pym/repoman/errors.py | 1 |
4 files changed, 23 insertions, 1 deletions
diff --git a/bin/repoman b/bin/repoman index 8fdbea79d..1de0ecd4e 100755 --- a/bin/repoman +++ b/bin/repoman @@ -266,6 +266,7 @@ qahelp={ "LICENSE.missing":"Ebuilds that have a missing or empty LICENSE variable", "DESCRIPTION.missing":"Ebuilds that have a missing or empty DESCRIPTION variable", "DESCRIPTION.toolong":"DESCRIPTION is over %d characters" % max_desc_len, + "EAPI.definition":"EAPI is defined after an inherit call (must be defined before)", "EAPI.incompatible":"Ebuilds that use features that are only available with a different EAPI", "EAPI.unsupported":"Ebuilds that have an unsupported EAPI version (you must upgrade portage)", "SLOT.missing":"Ebuilds that have a missing or empty SLOT variable", diff --git a/man/repoman.1 b/man/repoman.1 index ddace7e3e..a3d538aa8 100644 --- a/man/repoman.1 +++ b/man/repoman.1 @@ -105,6 +105,9 @@ Syntax error in DEPEND (usually an extra/missing space/parenthesis) .B DESCRIPTION.missing Ebuilds that have a missing or empty DESCRIPTION variable .TP +.B EAPI.definition +EAPI is defined after an inherit call (must be defined before) +.TP .B EAPI.incompatible Ebuilds that use features that are only available with a different EAPI .TP diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py index 458812057..f1dce8b89 100644 --- a/pym/repoman/checks.py +++ b/pym/repoman/checks.py @@ -213,6 +213,23 @@ class EbuildUselessCdS(LineCheck): elif self.method_re.match(line): self.check_next_line = True +class EapiDefinition(LineCheck): + """ Check that EAPI is defined before inherits""" + repoman_check_name = 'EAPI.definition' + + eapi_re = re.compile(r'^EAPI=') + inherit_re = re.compile(r'^\s*inherit\s') + + def new(self, pkg): + self.inherit_line = None + + def check(self, num, line): + if self.eapi_re.match(line) is not None: + if self.inherit_line is not None: + return errors.EAPI_DEFINED_AFTER_INHERIT + elif self.inherit_re.match(line) is not None: + self.inherit_line = line + class EbuildPatches(LineCheck): """Ensure ebuilds use bash arrays for PATCHES to ensure white space safety""" repoman_check_name = 'ebuild.patches' @@ -349,7 +366,7 @@ _constant_checks = tuple((c() for c in ( EbuildHeader, EbuildWhitespace, EbuildQuote, EbuildAssignment, EbuildUselessDodoc, EbuildUselessCdS, EbuildNestedDie, - EbuildPatches, EbuildQuotedA, + EbuildPatches, EbuildQuotedA, EapiDefinition, IUseUndefined, ImplicitRuntimeDeps, InheritAutotools, EMakeParallelDisabled, EMakeParallelDisabledViaMAKEOPTS, DeprecatedBindnowFlags, WantAutoDefaultValue))) diff --git a/pym/repoman/errors.py b/pym/repoman/errors.py index 2e13e0d67..bab2faca7 100644 --- a/pym/repoman/errors.py +++ b/pym/repoman/errors.py @@ -16,3 +16,4 @@ REDUNDANT_CD_S_ERROR = 'Ebuild has redundant cd ${S} statement on line: %d' EMAKE_PARALLEL_DISABLED = 'Upstream parallel compilation bug (ebuild calls emake -j1 on line: %d)' EMAKE_PARALLEL_DISABLED_VIA_MAKEOPTS = 'Upstream parallel compilation bug (MAKEOPTS=-j1 on line: %d)' DEPRECATED_BINDNOW_FLAGS = 'Deprecated bindnow-flags call on line: %d' +EAPI_DEFINED_AFTER_INHERIT = 'EAPI defined after inherit on line: %d' |