commit:     fe43539f705335319c49a70dfa81d758def5bc8a
Author:     David Seifert <soap <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 24 09:07:36 2017 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Sun Sep 24 10:34:34 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fe43539f

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(+)

diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
index c6a52b8d9ae..148fbc3cff3 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
 }
 

Reply via email to