mirror of
https://git.yoctoproject.org/poky
synced 2026-05-09 17:39:31 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
97850bbc8e
commit
3e9c480121
@@ -37,7 +37,7 @@ ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
|
|||||||
configure-gettext perllocalpod shebang-size \
|
configure-gettext perllocalpod shebang-size \
|
||||||
already-stripped installed-vs-shipped ldflags compile-host-path \
|
already-stripped installed-vs-shipped ldflags compile-host-path \
|
||||||
install-host-path pn-overrides unknown-configure-option \
|
install-host-path pn-overrides unknown-configure-option \
|
||||||
useless-rpaths rpaths staticdev \
|
useless-rpaths rpaths staticdev empty-dirs \
|
||||||
"
|
"
|
||||||
# Add usrmerge QA check based on distro feature
|
# Add usrmerge QA check based on distro feature
|
||||||
ERROR_QA:append = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', ' usrmerge', '', d)}"
|
ERROR_QA:append = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', ' usrmerge', '', d)}"
|
||||||
@@ -50,6 +50,21 @@ ALL_QA = "${WARN_QA} ${ERROR_QA}"
|
|||||||
|
|
||||||
UNKNOWN_CONFIGURE_WHITELIST ?= "--enable-nls --disable-nls --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot --disable-static"
|
UNKNOWN_CONFIGURE_WHITELIST ?= "--enable-nls --disable-nls --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot --disable-static"
|
||||||
|
|
||||||
|
# This is a list of directories that are expected to be empty.
|
||||||
|
QA_EMPTY_DIRS ?= " \
|
||||||
|
/dev/pts \
|
||||||
|
/media \
|
||||||
|
/proc \
|
||||||
|
/run \
|
||||||
|
/tmp \
|
||||||
|
${localstatedir}/run \
|
||||||
|
${localstatedir}/volatile \
|
||||||
|
"
|
||||||
|
# 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.
|
||||||
|
|
||||||
def package_qa_clean_path(path, d, pkg=None):
|
def package_qa_clean_path(path, d, pkg=None):
|
||||||
"""
|
"""
|
||||||
Remove redundant paths from the path for display. If pkg isn't set then
|
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):
|
|||||||
"listed in LICENSE" % (package, ' '.join(unlisted)))
|
"listed in LICENSE" % (package, ' '.join(unlisted)))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
QAPKGTEST[empty-dirs] = "package_qa_check_empty_dirs"
|
||||||
|
def package_qa_check_empty_dirs(pkg, d, messages):
|
||||||
|
"""
|
||||||
|
Check for the existence of files in directories that are expected to be
|
||||||
|
empty.
|
||||||
|
"""
|
||||||
|
|
||||||
|
pkgd = oe.path.join(d.getVar('PKGDEST'), pkg)
|
||||||
|
for dir in (d.getVar('QA_EMPTY_DIRS') or "").split():
|
||||||
|
empty_dir = oe.path.join(pkgd, dir)
|
||||||
|
if os.path.exists(empty_dir) and os.listdir(empty_dir):
|
||||||
|
recommendation = (d.getVar('QA_EMPTY_DIRS_RECOMMENDATION:' + dir) or
|
||||||
|
"but it is expected to be empty")
|
||||||
|
msg = "%s installs files in %s, %s" % (pkg, dir, recommendation)
|
||||||
|
oe.qa.add_message(messages, "empty-dirs", msg)
|
||||||
|
|
||||||
def package_qa_check_encoding(keys, encode, d):
|
def package_qa_check_encoding(keys, encode, d):
|
||||||
def check_encoding(key, enc):
|
def check_encoding(key, enc):
|
||||||
sane = True
|
sane = True
|
||||||
|
|||||||
@@ -345,6 +345,8 @@ PYPI_SRC_URI[doc] = "The URI to use to fetch from pypi, default uses pythonhoste
|
|||||||
|
|
||||||
#Q
|
#Q
|
||||||
|
|
||||||
|
QA_EMPTY_DIRS[doc] = "A list of directories that are expected to be empty."
|
||||||
|
QA_EMPTY_DIRS_RECOMMENDATION[doc] = "This specifies a recommendation for a directory why it must be empty, which will be included in the error message if the directory is not empty."
|
||||||
QMAKE_PROFILES[doc] = "Specifies your own subset of .pro files to be built for use with qmake."
|
QMAKE_PROFILES[doc] = "Specifies your own subset of .pro files to be built for use with qmake."
|
||||||
|
|
||||||
#R
|
#R
|
||||||
|
|||||||
Reference in New Issue
Block a user