diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-02-03 15:15:29 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-02-03 16:16:30 +0000 |
commit | 76f52a81f600fe7dfee0987db361e973b9ab71f8 (patch) | |
tree | 2e43eced57847031201db4e85b2d0a9bd1a5d0c6 | |
parent | 220f4f5806c1f6f93e3d5a3cf3c66d13530199c6 (diff) | |
download | poky-76f52a81f600fe7dfee0987db361e973b9ab71f8.tar.gz |
insane: Fix python function whitespace changes
(From OE-Core rev: 9dee6c2fe0d1882521c0f9a6998257a652845854)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/insane.bbclass | 192 |
1 files changed, 96 insertions, 96 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass index 55ed91f8dc..cf00e12fce 100644 --- a/meta/classes/insane.bbclass +++ b/meta/classes/insane.bbclass | |||
@@ -95,7 +95,7 @@ def package_qa_get_machine_dict(): | |||
95 | "mips64": ( 8, 0, 0, False, 64), | 95 | "mips64": ( 8, 0, 0, False, 64), |
96 | "mips64el": ( 8, 0, 0, True, 64), | 96 | "mips64el": ( 8, 0, 0, True, 64), |
97 | "avr32": (6317, 0, 0, False, 32), | 97 | "avr32": (6317, 0, 0, False, 32), |
98 | "sh4": (42, 0, 0, True, 32), | 98 | "sh4": (42, 0, 0, True, 32), |
99 | 99 | ||
100 | }, | 100 | }, |
101 | "uclinux-uclibc" : { | 101 | "uclinux-uclibc" : { |
@@ -309,110 +309,110 @@ def package_qa_check_perm(path,name,d, elf, messages): | |||
309 | 309 | ||
310 | QAPATHTEST[unsafe-references-in-binaries] = "package_qa_check_unsafe_references_in_binaries" | 310 | QAPATHTEST[unsafe-references-in-binaries] = "package_qa_check_unsafe_references_in_binaries" |
311 | def package_qa_check_unsafe_references_in_binaries(path, name, d, elf, messages): | 311 | def package_qa_check_unsafe_references_in_binaries(path, name, d, elf, messages): |
312 | """ | 312 | """ |
313 | Ensure binaries in base_[bindir|sbindir|libdir] do not link to files under exec_prefix | 313 | Ensure binaries in base_[bindir|sbindir|libdir] do not link to files under exec_prefix |
314 | """ | 314 | """ |
315 | if unsafe_references_skippable(path, name, d): | 315 | if unsafe_references_skippable(path, name, d): |
316 | return | 316 | return |
317 | 317 | ||
318 | if elf: | 318 | if elf: |
319 | import subprocess as sub | 319 | import subprocess as sub |
320 | pn = d.getVar('PN', True) | 320 | pn = d.getVar('PN', True) |
321 | 321 | ||
322 | exec_prefix = d.getVar('exec_prefix', True) | 322 | exec_prefix = d.getVar('exec_prefix', True) |
323 | sysroot_path = d.getVar('STAGING_DIR_TARGET', True) | 323 | sysroot_path = d.getVar('STAGING_DIR_TARGET', True) |
324 | sysroot_path_usr = sysroot_path + exec_prefix | 324 | sysroot_path_usr = sysroot_path + exec_prefix |
325 | 325 | ||
326 | try: | 326 | try: |
327 | ldd_output = bb.process.Popen(["prelink-rtld", "--root", sysroot_path, path], stdout=sub.PIPE).stdout.read() | 327 | ldd_output = bb.process.Popen(["prelink-rtld", "--root", sysroot_path, path], stdout=sub.PIPE).stdout.read() |
328 | except bb.process.CmdError: | 328 | except bb.process.CmdError: |
329 | error_msg = pn + ": prelink-rtld aborted when processing %s" % path | 329 | error_msg = pn + ": prelink-rtld aborted when processing %s" % path |
330 | package_qa_handle_error("unsafe-references-in-binaries", error_msg, d) | 330 | package_qa_handle_error("unsafe-references-in-binaries", error_msg, d) |
331 | return False | 331 | return False |
332 | 332 | ||
333 | if sysroot_path_usr in ldd_output: | 333 | if sysroot_path_usr in ldd_output: |
334 | ldd_output = ldd_output.replace(sysroot_path, "") | 334 | ldd_output = ldd_output.replace(sysroot_path, "") |
335 | 335 | ||
336 | pkgdest = d.getVar('PKGDEST', True) | 336 | pkgdest = d.getVar('PKGDEST', True) |
337 | packages = d.getVar('PACKAGES', True) | 337 | packages = d.getVar('PACKAGES', True) |
338 | 338 | ||
339 | for package in packages.split(): | 339 | for package in packages.split(): |
340 | short_path = path.replace('%s/%s' % (pkgdest, package), "", 1) | 340 | short_path = path.replace('%s/%s' % (pkgdest, package), "", 1) |
341 | if (short_path != path): | 341 | if (short_path != path): |
342 | break | 342 | break |
343 | 343 | ||
344 | base_err = pn + ": %s, installed in the base_prefix, requires a shared library under exec_prefix (%s)" % (short_path, exec_prefix) | 344 | base_err = pn + ": %s, installed in the base_prefix, requires a shared library under exec_prefix (%s)" % (short_path, exec_prefix) |
345 | for line in ldd_output.split('\n'): | 345 | for line in ldd_output.split('\n'): |
346 | if exec_prefix in line: | 346 | if exec_prefix in line: |
347 | error_msg = "%s: %s" % (base_err, line.strip()) | 347 | error_msg = "%s: %s" % (base_err, line.strip()) |
348 | package_qa_handle_error("unsafe-references-in-binaries", error_msg, d) | 348 | package_qa_handle_error("unsafe-references-in-binaries", error_msg, d) |
349 | 349 | ||
350 | return False | 350 | return False |
351 | 351 | ||
352 | QAPATHTEST[unsafe-references-in-scripts] = "package_qa_check_unsafe_references_in_scripts" | 352 | QAPATHTEST[unsafe-references-in-scripts] = "package_qa_check_unsafe_references_in_scripts" |
353 | def package_qa_check_unsafe_references_in_scripts(path, name, d, elf, messages): | 353 | def package_qa_check_unsafe_references_in_scripts(path, name, d, elf, messages): |
354 | """ | 354 | """ |
355 | Warn if scripts in base_[bindir|sbindir|libdir] reference files under exec_prefix | 355 | Warn if scripts in base_[bindir|sbindir|libdir] reference files under exec_prefix |
356 | """ | 356 | """ |
357 | if unsafe_references_skippable(path, name, d): | 357 | if unsafe_references_skippable(path, name, d): |
358 | return | 358 | return |
359 | |||
360 | if not elf: | ||
361 | import stat | ||
362 | import subprocess | ||
363 | pn = d.getVar('PN', True) | ||
364 | |||
365 | # Ensure we're checking an executable script | ||
366 | statinfo = os.stat(path) | ||
367 | if bool(statinfo.st_mode & stat.S_IXUSR): | ||
368 | # grep shell scripts for possible references to /exec_prefix/ | ||
369 | exec_prefix = d.getVar('exec_prefix', True) | ||
370 | statement = "grep -e '%s/' %s > /dev/null" % (exec_prefix, path) | ||
371 | if subprocess.call(statement, shell=True) == 0: | ||
372 | error_msg = pn + ": Found a reference to %s/ in %s" % (exec_prefix, path) | ||
373 | package_qa_handle_error("unsafe-references-in-scripts", error_msg, d) | ||
374 | error_msg = "Shell scripts in base_bindir and base_sbindir should not reference anything in exec_prefix" | ||
375 | package_qa_handle_error("unsafe-references-in-scripts", error_msg, d) | ||
376 | 359 | ||
377 | def unsafe_references_skippable(path, name, d): | 360 | if not elf: |
378 | if bb.data.inherits_class('native', d) or bb.data.inherits_class('nativesdk', d): | 361 | import stat |
379 | return True | 362 | import subprocess |
363 | pn = d.getVar('PN', True) | ||
364 | |||
365 | # Ensure we're checking an executable script | ||
366 | statinfo = os.stat(path) | ||
367 | if bool(statinfo.st_mode & stat.S_IXUSR): | ||
368 | # grep shell scripts for possible references to /exec_prefix/ | ||
369 | exec_prefix = d.getVar('exec_prefix', True) | ||
370 | statement = "grep -e '%s/' %s > /dev/null" % (exec_prefix, path) | ||
371 | if subprocess.call(statement, shell=True) == 0: | ||
372 | error_msg = pn + ": Found a reference to %s/ in %s" % (exec_prefix, path) | ||
373 | package_qa_handle_error("unsafe-references-in-scripts", error_msg, d) | ||
374 | error_msg = "Shell scripts in base_bindir and base_sbindir should not reference anything in exec_prefix" | ||
375 | package_qa_handle_error("unsafe-references-in-scripts", error_msg, d) | ||
380 | 376 | ||
381 | if "-dbg" in name or "-dev" in name: | 377 | def unsafe_references_skippable(path, name, d): |
382 | return True | 378 | if bb.data.inherits_class('native', d) or bb.data.inherits_class('nativesdk', d): |
379 | return True | ||
383 | 380 | ||
384 | # Other package names to skip: | 381 | if "-dbg" in name or "-dev" in name: |
385 | if name.startswith("kernel-module-"): | 382 | return True |
386 | return True | ||
387 | 383 | ||
388 | # Skip symlinks | 384 | # Other package names to skip: |
389 | if os.path.islink(path): | 385 | if name.startswith("kernel-module-"): |
390 | return True | 386 | return True |
391 | 387 | ||
392 | # Skip unusual rootfs layouts which make these tests irrelevant | 388 | # Skip symlinks |
393 | exec_prefix = d.getVar('exec_prefix', True) | 389 | if os.path.islink(path): |
394 | if exec_prefix == "": | 390 | return True |
395 | return True | ||
396 | 391 | ||
397 | pkgdest = d.getVar('PKGDEST', True) | 392 | # Skip unusual rootfs layouts which make these tests irrelevant |
398 | pkgdest = pkgdest + "/" + name | 393 | exec_prefix = d.getVar('exec_prefix', True) |
399 | pkgdest = os.path.abspath(pkgdest) | 394 | if exec_prefix == "": |
400 | base_bindir = pkgdest + d.getVar('base_bindir', True) | 395 | return True |
401 | base_sbindir = pkgdest + d.getVar('base_sbindir', True) | ||
402 | base_libdir = pkgdest + d.getVar('base_libdir', True) | ||
403 | bindir = pkgdest + d.getVar('bindir', True) | ||
404 | sbindir = pkgdest + d.getVar('sbindir', True) | ||
405 | libdir = pkgdest + d.getVar('libdir', True) | ||
406 | 396 | ||
407 | if base_bindir == bindir and base_sbindir == sbindir and base_libdir == libdir: | 397 | pkgdest = d.getVar('PKGDEST', True) |
408 | return True | 398 | pkgdest = pkgdest + "/" + name |
399 | pkgdest = os.path.abspath(pkgdest) | ||
400 | base_bindir = pkgdest + d.getVar('base_bindir', True) | ||
401 | base_sbindir = pkgdest + d.getVar('base_sbindir', True) | ||
402 | base_libdir = pkgdest + d.getVar('base_libdir', True) | ||
403 | bindir = pkgdest + d.getVar('bindir', True) | ||
404 | sbindir = pkgdest + d.getVar('sbindir', True) | ||
405 | libdir = pkgdest + d.getVar('libdir', True) | ||
406 | |||
407 | if base_bindir == bindir and base_sbindir == sbindir and base_libdir == libdir: | ||
408 | return True | ||
409 | 409 | ||
410 | # Skip files not in base_[bindir|sbindir|libdir] | 410 | # Skip files not in base_[bindir|sbindir|libdir] |
411 | path = os.path.abspath(path) | 411 | path = os.path.abspath(path) |
412 | if not (base_bindir in path or base_sbindir in path or base_libdir in path): | 412 | if not (base_bindir in path or base_sbindir in path or base_libdir in path): |
413 | return True | 413 | return True |
414 | 414 | ||
415 | return False | 415 | return False |
416 | 416 | ||
417 | QAPATHTEST[arch] = "package_qa_check_arch" | 417 | QAPATHTEST[arch] = "package_qa_check_arch" |
418 | def package_qa_check_arch(path,name,d, elf, messages): | 418 | def package_qa_check_arch(path,name,d, elf, messages): |
@@ -443,11 +443,11 @@ def package_qa_check_arch(path,name,d, elf, messages): | |||
443 | 443 | ||
444 | # Check the architecture and endiannes of the binary | 444 | # Check the architecture and endiannes of the binary |
445 | if not ((machine == elf.machine()) or \ | 445 | if not ((machine == elf.machine()) or \ |
446 | ("virtual/kernel" in provides) and (target_os == "linux-gnux32")): | 446 | ("virtual/kernel" in provides) and (target_os == "linux-gnux32")): |
447 | messages.append("Architecture did not match (%d to %d) on %s" % \ | 447 | messages.append("Architecture did not match (%d to %d) on %s" % \ |
448 | (machine, elf.machine(), package_qa_clean_path(path,d))) | 448 | (machine, elf.machine(), package_qa_clean_path(path,d))) |
449 | elif not ((bits == elf.abiSize()) or \ | 449 | elif not ((bits == elf.abiSize()) or \ |
450 | ("virtual/kernel" in provides) and (target_os == "linux-gnux32")): | 450 | ("virtual/kernel" in provides) and (target_os == "linux-gnux32")): |
451 | messages.append("Bit size did not match (%d to %d) %s on %s" % \ | 451 | messages.append("Bit size did not match (%d to %d) %s on %s" % \ |
452 | (bits, elf.abiSize(), bpn, package_qa_clean_path(path,d))) | 452 | (bits, elf.abiSize(), bpn, package_qa_clean_path(path,d))) |
453 | elif not littleendian == elf.isLittleEndian(): | 453 | elif not littleendian == elf.isLittleEndian(): |
@@ -949,7 +949,7 @@ Missing inherit gettext?""" % (gt, config)) | |||
949 | whitelist = set(d.getVar("UNKNOWN_CONFIGURE_WHITELIST", True).split()) | 949 | whitelist = set(d.getVar("UNKNOWN_CONFIGURE_WHITELIST", True).split()) |
950 | options -= whitelist | 950 | options -= whitelist |
951 | if options: | 951 | if options: |
952 | pn = d.getVar('PN', True) | 952 | pn = d.getVar('PN', True) |
953 | error_msg = pn + ": configure was passed unrecognised options: " + " ".join(options) | 953 | error_msg = pn + ": configure was passed unrecognised options: " + " ".join(options) |
954 | package_qa_handle_error("unknown-configure-option", error_msg, d) | 954 | package_qa_handle_error("unknown-configure-option", error_msg, d) |
955 | except subprocess.CalledProcessError: | 955 | except subprocess.CalledProcessError: |