From 48ad3b8bfa45e4bf2e41ce01573abc478c3ef4c9 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 29 Mar 2008 07:03:05 +0000 Subject: Add a new "ebuild.patches" check for the PATCHES variable that's used by base_src_unpack() from base.eclass. This generates a warning if the variable is not defined as an array, since this is required for white space safety. Thanks to Betelgeuse for the initial patch. (trunk r9587) svn path=/main/branches/2.1.2/; revision=9599 --- bin/repoman | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'bin/repoman') diff --git a/bin/repoman b/bin/repoman index 318a90d84..d9645c258 100755 --- a/bin/repoman +++ b/bin/repoman @@ -160,6 +160,7 @@ qahelp={ "changelog.missing":"Missing ChangeLog files", "ebuild.disjointed":"Ebuilds not added to cvs when the matching digest has been added", "ebuild.notadded":"Ebuilds that exist but have not been added to cvs", + "ebuild.patches":"PATCHES variable should be a bash array to ensure white space safety", "changelog.notadded":"ChangeLogs that exist but have not been added to cvs", "filedir.missing":"Package lacks a files directory", "file.executable":"Ebuilds, digests, metadata.xml, Manifest, and ChangeLog do note need the executable bit", @@ -243,6 +244,7 @@ qawarnings=[ "RESTRICT.invalid", "ebuild.minorsyn", "ebuild.badheader", +"ebuild.patches", "file.size", "java.eclassesnotused", "metadata.missing", @@ -938,7 +940,8 @@ class LineCheck(object): def check(self, num, line): """Run the check on line and return error if there is one""" - pass + if self.re.match(line): + return self.error class EbuildQuote(LineCheck): """Ensure ebuilds have valid quoting around things like D,FILESDIR, etc...""" @@ -1035,6 +1038,12 @@ class EbuildUselessCdS(LineCheck): elif self.method_re.match(line): self.check_next_line = True +class EbuildPatches(LineCheck): + """Ensure ebuilds use bash arrays for PATCHES to ensure white space safety""" + repoman_check_name = 'ebuild.patches' + re = re.compile(r'^\s*PATCHES=[^\(]') + error = 'PATCHES is not a bash array on line: %d' + class EbuildQuotedA(LineCheck): """Ensure ebuilds have no quoting around ${A}""" @@ -1047,8 +1056,9 @@ class EbuildQuotedA(LineCheck): return "Quoted \"${A}\" on line: %d" _constant_checks = tuple((c() for c in ( - EbuildQuote, EbuildUselessDodoc, EbuildUselessCdS, - EbuildNestedDie, EbuildQuotedA))) + EbuildQuote, EbuildUselessDodoc, + EbuildUselessCdS, EbuildNestedDie, + EbuildPatches, EbuildQuotedA))) def run_checks(contents): for num, line in enumerate(contents): -- cgit v1.2.3-1-g7c22