1 |
Author: zmedico |
2 |
Date: 2008-12-29 19:39:46 +0000 (Mon, 29 Dec 2008) |
3 |
New Revision: 12365 |
4 |
|
5 |
Modified: |
6 |
main/trunk/bin/repoman |
7 |
main/trunk/man/repoman.1 |
8 |
Log: |
9 |
Bug #253002 - Add a new variable.invalidchar check for metadata variables that |
10 |
contain characters that are not part of the ASCII character set. |
11 |
|
12 |
|
13 |
Modified: main/trunk/bin/repoman |
14 |
=================================================================== |
15 |
--- main/trunk/bin/repoman 2008-12-29 03:05:07 UTC (rev 12364) |
16 |
+++ main/trunk/bin/repoman 2008-12-29 19:39:46 UTC (rev 12365) |
17 |
@@ -298,6 +298,7 @@ |
18 |
"ebuild.syntax":"Error generating cache entry for ebuild; typically caused by ebuild syntax error or digest verification failure", |
19 |
"ebuild.output":"A simple sourcing of the ebuild produces output; this breaks ebuild policy.", |
20 |
"ebuild.nesteddie":"Placing 'die' inside ( ) prints an error, but doesn't stop the ebuild.", |
21 |
+ "variable.invalidchar":"A variable contains an invalid character that is not part of the ASCII character set", |
22 |
"variable.readonly":"Assigning a readonly variable", |
23 |
"LIVEVCS.stable":"This ebuild is a live checkout from a VCS but has stable keywords.", |
24 |
"IUSE.invalid":"This ebuild has a variable in IUSE that is not in the use.desc or use.local.desc file", |
25 |
@@ -358,6 +359,8 @@ |
26 |
"LIVEVCS.stable" |
27 |
)) |
28 |
|
29 |
+non_ascii_re = re.compile(r'[^\x00-\x7f]') |
30 |
+ |
31 |
missingvars=["KEYWORDS","LICENSE","DESCRIPTION","HOMEPAGE","SLOT"] |
32 |
allvars = set(x for x in portage.auxdbkeys if not x.startswith("UNUSED_")) |
33 |
allvars.discard("CDEPEND") |
34 |
@@ -1100,6 +1103,17 @@ |
35 |
inherited = pkg.inherited |
36 |
live_ebuild = live_eclasses.intersection(inherited) |
37 |
|
38 |
+ for k, v in myaux.iteritems(): |
39 |
+ if not isinstance(v, basestring): |
40 |
+ continue |
41 |
+ m = non_ascii_re.search(v) |
42 |
+ if m is not None: |
43 |
+ stats["variable.invalidchar"] += 1 |
44 |
+ fails["variable.invalidchar"].append( |
45 |
+ ("%s: %s variable contains non-ASCII " + \ |
46 |
+ "character at position %s") % \ |
47 |
+ (relative_path, k, m.start() + 1)) |
48 |
+ |
49 |
if not src_uri_error: |
50 |
# Check that URIs don't reference a server from thirdpartymirrors. |
51 |
for uri in portage.flatten(portage.dep.use_reduce( |
52 |
|
53 |
Modified: main/trunk/man/repoman.1 |
54 |
=================================================================== |
55 |
--- main/trunk/man/repoman.1 2008-12-29 03:05:07 UTC (rev 12364) |
56 |
+++ main/trunk/man/repoman.1 2008-12-29 19:39:46 UTC (rev 12365) |
57 |
@@ -270,6 +270,10 @@ |
58 |
.B usage.obsolete |
59 |
The ebuild makes use of an obsolete construct |
60 |
.TP |
61 |
+.B variable.invalidchar |
62 |
+A variable contains an invalid character that is not part of the ASCII |
63 |
+character set. |
64 |
+.TP |
65 |
.B variable.readonly |
66 |
Assigning a readonly variable |
67 |
.TP |