classes/insane: allow libdir QA check to be skipped using INSANE_SKIP
This path check isn't handled in the normal way where a QA check function is called for every file (there's some minor setup that we want to avoid doing for every file) so we need to check INSANE_SKIP explicitly. In the process, change the code structure a little bit so that we can report the package that contains the errant file. Fixes [YOCTO #4822]. (From OE-Core rev: 3bdbec1bdecc52828cbbf8108786ff076c981845) Signed-off-by: Paul Eggleton <paul.eggleton@linux.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:
parent
20d7b27b8f
commit
77742dd0c9
|
@ -252,29 +252,39 @@ def package_qa_check_libdir(d):
|
||||||
"""
|
"""
|
||||||
import re
|
import re
|
||||||
|
|
||||||
pkgd = d.getVar('PKGD', True)
|
pkgdest = d.getVar('PKGDEST', True)
|
||||||
base_libdir = d.getVar("base_libdir",True) + os.sep
|
base_libdir = d.getVar("base_libdir",True) + os.sep
|
||||||
libdir = d.getVar("libdir", True) + os.sep
|
libdir = d.getVar("libdir", True) + os.sep
|
||||||
exec_prefix = d.getVar("exec_prefix", True) + os.sep
|
exec_prefix = d.getVar("exec_prefix", True) + os.sep
|
||||||
|
|
||||||
messages = []
|
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(\..+)?$")
|
lib_re = re.compile("^/lib.+\.so(\..+)?$")
|
||||||
exec_re = re.compile("^%s.*/lib.+\.so(\..+)?$" % exec_prefix)
|
exec_re = re.compile("^%s.*/lib.+\.so(\..+)?$" % exec_prefix)
|
||||||
|
|
||||||
for file in my_files:
|
for root, dirs, files in os.walk(pkgdest):
|
||||||
if lib_re.match(file):
|
if root == pkgdest:
|
||||||
if base_libdir not in file:
|
# Skip subdirectories for any packages with libdir in INSANE_SKIP
|
||||||
messages.append("Found library in wrong location: %s" % file)
|
skippackages = []
|
||||||
if exec_re.match(file):
|
for package in dirs:
|
||||||
if libdir not in file:
|
if 'libdir' in (d.getVar('INSANE_SKIP_' + package, True) or "").split():
|
||||||
messages.append("Found library in wrong location: %s" % file)
|
bb.note("Package %s skipping libdir QA test" % (package))
|
||||||
|
skippackages.append(package)
|
||||||
|
for package in skippackages:
|
||||||
|
dirs.remove(package)
|
||||||
|
for file in files:
|
||||||
|
full_path = os.path.join(root, file)
|
||||||
|
rel_path = os.path.relpath(full_path, pkgdest)
|
||||||
|
if os.sep in rel_path:
|
||||||
|
package, rel_path = rel_path.split(os.sep, 1)
|
||||||
|
rel_path = os.sep + rel_path
|
||||||
|
if lib_re.match(rel_path):
|
||||||
|
if base_libdir not in rel_path:
|
||||||
|
messages.append("%s: found library in wrong location: %s" % (package, rel_path))
|
||||||
|
if exec_re.match(rel_path):
|
||||||
|
if libdir not in rel_path:
|
||||||
|
messages.append("%s: found library in wrong location: %s" % (package, rel_path))
|
||||||
|
|
||||||
if messages:
|
if messages:
|
||||||
package_qa_handle_error("libdir", "\n".join(messages), d)
|
package_qa_handle_error("libdir", "\n".join(messages), d)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue