kde5-functions.eclass: improve punt_bogus_deps
authorMichael Palimaka <kensington@gentoo.org>
Thu, 10 Mar 2016 19:03:57 +0000 (06:03 +1100)
committerMichael Palimaka <kensington@gentoo.org>
Sat, 12 Mar 2016 17:00:30 +0000 (04:00 +1100)
This extends coverage to individual components such as find_package(KF5DocTools).
It also improves cleaning up of empty find_package calls such as find_package(KF5).

eclass/kde5-functions.eclass

index 0a6a4347c61300b457a033a805c5ec427be6cc5b..34a7c924415769764491423103fd7adf3cf86501 100644 (file)
@@ -260,7 +260,7 @@ punt_bogus_dep() {
        local prefix=${1}
        local dep=${2}
 
-       pcregrep -Mni "(?s)find_package\s*\(\s*${prefix}.[^)]*?${dep}.*?\)" CMakeLists.txt > "${T}/bogus${dep}"
+       pcregrep -Mni "(?s)find_package\s*\(\s*${prefix}[^)]*?${dep}.*?\)" CMakeLists.txt > "${T}/bogus${dep}"
 
        # pcregrep returns non-zero on no matches/error
        if [[ $? != 0 ]] ; then
@@ -274,7 +274,7 @@ punt_bogus_dep() {
        sed -e "${first},${last}s/${dep}//" -i CMakeLists.txt || die
 
        if [[ ${length} = 1 ]] ; then
-               sed -e "/find_package\s*(\s*${prefix}\s*REQUIRED\s*COMPONENTS\s*)/I d" -i CMakeLists.txt || die
+               sed -e "/find_package\s*(\s*${prefix}\s*\(REQUIRED\)*\s*\(COMPONENTS\)*\s*)/I d" -i CMakeLists.txt || die
        fi
 }