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 11FE91581CA for ; Sat, 14 Jun 2025 10:49:53 +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) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id F04FA3424F9 for ; Sat, 14 Jun 2025 10:49:52 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id E89531104DE; Sat, 14 Jun 2025 10:49:47 +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) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id E05A71104DE for ; Sat, 14 Jun 2025 10:49:47 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6CB8B34246B for ; Sat, 14 Jun 2025 10:49:47 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 0D37629A6 for ; Sat, 14 Jun 2025 10:49:46 +0000 (UTC) From: "Andreas Sturmlechner" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Andreas Sturmlechner" Message-ID: <1749898062.3ad02c872f5ebaa5903411e81a74670a7f93ab73.asturm@gentoo> Subject: [gentoo-commits] proj/kde:master commit in: eclass/ X-VCS-Repository: proj/kde X-VCS-Files: eclass/cmake.eclass X-VCS-Directories: eclass/ X-VCS-Committer: asturm X-VCS-Committer-Name: Andreas Sturmlechner X-VCS-Revision: 3ad02c872f5ebaa5903411e81a74670a7f93ab73 X-VCS-Branch: master Date: Sat, 14 Jun 2025 10:49:46 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 65cce3e7-38de-4175-b25e-810958e495ba X-Archives-Hash: 8ce31534140deccdf33d477276ee349a commit: 3ad02c872f5ebaa5903411e81a74670a7f93ab73 Author: Andreas Sturmlechner gentoo org> AuthorDate: Fri Jun 13 14:42:37 2025 +0000 Commit: Andreas Sturmlechner gentoo org> CommitDate: Sat Jun 14 10:47:42 2025 +0000 URL: https://gitweb.gentoo.org/proj/kde.git/commit/?id=3ad02c87 cmake.eclass: mv _CMAKE_MINREQVER_UNSUPPORTED detection to src_prepare - _cmake_minverreq-lt(): New function for reusability of regex - Optimise #1: Reuse existing loop over CMakeLists.txt files - Optimise #2: If _CMAKE_MINREQVER_UNSUPPORTED is already set, then no further run of _cmake_minverreq-lt is necessary since we currently throw away the info on affected files - Relegate "CMake 4 detected; ..." to be a non-QA Notice, it is just an addendum Signed-off-by: Andreas Sturmlechner gentoo.org> eclass/cmake.eclass | 72 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 29 deletions(-) diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass index 47f96227d3..0ad1ca821b 100644 --- a/eclass/cmake.eclass +++ b/eclass/cmake.eclass @@ -126,7 +126,8 @@ fi # @ECLASS_VARIABLE: _CMAKE_MINREQVER_UNSUPPORTED # @DEFAULT_UNSET # @DESCRIPTION: -# Is set to true if an unsupported cmake_minimum_required value was detected. +# Internal status set by _cmake_minreqver-lt(); is true if an unsupported +# cmake_minimum_required value was detected. # @ECLASS_VARIABLE: CMAKE_QA_SRC_DIR_READONLY # @USER_VARIABLE @@ -243,6 +244,25 @@ _cmake_check_build_dir() { mkdir -p "${BUILD_DIR}" || die } +# @FUNCTION: _cmake_minreqver-lt +# @USAGE: +# @INTERNAL +# @DESCRIPTION: +# Internal function for detecting occurrence of lower-than-specified +# in cmake_minimum_required of a given CMake file . +# Returns 0 if the regex matched (a lower-than-specified version found). +_cmake_minreqver-lt() { + local ver chk=1 + ver=$(sed -ne "/cmake_minimum_required/I{s/.*\(\.\.\.*\|\s\)\([0-9.]*\)\([)]\|\s\).*$/\2/p;q}" \ + "${2}" 2>/dev/null \ + ) + if [[ -n ${ver} ]] && ver_test "${ver}" -lt "${1}"; then + _CMAKE_MINREQVER_UNSUPPORTED=true + chk=0 + fi + return ${chk} +} + # @FUNCTION: _cmake_modify-cmakelists # @INTERNAL # @DESCRIPTION: @@ -254,9 +274,9 @@ _cmake_modify-cmakelists() { # Only edit the files once grep -qs "<<< Gentoo configuration >>>" "${CMAKE_USE_DIR}"/CMakeLists.txt && return 0 - # Comment out all set ( value) local file while read -d '' -r file ; do + # Comment out all set ( value) sed \ -e '/^[[:space:]]*set[[:space:]]*([[:space:]]*CMAKE_BUILD_TYPE\([[:space:]].*)\|)\)/I{s/^/#_cmake_modify_IGNORE /g}' \ -e '/^[[:space:]]*set[[:space:]]*([[:space:]]*CMAKE_\(COLOR_MAKEFILE\|INSTALL_PREFIX\|VERBOSE_MAKEFILE\)[[:space:]].*)/I{s/^/#_cmake_modify_IGNORE /g}' \ @@ -269,7 +289,11 @@ _cmake_modify-cmakelists() { einfo "${mod_line:22:99}" done fi - done < <(find "${CMAKE_USE_DIR}" -type f -iname "CMakeLists.txt" -print0) + # Detect unsupported minimum CMake versions unless CMAKE_QA_COMPAT_SKIP is set + if [[ -z ${_CMAKE_MINREQVER_UNSUPPORTED} ]] && ! [[ ${CMAKE_QA_COMPAT_SKIP} ]]; then + _cmake_minreqver-lt "3.5" "${file}" + fi + done < <(find "${CMAKE_USE_DIR}" -type f -iname "CMakeLists.txt" -print0 || die) # NOTE Append some useful summary here cat >> "${CMAKE_USE_DIR}"/CMakeLists.txt <<- _EOF_ || die @@ -329,6 +353,20 @@ cmake_src_prepare() { # Remove dangerous things. _cmake_modify-cmakelists + if [[ ${_CMAKE_MINREQVER_UNSUPPORTED} ]]; 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, and take it upstream." + if has_version -b ">=dev-build/cmake-4"; then + eqawarn "CMake 4 detected; building with -DCMAKE_POLICY_VERSION_MINIMUM=3.5" + eqawarn "This is merely a workaround and *not* a permanent fix." + fi + if [[ ${EAPI} == 7 ]]; then + eqawarn "QA Notice: EAPI=7 detected; this package is now a prime last-rites target." + fi + fi + if [[ ${EAPI} == 7 ]]; then popd > /dev/null || die fi @@ -377,19 +415,6 @@ cmake_src_configure() { # Fix xdg collision with sandbox xdg_environment_reset - local file ver - if ! [[ ${CMAKE_QA_COMPAT_SKIP} ]]; then - while read -d '' -r file ; do - ver=$(sed -ne "/cmake_minimum_required/I{s/.*\(\.\.\.*\|\s\)\([0-9.]*\)\([)]\|\s\).*$/\2/p;q}" \ - "${file}" 2>/dev/null \ - ) - - if [[ -n $ver ]] && ver_test $ver -lt "3.5"; then - _CMAKE_MINREQVER_UNSUPPORTED=true - fi - done < <(find "${CMAKE_USE_DIR}" -type f -iname "CMakeLists.txt" -print0) - fi - # Prepare Gentoo override rules (set valid compiler, append CPPFLAGS etc.) local build_rules=${BUILD_DIR}/gentoo_rules.cmake @@ -571,19 +596,8 @@ cmake_src_configure() { cmakeargs+=( -C "${CMAKE_EXTRA_CACHE_FILE}" ) fi - if [[ ${_CMAKE_MINREQVER_UNSUPPORTED} ]]; 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, and take it upstream." - if has_version -b ">=dev-build/cmake-4"; then - eqawarn "QA Notice: CMake 4 detected; building with -DCMAKE_POLICY_VERSION_MINIMUM=3.5" - eqawarn "This is merely a workaround and *not* a permanent fix." - cmakeargs+=( -DCMAKE_POLICY_VERSION_MINIMUM=3.5 ) - fi - if [[ ${EAPI} == 7 ]]; then - eqawarn "QA Notice: EAPI=7 detected; this package is now a prime last-rites target." - fi + if [[ ${_CMAKE_MINREQVER_UNSUPPORTED} ]] && has_version -b ">=dev-build/cmake-4"; then + cmakeargs+=( -DCMAKE_POLICY_VERSION_MINIMUM=3.5 ) fi pushd "${BUILD_DIR}" > /dev/null || die