diff options
| -rw-r--r-- | meta/classes/insane.bbclass | 29 |
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 \ | |||
| 35 | ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \ | 35 | ERROR_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 | ||
| 41 | ALL_QA = "${WARN_QA} ${ERROR_QA}" | 41 | ALL_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 | ||
| 910 | QAPATHTEST[expanded-d] = "package_qa_check_expanded_d" | ||
| 911 | def 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 |
| 911 | python do_package_qa () { | 938 | python do_package_qa () { |
| 912 | import subprocess | 939 | import subprocess |
