summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-12-29 19:39:46 +0000
committerZac Medico <zmedico@gentoo.org>2008-12-29 19:39:46 +0000
commit505ff1f2f50be1caef5411673243aa7a743f38e8 (patch)
tree0912696e6b790d2b256adb542621e4828207d70c
parentb7cd3e67423d50c8e4204148ce7d65daddf52b72 (diff)
downloadportage-505ff1f2f50be1caef5411673243aa7a743f38e8.tar.gz
portage-505ff1f2f50be1caef5411673243aa7a743f38e8.tar.bz2
portage-505ff1f2f50be1caef5411673243aa7a743f38e8.zip
Bug #253002 - Add a new variable.invalidchar check for metadata variables that
contain characters that are not part of the ASCII character set. svn path=/main/trunk/; revision=12365
-rwxr-xr-xbin/repoman14
-rw-r--r--man/repoman.14
2 files changed, 18 insertions, 0 deletions
diff --git a/bin/repoman b/bin/repoman
index 441c76285..b2ae0a81b 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -298,6 +298,7 @@ qahelp={
"ebuild.syntax":"Error generating cache entry for ebuild; typically caused by ebuild syntax error or digest verification failure",
"ebuild.output":"A simple sourcing of the ebuild produces output; this breaks ebuild policy.",
"ebuild.nesteddie":"Placing 'die' inside ( ) prints an error, but doesn't stop the ebuild.",
+ "variable.invalidchar":"A variable contains an invalid character that is not part of the ASCII character set",
"variable.readonly":"Assigning a readonly variable",
"LIVEVCS.stable":"This ebuild is a live checkout from a VCS but has stable keywords.",
"IUSE.invalid":"This ebuild has a variable in IUSE that is not in the use.desc or use.local.desc file",
@@ -358,6 +359,8 @@ qawarnings = set((
"LIVEVCS.stable"
))
+non_ascii_re = re.compile(r'[^\x00-\x7f]')
+
missingvars=["KEYWORDS","LICENSE","DESCRIPTION","HOMEPAGE","SLOT"]
allvars = set(x for x in portage.auxdbkeys if not x.startswith("UNUSED_"))
allvars.discard("CDEPEND")
@@ -1100,6 +1103,17 @@ for x in scanlist:
inherited = pkg.inherited
live_ebuild = live_eclasses.intersection(inherited)
+ for k, v in myaux.iteritems():
+ if not isinstance(v, basestring):
+ continue
+ m = non_ascii_re.search(v)
+ if m is not None:
+ stats["variable.invalidchar"] += 1
+ fails["variable.invalidchar"].append(
+ ("%s: %s variable contains non-ASCII " + \
+ "character at position %s") % \
+ (relative_path, k, m.start() + 1))
+
if not src_uri_error:
# Check that URIs don't reference a server from thirdpartymirrors.
for uri in portage.flatten(portage.dep.use_reduce(
diff --git a/man/repoman.1 b/man/repoman.1
index dde0d15d2..0380adfd6 100644
--- a/man/repoman.1
+++ b/man/repoman.1
@@ -270,6 +270,10 @@ tracked in bugs.gentoo.org
.B usage.obsolete
The ebuild makes use of an obsolete construct
.TP
+.B variable.invalidchar
+A variable contains an invalid character that is not part of the ASCII
+character set.
+.TP
.B variable.readonly
Assigning a readonly variable
.TP