diff options
author | Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> | 2015-08-17 07:10:12 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-09-03 12:43:22 +0100 |
commit | 636d2477b2b9c4dcd9b8b2c9f2bf32701d9a1058 (patch) | |
tree | ddb0bcfcecf52850b2d75ddd720ecd4770a87f55 /meta/classes/insane.bbclass | |
parent | 275fc5f2209c58a666bd031488d8a12da28b257f (diff) | |
download | poky-636d2477b2b9c4dcd9b8b2c9f2bf32701d9a1058.tar.gz |
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'.
(From OE-Core rev: f006296c88bacd3ee18559dedf3a1ff313cde8a4)
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.bbclass | 24 |
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 \ | |||
36 | ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \ | 37 | ERROR_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 | ||
42 | ALL_QA = "${WARN_QA} ${ERROR_QA}" | 43 | ALL_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 | ||
951 | def 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 |
951 | python do_package_qa () { | 970 | python 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 | ||