diff options
author | Radu Moisan <radu.moisan@intel.com> | 2012-09-19 12:32:39 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-09-21 11:17:47 +0100 |
commit | 65d1eb7788870b3e318902c827097183f2dddafc (patch) | |
tree | 7080eca81b65fc6761461877e632e124b3b06ce7 /meta/classes | |
parent | 2c9c9117739e6b9959f37b83a44a66c352d40bfe (diff) | |
download | poky-65d1eb7788870b3e318902c827097183f2dddafc.tar.gz |
insane.bbclass: add library dir sanity check
Check in ${PKGD} for libraries in wrong locations.
Trigger a warning if so.
Eg. Catch recipe installing /lib/bar.so when ${base_libdir}="lib32"
or installing in /usr/lib64 when ${libdir}="/usr/lib"
[Yocto #2038]
(From OE-Core rev: 534fa3a55de19f249583207aaeec58fec8154a1d)
Signed-off-by: Radu Moisan <radu.moisan@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/insane.bbclass | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass index e74eb3f3f6..425e93a8fc 100644 --- a/meta/classes/insane.bbclass +++ b/meta/classes/insane.bbclass | |||
@@ -113,7 +113,7 @@ def package_qa_get_machine_dict(): | |||
113 | 113 | ||
114 | 114 | ||
115 | # Currently not being used by default "desktop" | 115 | # Currently not being used by default "desktop" |
116 | WARN_QA ?= "ldflags useless-rpaths rpaths unsafe-references-in-binaries unsafe-references-in-scripts staticdev" | 116 | WARN_QA ?= "ldflags useless-rpaths rpaths unsafe-references-in-binaries unsafe-references-in-scripts staticdev libdir" |
117 | ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch la2 pkgconfig la perms" | 117 | ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch la2 pkgconfig la perms" |
118 | 118 | ||
119 | def package_qa_clean_path(path,d): | 119 | def package_qa_clean_path(path,d): |
@@ -212,6 +212,40 @@ def package_qa_check_staticdev(path, name, d, elf, messages): | |||
212 | messages.append("non -staticdev package contains static .a library: %s path '%s'" % \ | 212 | messages.append("non -staticdev package contains static .a library: %s path '%s'" % \ |
213 | (name, package_qa_clean_path(path,d))) | 213 | (name, package_qa_clean_path(path,d))) |
214 | 214 | ||
215 | def package_qa_check_libdir(d): | ||
216 | """ | ||
217 | Check for wrong library installation paths. For instance, catch | ||
218 | recipes installing /lib/bar.so when ${base_libdir}="lib32" or | ||
219 | installing in /usr/lib64 when ${libdir}="/usr/lib" | ||
220 | """ | ||
221 | import re | ||
222 | |||
223 | pkgd = d.getVar('PKGD', True) | ||
224 | base_libdir = d.getVar("base_libdir",True) + os.sep | ||
225 | libdir = d.getVar("libdir", True) + os.sep | ||
226 | exec_prefix = d.getVar("exec_prefix", True) + os.sep | ||
227 | |||
228 | messages = [] | ||
229 | my_files = [] | ||
230 | |||
231 | for root, dirs, files in os.walk(pkgd): | ||
232 | for file in files: | ||
233 | full_path = os.path.join(root,file) | ||
234 | my_files.append(full_path[len(pkgd):]) | ||
235 | |||
236 | lib_re = re.compile("^/lib.*\.so") | ||
237 | exec_re = re.compile("^%s.*/lib*.\.so" % exec_prefix) | ||
238 | |||
239 | for file in my_files: | ||
240 | if lib_re.match(file): | ||
241 | if base_libdir not in file: | ||
242 | messages.append("Found library in wrong location: %s" % file) | ||
243 | if exec_re.match(file): | ||
244 | if libdir not in file: | ||
245 | messages.append("Found library in wrong location: %s" % file) | ||
246 | if messages: | ||
247 | package_qa_handle_error("libdir", "\n".join(messages), d) | ||
248 | |||
215 | QAPATHTEST[debug-files] = "package_qa_check_dbg" | 249 | QAPATHTEST[debug-files] = "package_qa_check_dbg" |
216 | def package_qa_check_dbg(path, name, d, elf, messages): | 250 | def package_qa_check_dbg(path, name, d, elf, messages): |
217 | """ | 251 | """ |
@@ -688,6 +722,9 @@ python do_package_qa () { | |||
688 | rdepends_sane = False | 722 | rdepends_sane = False |
689 | 723 | ||
690 | 724 | ||
725 | if 'libdir' in (d.getVar("WARN_QA", True) or "").split(): | ||
726 | package_qa_check_libdir(d) | ||
727 | |||
691 | if not walk_sane or not rdepends_sane: | 728 | if not walk_sane or not rdepends_sane: |
692 | bb.fatal("QA run found fatal errors. Please consider fixing them.") | 729 | bb.fatal("QA run found fatal errors. Please consider fixing them.") |
693 | bb.note("DONE with PACKAGE QA") | 730 | bb.note("DONE with PACKAGE QA") |