diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-02-03 16:54:00 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-02-06 13:12:18 +0000 |
commit | 316228948e65f376f6c5be13ccd0c964ea630edf (patch) | |
tree | 07d03cfd8f5310cda5ecc2890b535571a7b983c2 | |
parent | 7e880a95840db82f4035959b03630ba2a96c0311 (diff) | |
download | openembedded-core-316228948e65f376f6c5be13ccd0c964ea630edf.tar.gz openembedded-core-316228948e65f376f6c5be13ccd0c964ea630edf.tar.bz2 openembedded-core-316228948e65f376f6c5be13ccd0c964ea630edf.zip |
insane.bbclass: Add pkgvarcheck to check for suboptimal usages of variables
Check through the variables:
'RDEPENDS', 'RRECOMMENDS', 'FILES', 'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm'
and if there is a variable set which isn't package specific, inform the user
of this.
Using these variables without a package suffix is bad practise and complicates
dependencies of packages unnecessarily as well as complicates the code. Lets
convert the remaining issues and then we can take the small performance gain.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/insane.bbclass | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass index 5dfa5aaec4..3375a41ff6 100644 --- a/meta/classes/insane.bbclass +++ b/meta/classes/insane.bbclass @@ -114,7 +114,7 @@ def package_qa_get_machine_dict(): # Currently not being used by default "desktop" WARN_QA ?= "ldflags useless-rpaths rpaths staticdev libdir xorg-driver-abi textrel" -ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch la2 pkgconfig la perms dep-cmp" +ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch la2 pkgconfig la perms dep-cmp pkgvarcheck" ALL_QA = "${WARN_QA} ${ERROR_QA}" @@ -885,4 +885,12 @@ python () { tests = d.getVar('ALL_QA', True).split() if "desktop" in tests: d.appendVar("PACKAGE_DEPENDS", "desktop-file-utils-native") + + issues = [] + if (d.getVar('PACKAGES', True) or "").split(): + for var in 'RDEPENDS', 'RRECOMMENDS', 'FILES', 'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm': + if d.getVar(var): + issues.append(var) + 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) } |