[OE-core] [PATCH RFC] insane.bbclass: add buildpaths_cmake and buildpaths_pkgconfig checks
Mikko Rapeli
mikko.rapeli at bmw.de
Tue Sep 25 10:28:13 UTC 2018
And enable them by default as ERROR_QA. Reason is that
absolute build directory paths in CMake .cmake modules
and in pkg-config .pc files cause recipe builds to escape
their recipe specific sysroots and triggers hard to debug
and timing sensitive build failures. It's better to fail
early.
A failure from sumo version of libical looks like:
ERROR: libical-2.0.0-r0 do_package_qa: QA Issue: CMake module /work/i586-poky-linux/libical/2.0.0-r0/packages-split/libical-dev/usr/lib/cmake/LibIcal/LibIcalTargets-noconfig.cmake contains reference to tmpdir which causes build raceconditions between recipes [buildpaths_cmake]
ERROR: libical-2.0.0-r0 do_package_qa: QA run found fatal errors. Please consider fixing them.
ERROR: libical-2.0.0-r0 do_package_qa: Function failed: do_package_qa
ERROR: Logfile of failure stored in: /home/builder/src/yocto/poky/build/tmp/work/i586-poky-linux/libical/2.0.0-r0/temp/log.do_package_qa.4934
NOTE: recipe libical-2.0.0-r0: task do_package_qa: Failed
ERROR: Task (/home/builder/src/yocto/poky/meta/recipes-support/libical/libical_2.0.0.bb:do_package_qa) failed with exit code '1'
For some reason libical from poky master branch is not affected.
Signed-off-by: Mikko Rapeli <mikko.rapeli at bmw.de>
---
meta/classes/insane.bbclass | 30 +++++++++++++++++++++++++++---
1 file changed, 27 insertions(+), 3 deletions(-)
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index eb2d967..a69e3f8 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -33,7 +33,8 @@ ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
perms dep-cmp pkgvarcheck perm-config perm-line perm-link \
split-strip packages-list pkgv-undefined var-undefined \
version-going-backwards expanded-d invalid-chars \
- license-checksum dev-elf file-rdeps \
+ license-checksum dev-elf file-rdeps buildpaths_cmake \
+ buildpaths_pkgconfig \
"
# Add usrmerge QA check based on distro feature
ERROR_QA_append = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', ' usrmerge', '', d)}"
@@ -516,9 +517,30 @@ def package_qa_hash_style(path, name, d, elf, messages):
if has_syms and not sane:
package_qa_add_message(messages, "ldflags", "No GNU_HASH in the elf binary: '%s'" % path)
+QAPATHTEST[buildpaths_cmake] = "package_qa_check_buildpaths_cmake"
+def package_qa_check_buildpaths_cmake(path, name, d, elf, messages):
+ """
+ Check for build paths inside target CMake files which cause build
+ race conditions between recipes sysroots.
+ """
+ if path.lower().endswith(".cmake"):
+ message = "CMake module %s contains reference to tmpdir which causes build raceconditions between recipes" % package_qa_clean_path(path,d)
+ package_qa_check_buildpaths(path, name, d, elf, messages, qacheck="buildpaths_cmake", qamessage=message)
+
+
+QAPATHTEST[buildpaths_pkgconfig] = "package_qa_check_buildpaths_pkgconfig"
+def package_qa_check_buildpaths_pkgconfig(path, name, d, elf, messages):
+ """
+ Check for build paths inside target pkg-config files which cause build
+ race conditions between recipe sysroots.
+ """
+ if path.lower().endswith(".pc"):
+ message = "pkg-config file %s contains reference to tmpdir which causes build raceconditions between recipes" % package_qa_clean_path(path,d)
+ package_qa_check_buildpaths(path, name, d, elf, messages, qacheck="buildpaths_pkgconfig", qamessage=message)
+
QAPATHTEST[buildpaths] = "package_qa_check_buildpaths"
-def package_qa_check_buildpaths(path, name, d, elf, messages):
+def package_qa_check_buildpaths(path, name, d, elf, messages, qacheck="buildpaths", qamessage=None):
"""
Check for build paths inside target files and error if not found in the whitelist
"""
@@ -538,7 +560,9 @@ def package_qa_check_buildpaths(path, name, d, elf, messages):
with open(path, 'rb') as f:
file_content = f.read()
if tmpdir in file_content:
- package_qa_add_message(messages, "buildpaths", "File %s in package contained reference to tmpdir" % package_qa_clean_path(path,d))
+ if not qamessage:
+ qamessage = "File %s in package contained reference to tmpdir" % package_qa_clean_path(path,d)
+ package_qa_add_message(messages, qacheck, qamessage)
QAPATHTEST[xorg-driver-abi] = "package_qa_check_xorg_driver_abi"
--
1.9.1
More information about the Openembedded-core
mailing list