summaryrefslogtreecommitdiffstats
path: root/meta/classes/insane.bbclass
diff options
context:
space:
mode:
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>2021-11-02 20:57:25 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-11-03 11:12:26 +0000
commit3e9c4801216111496acffdfdccf1deae3b3d6b96 (patch)
tree0b911d9d499ec00083d3096f4db2a7d160ee3655 /meta/classes/insane.bbclass
parent97850bbc8ea2d2a21212f37055a934dc50ab9363 (diff)
downloadpoky-3e9c4801216111496acffdfdccf1deae3b3d6b96.tar.gz
insane.bbclass: Add a check for directories that are expected to be empty
The empty-dirs QA check verifies that all directories specified in QA_EMPTY_DIRS are empty. It is possible to specify why a directory is expected to be empty by defining QA_EMPTY_DIRS_RECOMMENDATION:<path>, which will then be included in the error message if the directory is not empty. If it is not specified for a directory, then "but it is expected to be empty" will be used. (From OE-Core rev: a454fda9c3d6b11cfdc54a49a7bb3f8a76a5ed58) Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> 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, 32 insertions, 1 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 1e2f1b768a..1675adf6ac 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -37,7 +37,7 @@ ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
37 configure-gettext perllocalpod shebang-size \ 37 configure-gettext perllocalpod shebang-size \
38 already-stripped installed-vs-shipped ldflags compile-host-path \ 38 already-stripped installed-vs-shipped ldflags compile-host-path \
39 install-host-path pn-overrides unknown-configure-option \ 39 install-host-path pn-overrides unknown-configure-option \
40 useless-rpaths rpaths staticdev \ 40 useless-rpaths rpaths staticdev empty-dirs \
41 " 41 "
42# Add usrmerge QA check based on distro feature 42# Add usrmerge QA check based on distro feature
43ERROR_QA:append = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', ' usrmerge', '', d)}" 43ERROR_QA:append = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', ' usrmerge', '', d)}"
@@ -50,6 +50,21 @@ ALL_QA = "${WARN_QA} ${ERROR_QA}"
50 50
51UNKNOWN_CONFIGURE_WHITELIST ?= "--enable-nls --disable-nls --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot --disable-static" 51UNKNOWN_CONFIGURE_WHITELIST ?= "--enable-nls --disable-nls --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot --disable-static"
52 52
53# This is a list of directories that are expected to be empty.
54QA_EMPTY_DIRS ?= " \
55 /dev/pts \
56 /media \
57 /proc \
58 /run \
59 /tmp \
60 ${localstatedir}/run \
61 ${localstatedir}/volatile \
62"
63# It is possible to specify why a directory is expected to be empty by defining
64# QA_EMPTY_DIRS_RECOMMENDATION:<path>, which will then be included in the error
65# message if the directory is not empty. If it is not specified for a directory,
66# then "but it is expected to be empty" will be used.
67
53def package_qa_clean_path(path, d, pkg=None): 68def package_qa_clean_path(path, d, pkg=None):
54 """ 69 """
55 Remove redundant paths from the path for display. If pkg isn't set then 70 Remove redundant paths from the path for display. If pkg isn't set then
@@ -885,6 +900,22 @@ def package_qa_check_unlisted_pkg_lics(package, d, messages):
885 "listed in LICENSE" % (package, ' '.join(unlisted))) 900 "listed in LICENSE" % (package, ' '.join(unlisted)))
886 return False 901 return False
887 902
903QAPKGTEST[empty-dirs] = "package_qa_check_empty_dirs"
904def package_qa_check_empty_dirs(pkg, d, messages):
905 """
906 Check for the existence of files in directories that are expected to be
907 empty.
908 """
909
910 pkgd = oe.path.join(d.getVar('PKGDEST'), pkg)
911 for dir in (d.getVar('QA_EMPTY_DIRS') or "").split():
912 empty_dir = oe.path.join(pkgd, dir)
913 if os.path.exists(empty_dir) and os.listdir(empty_dir):
914 recommendation = (d.getVar('QA_EMPTY_DIRS_RECOMMENDATION:' + dir) or
915 "but it is expected to be empty")
916 msg = "%s installs files in %s, %s" % (pkg, dir, recommendation)
917 oe.qa.add_message(messages, "empty-dirs", msg)
918
888def package_qa_check_encoding(keys, encode, d): 919def package_qa_check_encoding(keys, encode, d):
889 def check_encoding(key, enc): 920 def check_encoding(key, enc):
890 sane = True 921 sane = True