From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id A9EE3158086 for ; Wed, 29 Dec 2021 18:46:06 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id CBCCE2BC008; Wed, 29 Dec 2021 18:46:05 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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) by pigeon.gentoo.org (Postfix) with ESMTPS id 102D72BC008 for ; Wed, 29 Dec 2021 18:46:04 +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 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 04604342C3E for ; Wed, 29 Dec 2021 18:46:03 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 3AAE8261 for ; Wed, 29 Dec 2021 18:46:01 +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: <1640803462.a8e2d266582bcc9c91e3a45ac4aa41859a3f4a13.asturm@gentoo> Subject: [gentoo-commits] proj/kde:master commit in: eclass/ X-VCS-Repository: proj/kde X-VCS-Files: eclass/ecm.eclass X-VCS-Directories: eclass/ X-VCS-Committer: asturm X-VCS-Committer-Name: Andreas Sturmlechner X-VCS-Revision: a8e2d266582bcc9c91e3a45ac4aa41859a3f4a13 X-VCS-Branch: master Date: Wed, 29 Dec 2021 18:46:01 +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: 25e77ae8-5cad-42d8-9efc-f2b6646a7b1c X-Archives-Hash: cd698cc924f34c0758d608c9b19aaba3 commit: a8e2d266582bcc9c91e3a45ac4aa41859a3f4a13 Author: Andreas Sturmlechner gentoo org> AuthorDate: Wed Dec 29 15:38:48 2021 +0000 Commit: Andreas Sturmlechner gentoo org> CommitDate: Wed Dec 29 18:44:22 2021 +0000 URL: https://gitweb.gentoo.org/proj/kde.git/commit/?id=a8e2d266 ecm.eclass: Introduce ecm_punt_kf_module and ecm_punt_qt_module Upstream has begun replacing find_package(Qt5 ...) with find_package(Qt${QT_MAJOR_VERSION}) ...) for optional build with Qt6 - this breaks existing ecm_punt_bogus_dep() regexps. There is no known usage of ecm_punt_bogus_dep with anything else than Qt5 or KF5, so simply replace it with two public functions fixed on Qt* and KF* module removal. Signed-off-by: Andreas Sturmlechner gentoo.org> eclass/ecm.eclass | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/eclass/ecm.eclass b/eclass/ecm.eclass index baece9e6e6..9903eeef3e 100644 --- a/eclass/ecm.eclass +++ b/eclass/ecm.eclass @@ -312,6 +312,56 @@ _ecm_strip_handbook_translations() { done } +# @FUNCTION: _ecm_punt_kfqt_module +# @USAGE: +# @INTERNAL +# @DESCRIPTION: +# Removes a specified dependency from a find_package call with multiple +# components. +_ecm_punt_kfqt_module() { + local prefix=${1} + local dep=${2} + + [[ ! -e "CMakeLists.txt" ]] && return + + # FIXME: dep=WebKit will result in 'Widgets' over 'WebKitWidgets' (no regression) + pcregrep -Mni "(?s)find_package\s*\(\s*${prefix}(\d+|\\$\{\w*\})[^)]*?${dep}.*?\)" \ + CMakeLists.txt > "${T}/bogus${dep}" + + # pcregrep returns non-zero on no matches/error + [[ $? -ne 0 ]] && return + + local length=$(wc -l "${T}/bogus${dep}" | cut -d " " -f 1) + local first=$(head -n 1 "${T}/bogus${dep}" | cut -d ":" -f 1) + local last=$(( length + first - 1)) + + # FIXME: may leave empty find_package($prefix) behind (no regression, non-trivial) + sed -e "${first},${last}s/${dep}//" -i CMakeLists.txt || die + + if [[ ${length} -eq 1 ]] ; then + sed -e "/find_package\s*(\s*${prefix}\([0-9]|\${[A-Z0-9_]*}\)\(\s\+\(REQUIRED\|CONFIG\|COMPONENTS\|\${[A-Z0-9_]*}\)\)\+\s*)/Is/^/# removed by ecm.eclass - /" \ + -i CMakeLists.txt || die + fi +} + +# @FUNCTION: ecm_punt_kf_module +# @USAGE: +# @DESCRIPTION: +# Removes a Frameworks (KF - matching any single-digit version) +# module from a find_package call with multiple components. +ecm_punt_kf_module() { + _ecm_punt_kfqt_module kf ${1} +} + +# @FUNCTION: ecm_punt_qt_module +# @USAGE: +# @DESCRIPTION: +# Removes a Qt (matching any single-digit version) module from a +# find_package call with multiple components. +ecm_punt_qt_module() { + _ecm_punt_kfqt_module qt ${1} +} + # @FUNCTION: ecm_punt_bogus_dep # @USAGE: # @DESCRIPTION: