From: Tom Rini Date: Thu, 1 Apr 2010 15:10:58 +0000 (+0000) Subject: insane.bbclass: Switch to endswith() and fix la/pc check X-Git-Tag: Release-2010-05/1~152^2~9 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=973169bb71ab44fa234ea65b409a2d45cf018112;p=openembedded.git insane.bbclass: Switch to endswith() and fix la/pc check This changes insane.bbclass to use s.endswith("str") rather than s[-3:] == "str". The primary motivation for this is that we have tests that check for 'la' and 'pc' files when we really want '.la' and '.pc' to be what we check for. Also, our -dev symlink test does if test1: if test2 and test3: action, when it could just be if test1 and test2 and test3. Signed-off-by: Tom Rini Acked-by: Khem Raj Acked-by: Marcin Juszkiewicz --- diff --git a/classes/insane.bbclass b/classes/insane.bbclass index c2e8d9cf1d..c85703eee2 100644 --- a/classes/insane.bbclass +++ b/classes/insane.bbclass @@ -263,11 +263,10 @@ def package_qa_check_dev(path, name,d, elf): if bb.data.inherits_class(s, d): return True - if not "-dev" in name: - if path[-3:] == ".so" and os.path.islink(path): - error_msg = "non -dev package contains symlink .so: %s path '%s'" % \ - (name, package_qa_clean_path(path,d)) - sane = package_qa_handle_error(0, error_msg, name, path, d) + if not name.endswith("-dev") and path.endswith(".so") and os.path.islink(path): + error_msg = "non -dev package contains symlink .so: %s path '%s'" % \ + (name, package_qa_clean_path(path,d)) + sane = package_qa_handle_error(0, error_msg, name, path, d) return sane @@ -412,7 +411,7 @@ def package_qa_check_staged(path,d): for root, dirs, files in os.walk(path): for file in files: path = os.path.join(root,file) - if file[-2:] == "la": + if file.endswith(".la"): file_content = open(path).read() # Don't check installed status for native/cross packages if not iscrossnative: @@ -422,7 +421,7 @@ def package_qa_check_staged(path,d): if workdir in file_content: error_msg = "%s failed sanity test (workdir) in path %s" % (file,root) sane = package_qa_handle_error(8, error_msg, "staging", path, d) - elif file[-2:] == "pc": + elif file.endswith(".pc"): file_content = open(path).read() if pkgconfigcheck in file_content: error_msg = "%s failed sanity test (tmpdir) in path %s" % (file,root)