summaryrefslogtreecommitdiff
path: root/meta/classes/insane.bbclass
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:30 +0100
commitf6cb24cf2255297308ef57399a6be407129d9b8f (patch)
treec925b4a143563e0809c7181d90cb71749167f372 /meta/classes/insane.bbclass
parent58f08a96764094189b5aaf3cc8b4cc0c95e23409 (diff)
downloadopenembedded-core-f6cb24cf2255297308ef57399a6be407129d9b8f.tar.gz
openembedded-core-f6cb24cf2255297308ef57399a6be407129d9b8f.tar.bz2
openembedded-core-f6cb24cf2255297308ef57399a6be407129d9b8f.zip
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. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/insane.bbclass')
-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"
WARN_QA ?= "ldflags useless-rpaths rpaths staticdev libdir xorg-driver-abi \
textrel already-stripped incompatible-license files-invalid \
installed-vs-shipped compile-host-path install-host-path \
- pn-overrides infodir \
+ pn-overrides infodir build-deps \
"
ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
perms dep-cmp pkgvarcheck perm-config perm-line perm-link \
@@ -755,7 +755,7 @@ def package_qa_walk(path, warnfuncs, errorfuncs, skip, package, d):
return len(errors) == 0
-def package_qa_check_rdepends(pkg, pkgdest, skip, d):
+def package_qa_check_rdepends(pkg, pkgdest, skip, taskdeps, packages, d):
# Don't do this check for kernel/module recipes, there aren't too many debug/development
# packages and you can get false positives e.g. on kernel-module-lirc-dev
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):
if (not "-dev" in pkg and not "-staticdev" in pkg) and rdepend.endswith("-dev") and "dev-deps" not in skip:
error_msg = "%s rdepends on %s" % (pkg, rdepend)
sane = package_qa_handle_error("dev-deps", error_msg, d)
+ if rdepend not in packages:
+ rdep_data = oe.packagedata.read_subpkgdata(rdepend, d)
+ if rdep_data and 'PN' in rdep_data and rdep_data['PN'] in taskdeps:
+ continue
+ if not rdep_data or not 'PN' in rdep_data:
+ pkgdata_dir = d.getVar("PKGDATA_DIR", True)
+ try:
+ possibles = os.listdir("%s/runtime-rprovides/%s/" % (pkgdata_dir, rdepend))
+ except OSError:
+ possibles = []
+ for p in possibles:
+ rdep_data = oe.packagedata.read_subpkgdata(p, d)
+ if rdep_data and 'PN' in rdep_data and rdep_data['PN'] in taskdeps:
+ break
+ if rdep_data and 'PN' in rdep_data and rdep_data['PN'] in taskdeps:
+ continue
+ error_msg = "%s rdepends on %s but its not a build dependency?" % (pkg, rdepend)
+ sane = package_qa_handle_error("build-deps", error_msg, d)
return sane
@@ -820,6 +838,7 @@ def package_qa_check_deps(pkg, pkgdest, skip, d):
# The PACKAGE FUNC to scan each package
python do_package_qa () {
import subprocess
+ import oe.packagedata
bb.note("DO PACKAGE QA")
@@ -870,6 +889,11 @@ python do_package_qa () {
# The package name matches the [a-z0-9.+-]+ regular expression
pkgname_pattern = re.compile("^[a-z0-9.+-]+$")
+ taskdepdata = d.getVar("BB_TASKDEPDATA", False)
+ taskdeps = set()
+ for dep in taskdepdata:
+ taskdeps.add(taskdepdata[dep][0])
+
g = globals()
walk_sane = True
rdepends_sane = True
@@ -900,7 +924,7 @@ python do_package_qa () {
path = "%s/%s" % (pkgdest, package)
if not package_qa_walk(path, warnchecks, errorchecks, skip, package, d):
walk_sane = False
- if not package_qa_check_rdepends(package, pkgdest, skip, d):
+ if not package_qa_check_rdepends(package, pkgdest, skip, taskdeps, packages, d):
rdepends_sane = False
if not package_qa_check_deps(package, pkgdest, skip, d):
deps_sane = False
@@ -915,6 +939,7 @@ python do_package_qa () {
bb.note("DONE with PACKAGE QA")
}
+do_package_qa[rdeptask] = "do_packagedata"
addtask do_package_qa after do_packagedata do_package before do_build
SSTATETASKS += "do_package_qa"
@@ -1038,6 +1063,8 @@ python () {
for var in 'RDEPENDS', 'RRECOMMENDS', 'RSUGGESTS', 'RCONFLICTS', 'RPROVIDES', 'RREPLACES', 'FILES', 'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm', 'ALLOW_EMPTY':
if d.getVar(var):
issues.append(var)
+ else:
+ d.setVarFlag('do_package_qa', 'rdeptask', '')
for i in issues:
package_qa_handle_error("pkgvarcheck", "%s: Variable %s is set as not being package specific, please fix this." % (d.getVar("FILE", True), i), d)
}