diff options
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/insane.bbclass | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass index 478240fa57..7fc8f33a98 100644 --- a/meta/classes/insane.bbclass +++ b/meta/classes/insane.bbclass | |||
@@ -35,7 +35,7 @@ ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \ | |||
35 | split-strip packages-list pkgv-undefined var-undefined \ | 35 | split-strip packages-list pkgv-undefined var-undefined \ |
36 | version-going-backwards expanded-d invalid-chars \ | 36 | version-going-backwards expanded-d invalid-chars \ |
37 | license-checksum dev-elf file-rdeps configure-unsafe \ | 37 | license-checksum dev-elf file-rdeps configure-unsafe \ |
38 | configure-gettext perllocalpod \ | 38 | configure-gettext perllocalpod shebang-size \ |
39 | " | 39 | " |
40 | # Add usrmerge QA check based on distro feature | 40 | # Add usrmerge QA check based on distro feature |
41 | ERROR_QA_append = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', ' usrmerge', '', d)}" | 41 | ERROR_QA_append = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', ' usrmerge', '', d)}" |
@@ -83,6 +83,29 @@ def package_qa_add_message(messages, section, new_msg): | |||
83 | else: | 83 | else: |
84 | messages[section] = messages[section] + "\n" + new_msg | 84 | messages[section] = messages[section] + "\n" + new_msg |
85 | 85 | ||
86 | QAPATHTEST[shebang-size] = "package_qa_check_shebang_size" | ||
87 | def package_qa_check_shebang_size(path, name, d, elf, messages): | ||
88 | if os.path.islink(path) or elf: | ||
89 | return | ||
90 | |||
91 | try: | ||
92 | with open(path, 'rb') as f: | ||
93 | stanza = f.readline(130) | ||
94 | except IOError: | ||
95 | return | ||
96 | |||
97 | if stanza.startswith(b'#!'): | ||
98 | #Shebang not found | ||
99 | try: | ||
100 | stanza = stanza.decode("utf-8") | ||
101 | except UnicodeDecodeError: | ||
102 | #If it is not a text file, it is not a script | ||
103 | return | ||
104 | |||
105 | if len(stanza) > 129: | ||
106 | package_qa_add_message(messages, "shebang-size", "%s: %s maximum shebang size exceeded, the maximum size is 128." % (name, package_qa_clean_path(path, d))) | ||
107 | return | ||
108 | |||
86 | QAPATHTEST[libexec] = "package_qa_check_libexec" | 109 | QAPATHTEST[libexec] = "package_qa_check_libexec" |
87 | def package_qa_check_libexec(path,name, d, elf, messages): | 110 | def package_qa_check_libexec(path,name, d, elf, messages): |
88 | 111 | ||