aboutsummaryrefslogtreecommitdiffstats
path: root/meta/classes/insane.bbclass
diff options
context:
space:
mode:
authorLeonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>2015-08-17 07:10:12 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-02 23:46:07 +0100
commitf006296c88bacd3ee18559dedf3a1ff313cde8a4 (patch)
tree2db447572fd6a2b1a2dfd86c88c20a0425d94ae3 /meta/classes/insane.bbclass
parent3d68d24d6da70606c7dd68eaa6442c84f53941d7 (diff)
downloadopenembedded-core-contrib-f006296c88bacd3ee18559dedf3a1ff313cde8a4.tar.gz
openembedded-core-contrib-f006296c88bacd3ee18559dedf3a1ff313cde8a4.tar.bz2
openembedded-core-contrib-f006296c88bacd3ee18559dedf3a1ff313cde8a4.zip
insane.bbclass: Check for invalid characters (non UTF8) on recipe metadata
Check if invalid characters are present on recipe's metadata. Fields taken into account are: 'DESCRIPTION', 'SUMMARY', 'LICENSE' and 'SECTION'. Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/insane.bbclass')
-rw-r--r--meta/classes/insane.bbclass24
1 files changed, 23 insertions, 1 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index d9befc4900..61cd42bf34 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -11,6 +11,7 @@
# -Check if packages contains .debug directories or .so files
# where they should be in -dev or -dbg
# -Check if config.log contains traces to broken autoconf tests
+# -Check invalid characters (non-utf8) on some package metadata
# -Ensure that binaries in base_[bindir|sbindir|libdir] do not link
# into exec_prefix
# -Check that scripts in base_[bindir|sbindir|libdir] do not reference
@@ -36,7 +37,7 @@ WARN_QA ?= "ldflags useless-rpaths rpaths staticdev libdir xorg-driver-abi \
ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
perms dep-cmp pkgvarcheck perm-config perm-line perm-link \
split-strip packages-list pkgv-undefined var-undefined \
- version-going-backwards expanded-d \
+ version-going-backwards expanded-d invalid-chars \
"
ALL_QA = "${WARN_QA} ${ERROR_QA}"
@@ -947,6 +948,24 @@ def package_qa_check_expanded_d(path,name,d,elf,messages):
sane = False
return sane
+def package_qa_check_encoding(keys, encode, d):
+ def check_encoding(key,enc):
+ sane = True
+ value = d.getVar(key, True)
+ if value:
+ try:
+ s = unicode(value, enc)
+ except UnicodeDecodeError as e:
+ error_msg = "%s has non %s characters" % (key,enc)
+ sane = False
+ package_qa_handle_error("invalid-chars", error_msg, d)
+ return sane
+
+ for key in keys:
+ sane = check_encoding(key, encode)
+ if not sane:
+ break
+
# The PACKAGE FUNC to scan each package
python do_package_qa () {
import subprocess
@@ -956,6 +975,9 @@ python do_package_qa () {
bb.build.exec_func("read_subpackage_metadata", d)
+ # Check non UTF-8 characters on recipe's metadata
+ package_qa_check_encoding(['DESCRIPTION', 'SUMMARY', 'LICENSE', 'SECTION'], 'utf-8', d)
+
logdir = d.getVar('T', True)
pkg = d.getVar('PN', True)