All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mikko Rapeli <mikko.rapeli@bmw.de>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH RFC] insane.bbclass: add buildpaths_cmake and buildpaths_pkgconfig checks
Date: Tue, 25 Sep 2018 13:28:13 +0300	[thread overview]
Message-ID: <1537871293-32494-1-git-send-email-mikko.rapeli@bmw.de> (raw)

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@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



             reply	other threads:[~2018-09-25 10:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-25 10:28 Mikko Rapeli [this message]
2018-09-25 10:44 ` [PATCH RFC] insane.bbclass: add buildpaths_cmake and buildpaths_pkgconfig checks Mikko.Rapeli
2018-09-25 11:08   ` Richard Purdie
2018-09-25 11:21     ` Mikko.Rapeli
2018-09-25 15:19       ` richard.purdie
2018-09-25 17:11         ` Mikko.Rapeli
2018-09-25 18:29           ` richard.purdie
2018-09-25 20:28             ` Mikko.Rapeli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1537871293-32494-1-git-send-email-mikko.rapeli@bmw.de \
    --to=mikko.rapeli@bmw.de \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.