1 |
Author: zmedico |
2 |
Date: 2008-03-29 07:03:05 +0000 (Sat, 29 Mar 2008) |
3 |
New Revision: 9599 |
4 |
|
5 |
Modified: |
6 |
main/branches/2.1.2/bin/repoman |
7 |
main/branches/2.1.2/man/repoman.1 |
8 |
Log: |
9 |
Add a new "ebuild.patches" check for the PATCHES variable that's used by |
10 |
base_src_unpack() from base.eclass. This generates a warning if the variable |
11 |
is not defined as an array, since this is required for white space safety. |
12 |
Thanks to Betelgeuse for the initial patch. (trunk r9587) |
13 |
|
14 |
|
15 |
Modified: main/branches/2.1.2/bin/repoman |
16 |
=================================================================== |
17 |
--- main/branches/2.1.2/bin/repoman 2008-03-29 06:56:27 UTC (rev 9598) |
18 |
+++ main/branches/2.1.2/bin/repoman 2008-03-29 07:03:05 UTC (rev 9599) |
19 |
@@ -160,6 +160,7 @@ |
20 |
"changelog.missing":"Missing ChangeLog files", |
21 |
"ebuild.disjointed":"Ebuilds not added to cvs when the matching digest has been added", |
22 |
"ebuild.notadded":"Ebuilds that exist but have not been added to cvs", |
23 |
+ "ebuild.patches":"PATCHES variable should be a bash array to ensure white space safety", |
24 |
"changelog.notadded":"ChangeLogs that exist but have not been added to cvs", |
25 |
"filedir.missing":"Package lacks a files directory", |
26 |
"file.executable":"Ebuilds, digests, metadata.xml, Manifest, and ChangeLog do note need the executable bit", |
27 |
@@ -243,6 +244,7 @@ |
28 |
"RESTRICT.invalid", |
29 |
"ebuild.minorsyn", |
30 |
"ebuild.badheader", |
31 |
+"ebuild.patches", |
32 |
"file.size", |
33 |
"java.eclassesnotused", |
34 |
"metadata.missing", |
35 |
@@ -938,7 +940,8 @@ |
36 |
|
37 |
def check(self, num, line): |
38 |
"""Run the check on line and return error if there is one""" |
39 |
- pass |
40 |
+ if self.re.match(line): |
41 |
+ return self.error |
42 |
|
43 |
class EbuildQuote(LineCheck): |
44 |
"""Ensure ebuilds have valid quoting around things like D,FILESDIR, etc...""" |
45 |
@@ -1035,6 +1038,12 @@ |
46 |
elif self.method_re.match(line): |
47 |
self.check_next_line = True |
48 |
|
49 |
+class EbuildPatches(LineCheck): |
50 |
+ """Ensure ebuilds use bash arrays for PATCHES to ensure white space safety""" |
51 |
+ repoman_check_name = 'ebuild.patches' |
52 |
+ re = re.compile(r'^\s*PATCHES=[^\(]') |
53 |
+ error = 'PATCHES is not a bash array on line: %d' |
54 |
+ |
55 |
class EbuildQuotedA(LineCheck): |
56 |
"""Ensure ebuilds have no quoting around ${A}""" |
57 |
|
58 |
@@ -1047,8 +1056,9 @@ |
59 |
return "Quoted \"${A}\" on line: %d" |
60 |
|
61 |
_constant_checks = tuple((c() for c in ( |
62 |
- EbuildQuote, EbuildUselessDodoc, EbuildUselessCdS, |
63 |
- EbuildNestedDie, EbuildQuotedA))) |
64 |
+ EbuildQuote, EbuildUselessDodoc, |
65 |
+ EbuildUselessCdS, EbuildNestedDie, |
66 |
+ EbuildPatches, EbuildQuotedA))) |
67 |
|
68 |
def run_checks(contents): |
69 |
for num, line in enumerate(contents): |
70 |
|
71 |
Modified: main/branches/2.1.2/man/repoman.1 |
72 |
=================================================================== |
73 |
--- main/branches/2.1.2/man/repoman.1 2008-03-29 06:56:27 UTC (rev 9598) |
74 |
+++ main/branches/2.1.2/man/repoman.1 2008-03-29 07:03:05 UTC (rev 9599) |
75 |
@@ -237,6 +237,9 @@ |
76 |
.B ebuild.output |
77 |
A simple sourcing of the ebuild produces output; this breaks ebuild policy. |
78 |
.TP |
79 |
+.B ebuild.patches |
80 |
+PATCHES variable should be a bash array to ensure white space safety |
81 |
+.TP |
82 |
.B ebuild.syntax |
83 |
Error generating cache entry for ebuild; typically caused by ebuild syntax error |
84 |
or digest verification failure. |
85 |
|
86 |
-- |
87 |
gentoo-commits@l.g.o mailing list |