diff options
Diffstat (limited to 'meta/classes/insane.bbclass')
-rw-r--r-- | meta/classes/insane.bbclass | 83 |
1 files changed, 56 insertions, 27 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass index c6dea22618..061ce5b620 100644 --- a/meta/classes/insane.bbclass +++ b/meta/classes/insane.bbclass @@ -30,11 +30,12 @@ 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 build-deps file-rdeps \ + unknown-configure-option \ " ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \ perms dep-cmp pkgvarcheck perm-config perm-line perm-link \ split-strip packages-list pkgv-undefined var-undefined \ - version-going-backwards \ + version-going-backwards expanded-d \ " ALL_QA = "${WARN_QA} ${ERROR_QA}" @@ -771,31 +772,32 @@ def package_qa_check_rdepends(pkg, pkgdest, skip, taskdeps, packages, d): rdepends = bb.utils.explode_deps(localdata.getVar('RDEPENDS', True) or "") # Now do the sanity check!!! - for rdepend in rdepends: - if "-dbg" in rdepend and "debug-deps" not in skip: - error_msg = "%s rdepends on %s" % (pkg,rdepend) - sane = package_qa_handle_error("debug-deps", error_msg, 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 it isn't a build dependency?" % (pkg, rdepend) - sane = package_qa_handle_error("build-deps", error_msg, d) + if "build-deps" not in skip: + for rdepend in rdepends: + if "-dbg" in rdepend and "debug-deps" not in skip: + error_msg = "%s rdepends on %s" % (pkg,rdepend) + sane = package_qa_handle_error("debug-deps", error_msg, 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 it isn't a build dependency?" % (pkg, rdepend) + sane = package_qa_handle_error("build-deps", error_msg, d) if "file-rdeps" not in skip: ignored_file_rdeps = set(['/bin/sh', '/usr/bin/env', 'rtld(GNU_HASH)']) @@ -905,6 +907,33 @@ def package_qa_check_deps(pkg, pkgdest, skip, d): return sane +QAPATHTEST[expanded-d] = "package_qa_check_expanded_d" +def package_qa_check_expanded_d(path,name,d,elf,messages): + """ + Check for the expanded D (${D}) value in pkg_* and FILES + variables, warn the user to use it correctly. + """ + + sane = True + expanded_d = d.getVar('D',True) + + # Get packages for current recipe and iterate + packages = d.getVar('PACKAGES', True).split(" ") + for pak in packages: + # Go through all variables and check if expanded D is found, warn the user accordingly + for var in 'FILES','pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm': + bbvar = d.getVar(var + "_" + pak) + if bbvar: + # Bitbake expands ${D} within bbvar during the previous step, so we check for its expanded value + if expanded_d in bbvar: + if var == 'FILES': + messages["expanded-d"] = "FILES in %s recipe should not contain the ${D} variable as it references the local build directory not the target filesystem, best solution is to remove the ${D} reference" % pak + sane = False + else: + messages["expanded-d"] = "%s in %s recipe contains ${D}, it should be replaced by $D instead" % (var, pak) + sane = False + return sane + # The PACKAGE FUNC to scan each package python do_package_qa () { import subprocess @@ -1111,7 +1140,7 @@ do_configure[postfuncs] += "do_qa_configure " python () { tests = d.getVar('ALL_QA', True).split() if "desktop" in tests: - d.appendVar("PACKAGE_DEPENDS", "desktop-file-utils-native") + d.appendVar("PACKAGE_DEPENDS", " desktop-file-utils-native") ########################################################################### # Check various variables |