summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Seifert <soap@gentoo.org>2017-09-24 11:07:36 +0200
committerDavid Seifert <soap@gentoo.org>2017-09-24 12:34:34 +0200
commitfe43539f705335319c49a70dfa81d758def5bc8a (patch)
treea5fc27c0429294de359d9fe0708e9cb69830b1cd /eclass/cmake-utils.eclass
parentcmake-utils.eclass: Add QA check that cmake-utils_src_prepare was run (diff)
downloadgentoo-fe43539f705335319c49a70dfa81d758def5bc8a.tar.gz
gentoo-fe43539f705335319c49a70dfa81d758def5bc8a.tar.bz2
gentoo-fe43539f705335319c49a70dfa81d758def5bc8a.zip
cmake-utils.eclass: Add QA check for broken buildsystems
Closes: https://github.com/gentoo/gentoo/pull/4757
Diffstat (limited to 'eclass/cmake-utils.eclass')
-rw-r--r--eclass/cmake-utils.eclass11
1 files changed, 11 insertions, 0 deletions
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
}