repoman: Check if the prefix.eclass is inherited if eprefixify is used. Thanks to...
authorSebastian Luther <SebastianLuther@gmx.de>
Mon, 26 Jul 2010 19:16:58 +0000 (21:16 +0200)
committerZac Medico <zmedico@gentoo.org>
Thu, 5 Aug 2010 04:12:50 +0000 (21:12 -0700)
bin/repoman
man/repoman.1
pym/repoman/checks.py
pym/repoman/errors.py

index 53b9ad0cdf5e11d14c8b9d2243203f23146578c8..fc184e2f1443ba030061810497be0d89538868c7 100755 (executable)
@@ -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",
index 58165bb7d8b3a1dc7a4c9608a8e0294c1b1a5f3f..ce9d0ba50e256ab0666f64057754a84f37ae0a48 100644 (file)
@@ -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
index d403044b0c962c4f3fd9456c23663779cb789961..5588fa867b4f519cadeb739831d97cc59f4230ff 100644 (file)
@@ -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,
index 97bd2829faabf9d56a1af549d4435ca4fb937835..8a28d4fd7b7aad26439539d695681d3ab0f2b042 100644 (file)
@@ -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"