summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/insane.bbclass65
1 files changed, 0 insertions, 65 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 479d39c67e..022b917a7c 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -390,71 +390,6 @@ def package_qa_check_perm(path,name,d, elf, messages):
390 """ 390 """
391 return 391 return
392 392
393QAPATHTEST[unsafe-references-in-scripts] = "package_qa_check_unsafe_references_in_scripts"
394def package_qa_check_unsafe_references_in_scripts(path, name, d, elf, messages):
395 """
396 Warn if scripts in base_[bindir|sbindir|libdir] reference files under exec_prefix
397 """
398 if unsafe_references_skippable(path, name, d):
399 return
400
401 if not elf:
402 import stat
403 import subprocess
404 pn = d.getVar('PN')
405
406 # Ensure we're checking an executable script
407 statinfo = os.stat(path)
408 if bool(statinfo.st_mode & stat.S_IXUSR):
409 # grep shell scripts for possible references to /exec_prefix/
410 exec_prefix = d.getVar('exec_prefix')
411 statement = "grep -e '%s/[^ :]\{1,\}/[^ :]\{1,\}' %s > /dev/null" % (exec_prefix, path)
412 if subprocess.call(statement, shell=True) == 0:
413 error_msg = pn + ": Found a reference to %s/ in %s" % (exec_prefix, path)
414 package_qa_handle_error("unsafe-references-in-scripts", error_msg, d)
415 error_msg = "Shell scripts in base_bindir and base_sbindir should not reference anything in exec_prefix"
416 package_qa_handle_error("unsafe-references-in-scripts", error_msg, d)
417
418def unsafe_references_skippable(path, name, d):
419 if bb.data.inherits_class('native', d) or bb.data.inherits_class('nativesdk', d):
420 return True
421
422 if "-dbg" in name or "-dev" in name:
423 return True
424
425 # Other package names to skip:
426 if name.startswith("kernel-module-"):
427 return True
428
429 # Skip symlinks
430 if os.path.islink(path):
431 return True
432
433 # Skip unusual rootfs layouts which make these tests irrelevant
434 exec_prefix = d.getVar('exec_prefix')
435 if exec_prefix == "":
436 return True
437
438 pkgdest = d.getVar('PKGDEST')
439 pkgdest = pkgdest + "/" + name
440 pkgdest = os.path.abspath(pkgdest)
441 base_bindir = pkgdest + d.getVar('base_bindir')
442 base_sbindir = pkgdest + d.getVar('base_sbindir')
443 base_libdir = pkgdest + d.getVar('base_libdir')
444 bindir = pkgdest + d.getVar('bindir')
445 sbindir = pkgdest + d.getVar('sbindir')
446 libdir = pkgdest + d.getVar('libdir')
447
448 if base_bindir == bindir and base_sbindir == sbindir and base_libdir == libdir:
449 return True
450
451 # Skip files not in base_[bindir|sbindir|libdir]
452 path = os.path.abspath(path)
453 if not (base_bindir in path or base_sbindir in path or base_libdir in path):
454 return True
455
456 return False
457
458QAPATHTEST[arch] = "package_qa_check_arch" 393QAPATHTEST[arch] = "package_qa_check_arch"
459def package_qa_check_arch(path,name,d, elf, messages): 394def package_qa_check_arch(path,name,d, elf, messages):
460 """ 395 """