mirror of
https://git.yoctoproject.org/poky
synced 2026-09-19 00:49:33 +02:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
2c9c911773
commit
65d1eb7788
@@ -113,7 +113,7 @@ def package_qa_get_machine_dict():
|
|||||||
|
|
||||||
|
|
||||||
# Currently not being used by default "desktop"
|
# Currently not being used by default "desktop"
|
||||||
WARN_QA ?= "ldflags useless-rpaths rpaths unsafe-references-in-binaries unsafe-references-in-scripts staticdev"
|
WARN_QA ?= "ldflags useless-rpaths rpaths unsafe-references-in-binaries unsafe-references-in-scripts staticdev libdir"
|
||||||
ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch la2 pkgconfig la perms"
|
ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch la2 pkgconfig la perms"
|
||||||
|
|
||||||
def package_qa_clean_path(path,d):
|
def package_qa_clean_path(path,d):
|
||||||
@@ -212,6 +212,40 @@ def package_qa_check_staticdev(path, name, d, elf, messages):
|
|||||||
messages.append("non -staticdev package contains static .a library: %s path '%s'" % \
|
messages.append("non -staticdev package contains static .a library: %s path '%s'" % \
|
||||||
(name, package_qa_clean_path(path,d)))
|
(name, package_qa_clean_path(path,d)))
|
||||||
|
|
||||||
|
def package_qa_check_libdir(d):
|
||||||
|
"""
|
||||||
|
Check for wrong library installation paths. For instance, catch
|
||||||
|
recipes installing /lib/bar.so when ${base_libdir}="lib32" or
|
||||||
|
installing in /usr/lib64 when ${libdir}="/usr/lib"
|
||||||
|
"""
|
||||||
|
import re
|
||||||
|
|
||||||
|
pkgd = d.getVar('PKGD', True)
|
||||||
|
base_libdir = d.getVar("base_libdir",True) + os.sep
|
||||||
|
libdir = d.getVar("libdir", True) + os.sep
|
||||||
|
exec_prefix = d.getVar("exec_prefix", True) + os.sep
|
||||||
|
|
||||||
|
messages = []
|
||||||
|
my_files = []
|
||||||
|
|
||||||
|
for root, dirs, files in os.walk(pkgd):
|
||||||
|
for file in files:
|
||||||
|
full_path = os.path.join(root,file)
|
||||||
|
my_files.append(full_path[len(pkgd):])
|
||||||
|
|
||||||
|
lib_re = re.compile("^/lib.*\.so")
|
||||||
|
exec_re = re.compile("^%s.*/lib*.\.so" % exec_prefix)
|
||||||
|
|
||||||
|
for file in my_files:
|
||||||
|
if lib_re.match(file):
|
||||||
|
if base_libdir not in file:
|
||||||
|
messages.append("Found library in wrong location: %s" % file)
|
||||||
|
if exec_re.match(file):
|
||||||
|
if libdir not in file:
|
||||||
|
messages.append("Found library in wrong location: %s" % file)
|
||||||
|
if messages:
|
||||||
|
package_qa_handle_error("libdir", "\n".join(messages), d)
|
||||||
|
|
||||||
QAPATHTEST[debug-files] = "package_qa_check_dbg"
|
QAPATHTEST[debug-files] = "package_qa_check_dbg"
|
||||||
def package_qa_check_dbg(path, name, d, elf, messages):
|
def package_qa_check_dbg(path, name, d, elf, messages):
|
||||||
"""
|
"""
|
||||||
@@ -688,6 +722,9 @@ python do_package_qa () {
|
|||||||
rdepends_sane = False
|
rdepends_sane = False
|
||||||
|
|
||||||
|
|
||||||
|
if 'libdir' in (d.getVar("WARN_QA", True) or "").split():
|
||||||
|
package_qa_check_libdir(d)
|
||||||
|
|
||||||
if not walk_sane or not rdepends_sane:
|
if not walk_sane or not rdepends_sane:
|
||||||
bb.fatal("QA run found fatal errors. Please consider fixing them.")
|
bb.fatal("QA run found fatal errors. Please consider fixing them.")
|
||||||
bb.note("DONE with PACKAGE QA")
|
bb.note("DONE with PACKAGE QA")
|
||||||
|
|||||||
Reference in New Issue
Block a user