Gentoo Archives: gentoo-dev

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] [PATCH] cmake-utils.eclass: Fix _cmake_modify-cmakelists, add QA output
Date: Sun, 24 Feb 2019 14:08:44
Message-Id: 1954562.JRVcTd7PAm@tuxk10
1 Bug: https://bugs.gentoo.org/674768
2 ---
3 eclass/cmake-utils.eclass | 18 +++++++++++-------
4 1 file changed, 11 insertions(+), 7 deletions(-)
5
6 diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
7 index 77c6d0481c..42a108976f 100644
8 --- a/eclass/cmake-utils.eclass
9 +++ b/eclass/cmake-utils.eclass
10 @@ -419,13 +419,17 @@ _cmake_modify-cmakelists() {
11 grep -qs "<<< Gentoo configuration >>>" "${CMAKE_USE_DIR}"/CMakeLists.txt && return 0
12
13 # Comment out all set (<some_should_be_user_defined_variable> value)
14 - # TODO Add QA checker - inform when variable being checked for below is set in CMakeLists.txt
15 - find "${CMAKE_USE_DIR}" -name CMakeLists.txt \
16 - -exec sed -i -e '/^[[:space:]]*[sS][eE][tT][[:space:]]*([[:space:]]*CMAKE_BUILD_TYPE.*)/{s/^/#IGNORE /g}' {} + \
17 - -exec sed -i -e '/^[[:space:]]*[sS][eE][tT][[:space:]]*([[:space:]]*CMAKE_COLOR_MAKEFILE.*)/{s/^/#IGNORE /g}' {} + \
18 - -exec sed -i -e '/^[[:space:]]*[sS][eE][tT][[:space:]]*([[:space:]]*CMAKE_INSTALL_PREFIX.*)/{s/^/#IGNORE /g}' {} + \
19 - -exec sed -i -e '/^[[:space:]]*[sS][eE][tT][[:space:]]*([[:space:]]*CMAKE_VERBOSE_MAKEFILE.*)/{s/^/#IGNORE /g}' {} + \
20 - || die "${LINENO}: failed to disable hardcoded settings"
21 + find "${CMAKE_USE_DIR}" -name CMakeLists.txt -exec sed \
22 + -e '/^[[:space:]]*set[[:space:]]*([[:space:]]*CMAKE_BUILD_TYPE[[:space:]].*)/I{s/^/#_cmake_modify_IGNORE /g}' \
23 + -e '/^[[:space:]]*set[[:space:]]*([[:space:]]*CMAKE_COLOR_MAKEFILE[[:space:]].*)/I{s/^/#_cmake_modify_IGNORE /g}' \
24 + -e '/^[[:space:]]*set[[:space:]]*([[:space:]]*CMAKE_INSTALL_PREFIX[[:space:]].*)/I{s/^/#_cmake_modify_IGNORE /g}' \
25 + -e '/^[[:space:]]*set[[:space:]]*([[:space:]]*CMAKE_VERBOSE_MAKEFILE[[:space:]].*)/I{s/^/#G_cmake_modify_IGNORE /g}' \
26 + -i {} + || die "${LINENO}: failed to disable hardcoded settings"
27 + local x
28 + for x in $(find "${CMAKE_USE_DIR}" -name CMakeLists.txt -exec grep -l "^#_cmake_modify_IGNORE" {} +;); do
29 + eqawarn "Hardcoded definition(s) removed in $(echo "${x}" | cut -c $((${#CMAKE_USE_DIR}+2))-):"
30 + eqawarn "$(grep -se '^#_cmake_modify_IGNORE' ${x} | cut -c 22-99)"
31 + done
32
33 # NOTE Append some useful summary here
34 cat >> "${CMAKE_USE_DIR}"/CMakeLists.txt <<- _EOF_ || die
35 --
36 2.20.1