From: Zac Medico Date: Sat, 29 Mar 2008 07:03:05 +0000 (-0000) Subject: Add a new "ebuild.patches" check for the PATCHES variable that's used by X-Git-Tag: v2.1.5~302 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=48ad3b8bfa45e4bf2e41ce01573abc478c3ef4c9;p=portage.git 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 --- 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): diff --git a/man/repoman.1 b/man/repoman.1 index 552640df4..a34af6986 100644 --- a/man/repoman.1 +++ b/man/repoman.1 @@ -237,6 +237,9 @@ Ebuilds that exist but have not been added to cvs .B ebuild.output A simple sourcing of the ebuild produces output; this breaks ebuild policy. .TP +.B ebuild.patches +PATCHES variable should be a bash array to ensure white space safety +.TP .B ebuild.syntax Error generating cache entry for ebuild; typically caused by ebuild syntax error or digest verification failure.