From 5363a5e43462e22ed61e87923e00657b740f6823 Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Tue, 8 Aug 2017 15:51:18 +0100 Subject: insane: remove unsafe-references-in-scripts check We've already removed unsafe-references-in-binaries (which was fundamentally broken) and nobody really cares about / and /usr being on different filesystems anymore (at least if they, they're keeping very quiet and not fixing the bugs). As this test was a minor detail in the scope of supporting separate / and /usr which we don't support, it can be removed. Signed-off-by: Ross Burton --- meta/classes/insane.bbclass | 65 --------------------------------------------- 1 file changed, 65 deletions(-) (limited to 'meta/classes/insane.bbclass') 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): """ return -QAPATHTEST[unsafe-references-in-scripts] = "package_qa_check_unsafe_references_in_scripts" -def package_qa_check_unsafe_references_in_scripts(path, name, d, elf, messages): - """ - Warn if scripts in base_[bindir|sbindir|libdir] reference files under exec_prefix - """ - if unsafe_references_skippable(path, name, d): - return - - if not elf: - import stat - import subprocess - pn = d.getVar('PN') - - # Ensure we're checking an executable script - statinfo = os.stat(path) - if bool(statinfo.st_mode & stat.S_IXUSR): - # grep shell scripts for possible references to /exec_prefix/ - exec_prefix = d.getVar('exec_prefix') - statement = "grep -e '%s/[^ :]\{1,\}/[^ :]\{1,\}' %s > /dev/null" % (exec_prefix, path) - if subprocess.call(statement, shell=True) == 0: - error_msg = pn + ": Found a reference to %s/ in %s" % (exec_prefix, path) - package_qa_handle_error("unsafe-references-in-scripts", error_msg, d) - error_msg = "Shell scripts in base_bindir and base_sbindir should not reference anything in exec_prefix" - package_qa_handle_error("unsafe-references-in-scripts", error_msg, d) - -def unsafe_references_skippable(path, name, d): - if bb.data.inherits_class('native', d) or bb.data.inherits_class('nativesdk', d): - return True - - if "-dbg" in name or "-dev" in name: - return True - - # Other package names to skip: - if name.startswith("kernel-module-"): - return True - - # Skip symlinks - if os.path.islink(path): - return True - - # Skip unusual rootfs layouts which make these tests irrelevant - exec_prefix = d.getVar('exec_prefix') - if exec_prefix == "": - return True - - pkgdest = d.getVar('PKGDEST') - pkgdest = pkgdest + "/" + name - pkgdest = os.path.abspath(pkgdest) - base_bindir = pkgdest + d.getVar('base_bindir') - base_sbindir = pkgdest + d.getVar('base_sbindir') - base_libdir = pkgdest + d.getVar('base_libdir') - bindir = pkgdest + d.getVar('bindir') - sbindir = pkgdest + d.getVar('sbindir') - libdir = pkgdest + d.getVar('libdir') - - if base_bindir == bindir and base_sbindir == sbindir and base_libdir == libdir: - return True - - # Skip files not in base_[bindir|sbindir|libdir] - path = os.path.abspath(path) - if not (base_bindir in path or base_sbindir in path or base_libdir in path): - return True - - return False - QAPATHTEST[arch] = "package_qa_check_arch" def package_qa_check_arch(path,name,d, elf, messages): """ -- cgit 1.2.3-korg