diff options
author | Andreas Sturmlechner <asturm@gentoo.org> | 2022-07-09 10:40:13 +0200 |
---|---|---|
committer | Andreas Sturmlechner <asturm@gentoo.org> | 2022-08-22 22:10:22 +0200 |
commit | 4d2e29a57751d4e383b5bdf753ea18f8977d1cdd (patch) | |
tree | 8f96e35a95ff705e2671d7ac348c5df8b9677d8d /eclass | |
parent | dev-lua/penlight: drop 1.12.0 (diff) | |
download | gentoo-4d2e29a57751d4e383b5bdf753ea18f8977d1cdd.tar.gz gentoo-4d2e29a57751d4e383b5bdf753ea18f8977d1cdd.tar.bz2 gentoo-4d2e29a57751d4e383b5bdf753ea18f8977d1cdd.zip |
ecm.eclass: Support single dependency ecm_punt_bogus_dep call
Bringing back usefulness outside of KF5/Qt5 calls with multiple components.
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/ecm.eclass | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/eclass/ecm.eclass b/eclass/ecm.eclass index 3cc586b82d82..8febb9d22850 100644 --- a/eclass/ecm.eclass +++ b/eclass/ecm.eclass @@ -362,19 +362,32 @@ ecm_punt_qt_module() { } # @FUNCTION: ecm_punt_bogus_dep -# @USAGE: <prefix> <dependency> +# @USAGE: <dependency> or <prefix> <dependency> # @DESCRIPTION: -# Removes a specified dependency from a find_package call with multiple -# components. +# Removes a specified dependency from a find_package call, optionally +# supports prefix for find_package with multiple components. ecm_punt_bogus_dep() { - local prefix=${1} - local dep=${2} + + if [[ "$#" == 2 ]] ; then + local prefix=${1} + local dep=${2} + elif [[ "$#" == 1 ]] ; then + local dep=${1} + else + die "${FUNCNAME[0]} must be passed either one or two arguments" + fi if [[ ! -e "CMakeLists.txt" ]]; then return fi - pcregrep -Mni "(?s)find_package\s*\(\s*${prefix}[^)]*?${dep}.*?\)" CMakeLists.txt > "${T}/bogus${dep}" + if [[ -z ${prefix} ]]; then + sed -e "/find_package\s*(\s*${dep}\(\s\+\(REQUIRED\|CONFIG\|COMPONENTS\|\${[A-Z0-9_]*}\)\)\+\s*)/Is/^/# removed by ecm.eclass - /" \ + -i CMakeLists.txt || die + return + else + pcregrep -Mni "(?s)find_package\s*\(\s*${prefix}[^)]*?${dep}.*?\)" CMakeLists.txt > "${T}/bogus${dep}" + fi # pcregrep returns non-zero on no matches/error if [[ $? -ne 0 ]] ; then |