summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 @@
11# -Check if packages contains .debug directories or .so files 11# -Check if packages contains .debug directories or .so files
12# where they should be in -dev or -dbg 12# where they should be in -dev or -dbg
13# -Check if config.log contains traces to broken autoconf tests 13# -Check if config.log contains traces to broken autoconf tests
14# -Check invalid characters (non-utf8) on some package metadata
14# -Ensure that binaries in base_[bindir|sbindir|libdir] do not link 15# -Ensure that binaries in base_[bindir|sbindir|libdir] do not link
15# into exec_prefix 16# into exec_prefix
16# -Check that scripts in base_[bindir|sbindir|libdir] do not reference 17# -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 \
36ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \ 37ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
37 perms dep-cmp pkgvarcheck perm-config perm-line perm-link \ 38 perms dep-cmp pkgvarcheck perm-config perm-line perm-link \
38 split-strip packages-list pkgv-undefined var-undefined \ 39 split-strip packages-list pkgv-undefined var-undefined \
39 version-going-backwards expanded-d \ 40 version-going-backwards expanded-d invalid-chars \
40 " 41 "
41 42
42ALL_QA = "${WARN_QA} ${ERROR_QA}" 43ALL_QA = "${WARN_QA} ${ERROR_QA}"
@@ -947,6 +948,24 @@ def package_qa_check_expanded_d(path,name,d,elf,messages):
947 sane = False 948 sane = False
948 return sane 949 return sane
949 950
951def package_qa_check_encoding(keys, encode, d):
952 def check_encoding(key,enc):
953 sane = True
954 value = d.getVar(key, True)
955 if value:
956 try:
957 s = unicode(value, enc)
958 except UnicodeDecodeError as e:
959 error_msg = "%s has non %s characters" % (key,enc)
960 sane = False
961 package_qa_handle_error("invalid-chars", error_msg, d)
962 return sane
963
964 for key in keys:
965 sane = check_encoding(key, encode)
966 if not sane:
967 break
968
950# The PACKAGE FUNC to scan each package 969# The PACKAGE FUNC to scan each package
951python do_package_qa () { 970python do_package_qa () {
952 import subprocess 971 import subprocess
@@ -956,6 +975,9 @@ python do_package_qa () {
956 975
957 bb.build.exec_func("read_subpackage_metadata", d) 976 bb.build.exec_func("read_subpackage_metadata", d)
958 977
978 # Check non UTF-8 characters on recipe's metadata
979 package_qa_check_encoding(['DESCRIPTION', 'SUMMARY', 'LICENSE', 'SECTION'], 'utf-8', d)
980
959 logdir = d.getVar('T', True) 981 logdir = d.getVar('T', True)
960 pkg = d.getVar('PN', True) 982 pkg = d.getVar('PN', True)
961 983