Move desktop entry handling to kde-functions.eclass and don't bother about applnk...
authorCarsten Lohrke <carlo@gentoo.org>
Thu, 19 Apr 2007 10:24:56 +0000 (10:24 +0000)
committerCarsten Lohrke <carlo@gentoo.org>
Thu, 19 Apr 2007 10:24:56 +0000 (10:24 +0000)
eclass/kde-functions.eclass
eclass/kde.eclass

index e3e327a9dd0655db35d0ab1ac0b4d6232ee96c1a..d83e38ce8da1574e57a60752dc7844df3de53d60 100644 (file)
@@ -1,13 +1,13 @@
 # Copyright 1999-2004 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/kde-functions.eclass,v 1.147 2007/04/12 14:01:42 carlo Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/kde-functions.eclass,v 1.148 2007/04/19 10:24:56 carlo Exp $
 #
 # Author Dan Armak <danarmak@gentoo.org>
 #
 # This contains everything except things that modify ebuild variables
 # and functions (e.g. $P, src_compile() etc.)
 
-inherit qt3
+inherit qt3 eutils
 
 # map of the monolithic->split ebuild derivation; used to build deps describing
 # the relationships between them
@@ -891,6 +891,9 @@ kde_remove_flag() {
 }
 
 buildsycoca() {
+       [[ $EBUILD_PHASE != postinst ]] && [[ $EBUILD_PHASE != postrm ]] && \
+               die "buildsycoca() has to be calles in pkg_postinst() and pkg_postrm()."
+
        if [[ -x ${KDEDIR}/bin/kbuildsycoca ]] && [[ -z ${ROOT} || ${ROOT} == "/" ]] && has "~${ARCH}" "${ACCEPT_KEYWORDS}"; then
                # First of all, make sure that the /usr/share/services directory exists
                # and it has the right permissions
@@ -904,6 +907,22 @@ buildsycoca() {
        fi
 }
 
+postprocess_desktop_entries() {
+       [[ $EBUILD_PHASE != preinst ]] && [[ $EBUILD_PHASE != install ]] && \
+               die "postprocess_desktop_entries() has to be called in src_install() or pkg_preinst()."
+
+       local desktop_entries="$(find "${D}${PREFIX}/share/applnk" -name '*.desktop' \
+               -not -path '*.hidden*' 2>/dev/null)"
+       if [[ -n ${desktop_entries} ]]; then
+               for entry in ${desktop_entries} ; do
+                       dodir ${PREFIX}/share/applications/kde
+                       mv ${entry} ${D}${PREFIX}/share/applications/kde
+               done
+       fi
+
+       validate_desktop_entries ${PREFIX}/share/applications
+}
+
 # is this a kde-base ebuid?
 if [ "${CATEGORY}" == "kde-base" ]; then
        debug-print "${ECLASS}: KDEBASE ebuild recognized"
index 4407c878902f08cf2a198e3a7e50aba1626459f5..ca47e5a43e384b224deac1fad25e51b38ec23616 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2004 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/kde.eclass,v 1.195 2007/04/11 17:56:18 carlo Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/kde.eclass,v 1.196 2007/04/19 10:24:56 carlo Exp $
 #
 # Author Dan Armak <danarmak@gentoo.org>
 #
@@ -446,13 +446,7 @@ slot_rebuild() {
 }
 
 kde_pkg_preinst() {
-       validate_desktop_entries ${PREFIX}/share/appl{nk,ications}
-       if [[ $(find "${D}${PREFIX}/share/applnk" -name '*.desktop' \
-               -not -path '*.hidden*' 2>/dev/null | wc -l) != "0" ]]; then
-               ewarn "This ebuild is installing .desktop files in the deprecated path"
-               ewarn "${PREFIX}/share/applnk/. They will only be visible within KDE."
-               echo ""
-       fi
+       postprocess_desktop_entries
 }
 
 kde_pkg_postinst() {