summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-03-29 03:29:24 +0000
committerZac Medico <zmedico@gentoo.org>2008-03-29 03:29:24 +0000
commitbb93af369a622d63cbfd7746f51e014ce4952215 (patch)
tree5958c2b54f9465aa9a6972895b53d9bd2e377f84
parentDon't trigger the 'java.eclassesnotused' on blocker atoms. (diff)
downloadportage-multirepo-bb93af369a622d63cbfd7746f51e014ce4952215.tar.gz
portage-multirepo-bb93af369a622d63cbfd7746f51e014ce4952215.tar.bz2
portage-multirepo-bb93af369a622d63cbfd7746f51e014ce4952215.zip
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. svn path=/main/trunk/; revision=9587
-rwxr-xr-xbin/repoman2
-rw-r--r--man/repoman.13
-rw-r--r--pym/repoman/checks.py12
-rw-r--r--pym/repoman/errors.py1
4 files changed, 15 insertions, 3 deletions
diff --git a/bin/repoman b/bin/repoman
index 1ebf71d5..4b6d4b52 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -244,6 +244,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",
@@ -326,6 +327,7 @@ qawarnings=[
"RESTRICT.invalid",
"ebuild.minorsyn",
"ebuild.badheader",
+"ebuild.patches",
"file.size",
"java.eclassesnotused",
"metadata.missing",
diff --git a/man/repoman.1 b/man/repoman.1
index 649356ac..b8ab6d9b 100644
--- a/man/repoman.1
+++ b/man/repoman.1
@@ -219,6 +219,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.
diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py
index aa5bf184..bc1c2911 100644
--- a/pym/repoman/checks.py
+++ b/pym/repoman/checks.py
@@ -18,8 +18,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 EbuildHeader(LineCheck):
"""Ensure ebuilds have proper headers
@@ -191,6 +191,11 @@ 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 = errors.PATCHES_ERROR
class EbuildQuotedA(LineCheck):
"""Ensure ebuilds have no quoting around ${A}"""
@@ -206,7 +211,8 @@ class EbuildQuotedA(LineCheck):
_constant_checks = tuple((c() for c in (
EbuildWhitespace, EbuildQuote,
EbuildAssignment, EbuildUselessDodoc,
- EbuildUselessCdS, EbuildNestedDie, EbuildQuotedA)))
+ EbuildUselessCdS, EbuildNestedDie,
+ EbuildPatches, EbuildQuotedA)))
def run_checks(contents, st_mtime):
checks = list(_constant_checks)
diff --git a/pym/repoman/errors.py b/pym/repoman/errors.py
index d1aad1d8..90fa8382 100644
--- a/pym/repoman/errors.py
+++ b/pym/repoman/errors.py
@@ -11,4 +11,5 @@ TRAILING_WHITESPACE_ERROR = 'Trailing whitespace error on line: %d'
READONLY_ASSIGNMENT_ERROR = 'Ebuild contains assignment to read-only variable on line: %d'
MISSING_QUOTES_ERROR = 'Unquoted Variable on line: %d'
NESTED_DIE_ERROR = 'Ebuild calls die in a subshell on line: %d'
+PATCHES_ERROR = 'PATCHES is not a bash array on line: %d'
REDUNDANT_CD_S_ERROR = 'Ebuild has redundant cd ${S} statement on line: %d'