Add EAPI 3-defined variables to the readonly check.
authorMichał Górny <gentoo@mgorny.alt.pl>
Wed, 14 Jul 2010 08:28:12 +0000 (10:28 +0200)
committerZac Medico <zmedico@gentoo.org>
Wed, 14 Jul 2010 08:41:30 +0000 (01:41 -0700)
pym/repoman/checks.py

index 96c7969ad1a70e29d3ec33a9dc1a13de32919339..c60cef0ef04a0092131290dd842adc5ef2432692 100644 (file)
@@ -224,6 +224,13 @@ class EbuildAssignment(LineCheck):
                self.previous_line = line
                return e
 
+class Eapi3EbuildAssignment(EbuildAssignment):
+       """Ensure ebuilds don't assign to readonly EAPI 3-introduced variables."""
+
+       readonly_assignment = re.compile(r'\s*(export\s+)?(ED|EPREFIX|EROOT)=')
+
+       def check_eapi(self, eapi):
+               return eapi not in ('0', '1', '2')
 
 class EbuildNestedDie(LineCheck):
        """Check ebuild for nested die statements (die statements in subshells"""
@@ -500,7 +507,7 @@ class Eapi4GoneVars(LineCheck):
 
 _constant_checks = tuple((c() for c in (
        EbuildHeader, EbuildWhitespace, EbuildBlankLine, EbuildQuote,
-       EbuildAssignment, EbuildUselessDodoc,
+       EbuildAssignment, Eapi3EbuildAssignment, EbuildUselessDodoc,
        EbuildUselessCdS, EbuildNestedDie,
        EbuildPatches, EbuildQuotedA, EapiDefinition,
        IUseUndefined, InheritAutotools,