summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2014-07-09 21:26:56 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-07-25 15:33:56 +0100
commita202f8a66383787c899246c5fa14c862e5d7647d (patch)
treee1077651762125832babd6681992578ecd46d68f
parent686037ce16395533325717d9a8dc1c49ff5b39e9 (diff)
downloadpoky-a202f8a66383787c899246c5fa14c862e5d7647d.tar.gz
insane: Add build depends check
Now that we can get the task dependency tree from bitbake, we can start to use this to strengthen our QA checks. If a dependency is added on something which isn't in our dependency tree, that is obviously a bad thing for example. This patch therefore checks the RDEPENDS against the list of tasks and ensures we do have a dependency present, if not a QA warning or error can be issued through the usual mechanism. The implementation is complicated by needing to resolve the RDEPENDS to a PN using pkgdata. Its possible that can be an RPROVIDES of another package so we need to check that too if it isn't a direct RDEPENDS. To allow this test to work, we need to extend the do_package_qa dependencies to include all RDEPENDS. In practise the do_package_write_* tasks already do this so there should be no new circular dependencies or any issues like that. For now the issues are warnings as there are issues this finds in OE-Core which need to be resolved and certainly will be in other layers too. This change should simplify and assist some of Martin's dependency scripts, the idea for this came from a discussion with Martin. It has changed in that it doesn't just cover shlibs dependencies but checks all dependencies. (From OE-Core rev: f6cb24cf2255297308ef57399a6be407129d9b8f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/insane.bbclass33
1 files changed, 30 insertions, 3 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index b26216e8b4..53942365ab 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -29,7 +29,7 @@ QA_SANE = "True"
29WARN_QA ?= "ldflags useless-rpaths rpaths staticdev libdir xorg-driver-abi \ 29WARN_QA ?= "ldflags useless-rpaths rpaths staticdev libdir xorg-driver-abi \
30 textrel already-stripped incompatible-license files-invalid \ 30 textrel already-stripped incompatible-license files-invalid \
31 installed-vs-shipped compile-host-path install-host-path \ 31 installed-vs-shipped compile-host-path install-host-path \
32 pn-overrides infodir \ 32 pn-overrides infodir build-deps \
33 " 33 "
34ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \ 34ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
35 perms dep-cmp pkgvarcheck perm-config perm-line perm-link \ 35 perms dep-cmp pkgvarcheck perm-config perm-line perm-link \
@@ -755,7 +755,7 @@ def package_qa_walk(path, warnfuncs, errorfuncs, skip, package, d):
755 755
756 return len(errors) == 0 756 return len(errors) == 0
757 757
758def package_qa_check_rdepends(pkg, pkgdest, skip, d): 758def package_qa_check_rdepends(pkg, pkgdest, skip, taskdeps, packages, d):
759 # Don't do this check for kernel/module recipes, there aren't too many debug/development 759 # Don't do this check for kernel/module recipes, there aren't too many debug/development
760 # packages and you can get false positives e.g. on kernel-module-lirc-dev 760 # packages and you can get false positives e.g. on kernel-module-lirc-dev
761 if bb.data.inherits_class("kernel", d) or bb.data.inherits_class("module-base", d): 761 if bb.data.inherits_class("kernel", d) or bb.data.inherits_class("module-base", d):
@@ -778,6 +778,24 @@ def package_qa_check_rdepends(pkg, pkgdest, skip, d):
778 if (not "-dev" in pkg and not "-staticdev" in pkg) and rdepend.endswith("-dev") and "dev-deps" not in skip: 778 if (not "-dev" in pkg and not "-staticdev" in pkg) and rdepend.endswith("-dev") and "dev-deps" not in skip:
779 error_msg = "%s rdepends on %s" % (pkg, rdepend) 779 error_msg = "%s rdepends on %s" % (pkg, rdepend)
780 sane = package_qa_handle_error("dev-deps", error_msg, d) 780 sane = package_qa_handle_error("dev-deps", error_msg, d)
781 if rdepend not in packages:
782 rdep_data = oe.packagedata.read_subpkgdata(rdepend, d)
783 if rdep_data and 'PN' in rdep_data and rdep_data['PN'] in taskdeps:
784 continue
785 if not rdep_data or not 'PN' in rdep_data:
786 pkgdata_dir = d.getVar("PKGDATA_DIR", True)
787 try:
788 possibles = os.listdir("%s/runtime-rprovides/%s/" % (pkgdata_dir, rdepend))
789 except OSError:
790 possibles = []
791 for p in possibles:
792 rdep_data = oe.packagedata.read_subpkgdata(p, d)
793 if rdep_data and 'PN' in rdep_data and rdep_data['PN'] in taskdeps:
794 break
795 if rdep_data and 'PN' in rdep_data and rdep_data['PN'] in taskdeps:
796 continue
797 error_msg = "%s rdepends on %s but its not a build dependency?" % (pkg, rdepend)
798 sane = package_qa_handle_error("build-deps", error_msg, d)
781 799
782 return sane 800 return sane
783 801
@@ -820,6 +838,7 @@ def package_qa_check_deps(pkg, pkgdest, skip, d):
820# The PACKAGE FUNC to scan each package 838# The PACKAGE FUNC to scan each package
821python do_package_qa () { 839python do_package_qa () {
822 import subprocess 840 import subprocess
841 import oe.packagedata
823 842
824 bb.note("DO PACKAGE QA") 843 bb.note("DO PACKAGE QA")
825 844
@@ -870,6 +889,11 @@ python do_package_qa () {
870 # The package name matches the [a-z0-9.+-]+ regular expression 889 # The package name matches the [a-z0-9.+-]+ regular expression
871 pkgname_pattern = re.compile("^[a-z0-9.+-]+$") 890 pkgname_pattern = re.compile("^[a-z0-9.+-]+$")
872 891
892 taskdepdata = d.getVar("BB_TASKDEPDATA", False)
893 taskdeps = set()
894 for dep in taskdepdata:
895 taskdeps.add(taskdepdata[dep][0])
896
873 g = globals() 897 g = globals()
874 walk_sane = True 898 walk_sane = True
875 rdepends_sane = True 899 rdepends_sane = True
@@ -900,7 +924,7 @@ python do_package_qa () {
900 path = "%s/%s" % (pkgdest, package) 924 path = "%s/%s" % (pkgdest, package)
901 if not package_qa_walk(path, warnchecks, errorchecks, skip, package, d): 925 if not package_qa_walk(path, warnchecks, errorchecks, skip, package, d):
902 walk_sane = False 926 walk_sane = False
903 if not package_qa_check_rdepends(package, pkgdest, skip, d): 927 if not package_qa_check_rdepends(package, pkgdest, skip, taskdeps, packages, d):
904 rdepends_sane = False 928 rdepends_sane = False
905 if not package_qa_check_deps(package, pkgdest, skip, d): 929 if not package_qa_check_deps(package, pkgdest, skip, d):
906 deps_sane = False 930 deps_sane = False
@@ -915,6 +939,7 @@ python do_package_qa () {
915 bb.note("DONE with PACKAGE QA") 939 bb.note("DONE with PACKAGE QA")
916} 940}
917 941
942do_package_qa[rdeptask] = "do_packagedata"
918addtask do_package_qa after do_packagedata do_package before do_build 943addtask do_package_qa after do_packagedata do_package before do_build
919 944
920SSTATETASKS += "do_package_qa" 945SSTATETASKS += "do_package_qa"
@@ -1038,6 +1063,8 @@ python () {
1038 for var in 'RDEPENDS', 'RRECOMMENDS', 'RSUGGESTS', 'RCONFLICTS', 'RPROVIDES', 'RREPLACES', 'FILES', 'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm', 'ALLOW_EMPTY': 1063 for var in 'RDEPENDS', 'RRECOMMENDS', 'RSUGGESTS', 'RCONFLICTS', 'RPROVIDES', 'RREPLACES', 'FILES', 'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm', 'ALLOW_EMPTY':
1039 if d.getVar(var): 1064 if d.getVar(var):
1040 issues.append(var) 1065 issues.append(var)
1066 else:
1067 d.setVarFlag('do_package_qa', 'rdeptask', '')
1041 for i in issues: 1068 for i in issues:
1042 package_qa_handle_error("pkgvarcheck", "%s: Variable %s is set as not being package specific, please fix this." % (d.getVar("FILE", True), i), d) 1069 package_qa_handle_error("pkgvarcheck", "%s: Variable %s is set as not being package specific, please fix this." % (d.getVar("FILE", True), i), d)
1043} 1070}