summaryrefslogtreecommitdiffstats
path: root/meta/classes/insane.bbclass
diff options
context:
space:
mode:
authorAlejandro Hernandez <alejandro.hernandez@linux.intel.com>2015-01-13 17:00:40 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-02-08 08:00:26 +0000
commit24d9d5a6eb3b48d392b7fa0bde1fc5c7a8392023 (patch)
tree71bcb8dccc06c0cde41ea40ee9be6c4d9767d0eb /meta/classes/insane.bbclass
parent1c5be7705ef32f3430fa4551b571e91192207d13 (diff)
downloadpoky-24d9d5a6eb3b48d392b7fa0bde1fc5c7a8392023.tar.gz
insane.bbclass: Added QA test for expanded ${D}
Checks in FILES and pkg_* variables, solves common mistake of using ${D} instead of $D and warns the user accordingly. [YOCTO #6642] (From OE-Core rev: e3ea62b370f69d2435e76f6e444f5d3a3b25eb17) Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/insane.bbclass')
-rw-r--r--meta/classes/insane.bbclass29
1 files changed, 28 insertions, 1 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index ea238a9101..061ce5b620 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -35,7 +35,7 @@ WARN_QA ?= "ldflags useless-rpaths rpaths staticdev libdir xorg-driver-abi \
35ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \ 35ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
36 perms dep-cmp pkgvarcheck perm-config perm-line perm-link \ 36 perms dep-cmp pkgvarcheck perm-config perm-line perm-link \
37 split-strip packages-list pkgv-undefined var-undefined \ 37 split-strip packages-list pkgv-undefined var-undefined \
38 version-going-backwards \ 38 version-going-backwards expanded-d \
39 " 39 "
40 40
41ALL_QA = "${WARN_QA} ${ERROR_QA}" 41ALL_QA = "${WARN_QA} ${ERROR_QA}"
@@ -907,6 +907,33 @@ def package_qa_check_deps(pkg, pkgdest, skip, d):
907 907
908 return sane 908 return sane
909 909
910QAPATHTEST[expanded-d] = "package_qa_check_expanded_d"
911def package_qa_check_expanded_d(path,name,d,elf,messages):
912 """
913 Check for the expanded D (${D}) value in pkg_* and FILES
914 variables, warn the user to use it correctly.
915 """
916
917 sane = True
918 expanded_d = d.getVar('D',True)
919
920 # Get packages for current recipe and iterate
921 packages = d.getVar('PACKAGES', True).split(" ")
922 for pak in packages:
923 # Go through all variables and check if expanded D is found, warn the user accordingly
924 for var in 'FILES','pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm':
925 bbvar = d.getVar(var + "_" + pak)
926 if bbvar:
927 # Bitbake expands ${D} within bbvar during the previous step, so we check for its expanded value
928 if expanded_d in bbvar:
929 if var == 'FILES':
930 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
931 sane = False
932 else:
933 messages["expanded-d"] = "%s in %s recipe contains ${D}, it should be replaced by $D instead" % (var, pak)
934 sane = False
935 return sane
936
910# The PACKAGE FUNC to scan each package 937# The PACKAGE FUNC to scan each package
911python do_package_qa () { 938python do_package_qa () {
912 import subprocess 939 import subprocess