From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 808E7158287 for ; Sat, 17 May 2025 20:05:08 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id 686F2343340 for ; Sat, 17 May 2025 20:05:08 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id A7DFB1104A8; Sat, 17 May 2025 20:04:24 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id ED8381103DD for ; Sat, 17 May 2025 20:04:23 +0000 (UTC) Received: from tuxbrain.fritz.box (unknown [IPv6:2a04:9546:191d:b501:676c:7b0c:c3fa:aa8e]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: asturm) by smtp.gentoo.org (Postfix) with ESMTPSA id F298B33BEB9; Sat, 17 May 2025 20:04:22 +0000 (UTC) From: Andreas Sturmlechner To: gentoo-dev@lists.gentoo.org, kde@gentoo.org, base-system@gentoo.org Subject: [gentoo-dev] [PATCH] cmake.eclass: Add recursive CMakeLists.txt unsupported version detection Date: Sat, 17 May 2025 22:04:16 +0200 Message-ID: <12677532.O9o76ZdvQC@tuxbrain.fritz.box> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart5898279.DvuYhMxLoT"; micalg="pgp-sha512"; protocol="application/pgp-signature" X-Archives-Salt: 0f325ead-9b43-41b8-8f92-5d2feabbfc58 X-Archives-Hash: 5b243dd21ec62eb85160def05d5ad020 --nextPart5898279.DvuYhMxLoT Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8"; protected-headers="v1" From: Andreas Sturmlechner Date: Sat, 17 May 2025 22:04:16 +0200 Message-ID: <12677532.O9o76ZdvQC@tuxbrain.fritz.box> MIME-Version: 1.0 We need to ramp up detection of unsupported CMake build systems with CMake 4. This will detect CMakeLists.txt files setting insufficient cmake_minimum_required VERSION level even in project subdirectories, putting out appropriate eqawarn message about the need to fix ${PN}. That makes us not rely on tinderbox runs w/ unmasked cmake-4 slowly being able to build everything up to leaf packages, and also helps detect insufficient subproject minimums that could otherwise be masked by USE flag choice. Bug: https://bugs.gentoo.org/951350 Signed-off-by: Andreas Sturmlechner --- eclass/cmake.eclass | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass index 083b566d26..8a3f2db7c4 100644 --- a/eclass/cmake.eclass +++ b/eclass/cmake.eclass @@ -243,6 +243,25 @@ _cmake_modify-cmakelists() { # Only edit the files once grep -qs "<<< Gentoo configuration >>>" "${CMAKE_USE_DIR}"/CMakeLists.txt && return 0 + local x re="VERSION( .*\.\.\.| )(([[:digit:]]+)\.([[:digit:]]+))" + local ver isold + for x in $(find "${CMAKE_USE_DIR}" -type f -iname "CMakeLists.txt" -exec \ + grep -li "cmake_minimum_required\s*(.*)" {} \;); do + + [[ $(grep -hi "cmake_minimum_required" $x) =~ $re ]] + ver="${BASH_REMATCH[2]}" + + if ver_test $ver -lt "3.5"; then + isold=true + fi + done + if [[ ${isold} ]]; then + eqawarn "QA Notice: Compatibility with CMake < 3.5 has been removed from CMake 4," + eqawarn "${CATEGORY}/${PN} will fail to build w/o a fix." + eqawarn "See also tracker bug #951350; check existing bug or file a new one for" + eqawarn "this package." + fi + # Comment out all set ( value) find "${CMAKE_USE_DIR}" -name CMakeLists.txt -exec sed \ -e '/^[[:space:]]*set[[:space:]]*([[:space:]]*CMAKE_BUILD_TYPE\([[:space:]].*)\|)\)/I{s/^/#_cmake_modify_IGNORE /g}' \ @@ -250,7 +269,6 @@ _cmake_modify-cmakelists() { -e '/^[[:space:]]*set[[:space:]]*([[:space:]]*CMAKE_INSTALL_PREFIX[[:space:]].*)/I{s/^/#_cmake_modify_IGNORE /g}' \ -e '/^[[:space:]]*set[[:space:]]*([[:space:]]*CMAKE_VERBOSE_MAKEFILE[[:space:]].*)/I{s/^/#_cmake_modify_IGNORE /g}' \ -i {} + || die "${LINENO}: failed to disable hardcoded settings" - local x for x in $(find "${CMAKE_USE_DIR}" -name CMakeLists.txt -exec grep -l "^#_cmake_modify_IGNORE" {} +;); do einfo "Hardcoded definition(s) removed in $(echo "${x}" | cut -c $((${#CMAKE_USE_DIR}+2))-):" einfo "$(grep -se '^#_cmake_modify_IGNORE' ${x} | cut -c 22-99)" -- 2.49.0 --nextPart5898279.DvuYhMxLoT Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQITBAABCgB9FiEEmaksxp6GvcraXyZQrlkbvHPk3V4FAmgo68BfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDk5 QTkyQ0M2OUU4NkJEQ0FEQTVGMjY1MEFFNTkxQkJDNzNFNERENUUACgkQrlkbvHPk 3V7cfQwAlzY4f99TCRIBeIZ7kmukyKA59h9ZNE1SFk70F4LtH17bAiz7Ymw4byd1 FWxSVzd8jdRHEZ7bkm23DFhZR+E0dpvlmH6AcTo4ToNtLfwiNFxjRIY8Ph9SoVs5 3nKf8TVEmjMN9sN/XnSqTVXJeZS5Lb1LdNEX44QwidaJLQWfbhW/hjVDuWZoGIQs dcGWddrjBu8kv7iu2imgfE5ubZYsmUTUxvlB/p0tvVeNG56YQLni4EzhbrexUKIW 05mQVcwYmwIP8huK3l4bji5+3NrC5WvmMQJ5cr/YXKWiKJbRXjV2HDSSd8+0KZLj +XTIKtgqFAwolKTf1TuZZw8z1Zuf0fPrIJjO/h+p9HNC0Xtf8/uvaL5hQ0FESwIp bgRjjoJfeyu/sAsuptmSxIVMBnQk5AKTcZ7km+e0YQAyaU6D/iGQUmqiPDUDOFFQ bm7Z6GSShFLBH9vSOTmbunffGhNEJ4D24vCFcjO84VdLzSi5Xq1lghBMIVboaWtr Vm5mLLGo =rG3E -----END PGP SIGNATURE----- --nextPart5898279.DvuYhMxLoT--