diff options
| -rw-r--r-- | meta/classes/insane.bbclass | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass index b875ac08c1..75bd2e2b22 100644 --- a/meta/classes/insane.bbclass +++ b/meta/classes/insane.bbclass | |||
| @@ -252,29 +252,39 @@ def package_qa_check_libdir(d): | |||
| 252 | """ | 252 | """ |
| 253 | import re | 253 | import re |
| 254 | 254 | ||
| 255 | pkgd = d.getVar('PKGD', True) | 255 | pkgdest = d.getVar('PKGDEST', True) |
| 256 | base_libdir = d.getVar("base_libdir",True) + os.sep | 256 | base_libdir = d.getVar("base_libdir",True) + os.sep |
| 257 | libdir = d.getVar("libdir", True) + os.sep | 257 | libdir = d.getVar("libdir", True) + os.sep |
| 258 | exec_prefix = d.getVar("exec_prefix", True) + os.sep | 258 | exec_prefix = d.getVar("exec_prefix", True) + os.sep |
| 259 | 259 | ||
| 260 | messages = [] | 260 | messages = [] |
| 261 | my_files = [] | ||
| 262 | |||
| 263 | for root, dirs, files in os.walk(pkgd): | ||
| 264 | for file in files: | ||
| 265 | full_path = os.path.join(root,file) | ||
| 266 | my_files.append(full_path[len(pkgd):]) | ||
| 267 | 261 | ||
| 268 | lib_re = re.compile("^/lib.+\.so(\..+)?$") | 262 | lib_re = re.compile("^/lib.+\.so(\..+)?$") |
| 269 | exec_re = re.compile("^%s.*/lib.+\.so(\..+)?$" % exec_prefix) | 263 | exec_re = re.compile("^%s.*/lib.+\.so(\..+)?$" % exec_prefix) |
| 270 | 264 | ||
| 271 | for file in my_files: | 265 | for root, dirs, files in os.walk(pkgdest): |
| 272 | if lib_re.match(file): | 266 | if root == pkgdest: |
| 273 | if base_libdir not in file: | 267 | # Skip subdirectories for any packages with libdir in INSANE_SKIP |
| 274 | messages.append("Found library in wrong location: %s" % file) | 268 | skippackages = [] |
| 275 | if exec_re.match(file): | 269 | for package in dirs: |
| 276 | if libdir not in file: | 270 | if 'libdir' in (d.getVar('INSANE_SKIP_' + package, True) or "").split(): |
| 277 | messages.append("Found library in wrong location: %s" % file) | 271 | bb.note("Package %s skipping libdir QA test" % (package)) |
| 272 | skippackages.append(package) | ||
| 273 | for package in skippackages: | ||
| 274 | dirs.remove(package) | ||
| 275 | for file in files: | ||
| 276 | full_path = os.path.join(root, file) | ||
| 277 | rel_path = os.path.relpath(full_path, pkgdest) | ||
| 278 | if os.sep in rel_path: | ||
| 279 | package, rel_path = rel_path.split(os.sep, 1) | ||
| 280 | rel_path = os.sep + rel_path | ||
| 281 | if lib_re.match(rel_path): | ||
| 282 | if base_libdir not in rel_path: | ||
| 283 | messages.append("%s: found library in wrong location: %s" % (package, rel_path)) | ||
| 284 | if exec_re.match(rel_path): | ||
| 285 | if libdir not in rel_path: | ||
| 286 | messages.append("%s: found library in wrong location: %s" % (package, rel_path)) | ||
| 287 | |||
| 278 | if messages: | 288 | if messages: |
| 279 | package_qa_handle_error("libdir", "\n".join(messages), d) | 289 | package_qa_handle_error("libdir", "\n".join(messages), d) |
| 280 | 290 | ||
