diff options
| author | Peter Kjellerstedt <peter.kjellerstedt@axis.com> | 2021-11-13 13:25:16 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-11-21 11:41:39 +0000 |
| commit | b6b0af0889de9da0e4128cef8c9069b770b7d5a0 (patch) | |
| tree | 0d0d747acc26e4343acaec68b130877efdeea357 /meta/classes | |
| parent | 9594c5893ba5abde3dae87a39ff262ae078aab8b (diff) | |
| download | poky-b6b0af0889de9da0e4128cef8c9069b770b7d5a0.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.
Compared to the corresponding patch for master, there are two
differences:
* "/var/volatile" is not added to QA_EMPTY_DIRS by default, and
* "empty-dirs" is not enabled in ERROR_QA (nor in WARN_QA).
(From OE-Core rev: 9f3fbfc02ae6fadffbcc1bda1fa75dfe140d05c5)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
| -rw-r--r-- | meta/classes/insane.bbclass | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass index f2d2ca3689..bfaf2577d0 100644 --- a/meta/classes/insane.bbclass +++ b/meta/classes/insane.bbclass | |||
| @@ -50,6 +50,20 @@ ALL_QA = "${WARN_QA} ${ERROR_QA}" | |||
| 50 | 50 | ||
| 51 | UNKNOWN_CONFIGURE_WHITELIST ?= "--enable-nls --disable-nls --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot --disable-static" | 51 | UNKNOWN_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. | ||
| 54 | QA_EMPTY_DIRS ?= " \ | ||
| 55 | /dev/pts \ | ||
| 56 | /media \ | ||
| 57 | /proc \ | ||
| 58 | /run \ | ||
| 59 | /tmp \ | ||
| 60 | ${localstatedir}/run \ | ||
| 61 | " | ||
| 62 | # It is possible to specify why a directory is expected to be empty by defining | ||
| 63 | # QA_EMPTY_DIRS_RECOMMENDATION:<path>, which will then be included in the error | ||
| 64 | # message if the directory is not empty. If it is not specified for a directory, | ||
| 65 | # then "but it is expected to be empty" will be used. | ||
| 66 | |||
| 53 | def package_qa_clean_path(path, d, pkg=None): | 67 | def package_qa_clean_path(path, d, pkg=None): |
| 54 | """ | 68 | """ |
| 55 | Remove redundant paths from the path for display. If pkg isn't set then | 69 | Remove redundant paths from the path for display. If pkg isn't set then |
| @@ -917,6 +931,22 @@ def package_qa_check_unlisted_pkg_lics(package, d, messages): | |||
| 917 | "listed in LICENSE" % (package, ' '.join(unlisted))) | 931 | "listed in LICENSE" % (package, ' '.join(unlisted))) |
| 918 | return False | 932 | return False |
| 919 | 933 | ||
| 934 | QAPKGTEST[empty-dirs] = "package_qa_check_empty_dirs" | ||
| 935 | def package_qa_check_empty_dirs(pkg, d, messages): | ||
| 936 | """ | ||
| 937 | Check for the existence of files in directories that are expected to be | ||
| 938 | empty. | ||
| 939 | """ | ||
| 940 | |||
| 941 | pkgd = oe.path.join(d.getVar('PKGDEST'), pkg) | ||
| 942 | for dir in (d.getVar('QA_EMPTY_DIRS') or "").split(): | ||
| 943 | empty_dir = oe.path.join(pkgd, dir) | ||
| 944 | if os.path.exists(empty_dir) and os.listdir(empty_dir): | ||
| 945 | recommendation = (d.getVar('QA_EMPTY_DIRS_RECOMMENDATION:' + dir) or | ||
| 946 | "but it is expected to be empty") | ||
| 947 | msg = "%s installs files in %s, %s" % (pkg, dir, recommendation) | ||
| 948 | oe.qa.add_message(messages, "empty-dirs", msg) | ||
| 949 | |||
| 920 | def package_qa_check_encoding(keys, encode, d): | 950 | def package_qa_check_encoding(keys, encode, d): |
| 921 | def check_encoding(key, enc): | 951 | def check_encoding(key, enc): |
| 922 | sane = True | 952 | sane = True |
