Sync kde5-functions.eclass with overlay.
authorManuel Rüger <mrueg@gentoo.org>
Sat, 9 May 2015 10:24:46 +0000 (10:24 +0000)
committerManuel Rüger <mrueg@gentoo.org>
Sat, 9 May 2015 10:24:46 +0000 (10:24 +0000)
eclass/ChangeLog
eclass/kde5-functions.eclass

index 2f5e33010027c352413a99b2c43a306a6e100052..e371dc3b102eaa45ddfdecdc77af9181b95d175b 100644 (file)
@@ -1,6 +1,9 @@
 # ChangeLog for eclass directory
 # Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1604 2015/05/09 10:22:36 mrueg Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1605 2015/05/09 10:24:46 mrueg Exp $
+
+  09 May 2015; Manuel Rüger <mrueg@gentoo.org> kde5-functions.eclass:
+  Sync with overlay.
 
   09 May 2015; Manuel Rüger <mrueg@gentoo.org> kde5.eclass:
   Sync with overlay.
index b0307765b9549c001cffe025f17c8732f33a8652..58a7b6ebef00caf694217b190d5d84765efd7d2c 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2015 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/kde5-functions.eclass,v 1.6 2015/04/11 17:11:22 kensington Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/kde5-functions.eclass,v 1.7 2015/05/09 10:24:46 mrueg Exp $
 
 # @ECLASS: kde5-functions.eclass
 # @MAINTAINER:
@@ -210,11 +210,30 @@ get_kde_version() {
        fi
 }
 
-# @FUNCTION: punt_bogus_deps
+# @FUNCTION: punt_bogus_dep
+# @USAGE: <prefix> <dependency>
 # @DESCRIPTION:
-# Remove hard-coded upstream dependencies that are not correct.
-punt_bogus_deps() {
-       sed -e "/find_package(Qt5 /s/ Test//" -i CMakeLists.txt || die
+# Removes a specified dependency from a find_package call with multiple components.
+punt_bogus_dep() {
+       local prefix=${1}
+       local dep=${2}
+
+       pcregrep -Mn "(?s)find_package\(\s*${prefix}.[^)]*?${dep}.*?\)" CMakeLists.txt > "${T}/bogus${dep}"
+
+       # pcregrep returns non-zero on no matches/error
+       if [[ $? != 0 ]] ; then
+               return
+       fi
+
+       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))
+
+       sed -e "${first},${last}s/${dep}//" -i CMakeLists.txt || die
+
+       if [[ ${length} = 1 ]] ; then
+               sed -e "/find_package(\s*${prefix}\s*REQUIRED\s*COMPONENTS\s*)/d" -i CMakeLists.txt || die
+       fi
 }
 
 fi