From fe43539f705335319c49a70dfa81d758def5bc8a Mon Sep 17 00:00:00 2001 From: David Seifert Date: Sun, 24 Sep 2017 11:07:36 +0200 Subject: cmake-utils.eclass: Add QA check for broken buildsystems Closes: https://github.com/gentoo/gentoo/pull/4757 --- eclass/cmake-utils.eclass | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'eclass') diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass index c6a52b8d9ae7..148fbc3cff33 100644 --- a/eclass/cmake-utils.eclass +++ b/eclass/cmake-utils.eclass @@ -93,6 +93,12 @@ _CMAKE_UTILS_ECLASS=1 # for econf and is needed to pass TRY_RUN results when cross-compiling. # Should be set by user in a per-package basis in /etc/portage/package.env. +# @ECLASS-VARIABLE: CMAKE_UTILS_QA_SRC_DIR_READONLY +# @DESCRIPTION: +# After running cmake-utils_src_prepare, sets ${S} to read-only. This is +# a user flag and should under _no circumstances_ be set in the ebuild. +# Helps in improving QA of build systems that write to source tree. + case ${EAPI} in 5) : ${CMAKE_WARN_UNUSED_CLI:=no} ;; 6) : ${CMAKE_WARN_UNUSED_CLI:=yes} ;; @@ -442,6 +448,11 @@ cmake-utils_src_prepare() { popd > /dev/null || die + # make ${S} read-only in order to detect broken build-systems + if [[ ${CMAKE_UTILS_QA_SRC_DIR_READONLY} && ! ${CMAKE_IN_SOURCE_BUILD} ]]; then + chmod -R a-w "${S}" + fi + _CMAKE_UTILS_SRC_PREPARE_HAS_RUN=1 } -- cgit v1.2.3-65-gdbad