From b583812101f1156c553385effcd9dbee0b751087 Mon Sep 17 00:00:00 2001 From: Sebastian Luther Date: Mon, 26 Jul 2010 21:16:58 +0200 Subject: [PATCH] repoman: Check if the prefix.eclass is inherited if eprefixify is used. Thanks to Jeremy Olexa (darkside) for the initial patch. --- bin/repoman | 1 + man/repoman.1 | 3 +++ pym/repoman/checks.py | 20 +++++++++++++++++++- pym/repoman/errors.py | 1 + 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/bin/repoman b/bin/repoman index 53b9ad0cd..fc184e2f1 100755 --- a/bin/repoman +++ b/bin/repoman @@ -339,6 +339,7 @@ qahelp={ "ebuild.majorsyn":"This ebuild has a major syntax error that may cause the ebuild to fail partially or fully", "ebuild.minorsyn":"This ebuild has a minor syntax error that contravenes gentoo coding style", "ebuild.badheader":"This ebuild has a malformed header", + "eprefixify.defined":"The ebuild uses eprefixify, but does not inherit the prefix eclass", "manifest.bad":"Manifest has missing or incorrect digests", "metadata.missing":"Missing metadata.xml files", "metadata.bad":"Bad metadata.xml files", diff --git a/man/repoman.1 b/man/repoman.1 index 58165bb7d..ce9d0ba50 100644 --- a/man/repoman.1 +++ b/man/repoman.1 @@ -282,6 +282,9 @@ PATCHES variable should be a bash array to ensure white space safety Error generating cache entry for ebuild; typically caused by ebuild syntax error or digest verification failure. .TP +.B eprefixify.defined +The ebuild uses eprefixify, but does not inherit the prefix eclass +.TP .B file.UTF8 File is not UTF8 compliant .TP diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py index d403044b0..5588fa867 100644 --- a/pym/repoman/checks.py +++ b/pym/repoman/checks.py @@ -306,6 +306,24 @@ class EbuildQuotedA(LineCheck): if match: return "Quoted \"${A}\" on line: %d" +class EprefixifyDefined(LineCheck): + """ Check that prefix.eclass is inherited if needed""" + + repoman_check_name = 'eprefixify.defined' + + _eprefixify_re = re.compile(r'\beprefixify\b') + _inherit_prefix_re = re.compile(r'^\s*inherit\s(.*\s)?prefix\b') + + def new(self, pkg): + self._prefix_inherited = False + + def check(self, num, line): + if self._eprefixify_re.search(line) is not None: + if not self._prefix_inherited: + return errors.EPREFIXIFY_MISSING_INHERIT + elif self._inherit_prefix_re.search(line) is not None: + self._prefix_inherited = True + class InheritAutotools(LineCheck): """ Make sure appropriate functions are called in @@ -493,7 +511,7 @@ _constant_checks = tuple((c() for c in ( EbuildHeader, EbuildWhitespace, EbuildBlankLine, EbuildQuote, EbuildAssignment, Eapi3EbuildAssignment, EbuildUselessDodoc, EbuildUselessCdS, EbuildNestedDie, - EbuildPatches, EbuildQuotedA, EapiDefinition, + EbuildPatches, EbuildQuotedA, EapiDefinition, EprefixifyDefined, IUseUndefined, InheritAutotools, EMakeParallelDisabled, EMakeParallelDisabledViaMAKEOPTS, NoAsNeeded, DeprecatedBindnowFlags, SrcUnpackPatches, WantAutoDefaultValue, diff --git a/pym/repoman/errors.py b/pym/repoman/errors.py index 97bd2829f..8a28d4fd7 100644 --- a/pym/repoman/errors.py +++ b/pym/repoman/errors.py @@ -19,3 +19,4 @@ EAPI_DEFINED_AFTER_INHERIT = 'EAPI defined after inherit on line: %d' NO_AS_NEEDED = 'Upstream asneeded linking bug (no-as-needed on line: %d)' PRESERVE_OLD_LIB = 'Upstream ABI change workaround on line: %d' BUILT_WITH_USE = 'built_with_use on line: %d' +EPREFIXIFY_MISSING_INHERIT = "prefix.eclass is not inherited, but eprefixify is used on line: %d" -- 2.26.2