/[gentoo-x86]/eclass/fdo-mime.eclass
Gentoo

Diff of /eclass/fdo-mime.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.8 Revision 1.9
1# Copyright 1999-2008 Gentoo Foundation 1# Copyright 1999-2008 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/fdo-mime.eclass,v 1.8 2008/12/23 01:28:49 solar Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/fdo-mime.eclass,v 1.9 2011/04/21 20:59:59 eva Exp $
4 4
5# @ECLASS: fdo-mime.eclass 5# @ECLASS: fdo-mime.eclass
6# @MAINTAINER: freedesktop-bugs@gentoo.org 6# @MAINTAINER: freedesktop-bugs@gentoo.org
7# 7#
8# 8#
9# Original author: foser <foser@gentoo.org> 9# Original author: foser <foser@gentoo.org>
10# @BLURB: Utility eclass to update the desktop mime info as laid out in the freedesktop specs & implementations 10# @BLURB: Utility eclass to update the desktop mime info as laid out in the freedesktop specs & implementations
11 11
12# @ECLASS-VARIABLE: FDO_MIME_UPDATE_DESKTOP_BIN
13# @DESCRIPTION:
14# Path to update-desktop-database
15: ${FDO_MIME_UPDATE_DESKTOP_BIN:="/usr/bin/update-desktop-database"}
16
17# @ECLASS-VARIABLE: FDO_MIME_UPDATE_MIME_BIN
18# @DESCRIPTION:
19# Path to update-mime-database
20: ${FDO_MIME_UPDATE_MIME_BIN:="/usr/bin/update-mime-database"}
21
22# @FUNCTION: fdo_mime_desktop_savelist
23# @DESCRIPTION:
24# Find the .desktop files that are about to be installed and save their location
25# in the FDO_MIME_DESKTOP_FILES environment variable
26fdo_mime_desktop_savelist() {
27 has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
28 pushd "${ED}" &> /dev/null
29 export FDO_MIME_DESKTOP_FILES=$(find 'usr/share/applications' -type f -name '*.desktop' 2> /dev/null)
30 popd &> /dev/null
31}
32
33# @FUNCTION: fdo_mime_mime_savelist
34# @DESCRIPTION:
35# Find the .desktop files that are about to be installed and save their location
36# in the FDO_MIME_MIME_FILES environment variable
37fdo_mime_mime_savelist() {
38 has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
39 pushd "${ED}" &> /dev/null
40 export FDO_MIME_MIME_FILES=$(find 'usr/share/mime' -type f -name '*.xml' 2> /dev/null)
41 popd &> /dev/null
42}
12 43
13# @FUNCTION: fdo-mime_desktop_database_update 44# @FUNCTION: fdo-mime_desktop_database_update
14# @DESCRIPTION: 45# @DESCRIPTION:
15# Updates the desktop database. 46# Updates the desktop database.
16# Generates a list of mimetypes linked to applications that can handle them 47# Generates a list of mimetypes linked to applications that can handle them
17fdo-mime_desktop_database_update() { 48fdo-mime_desktop_database_update() {
18 if [ -x "/usr/bin/update-desktop-database" ] 49 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
19 then 50 local updater="${EROOT}${FDO_MIME_UPDATE_DESKTOP_BIN}"
20 einfo "Updating desktop mime database ..." 51
21 "/usr/bin/update-desktop-database" -q "${ROOT}/usr/share/applications" 52 if [ ! -x "${updater}" ]; then
53 debug-print "${updater} is not executable"
54 return
22 fi 55 fi
56
57 if [ -z "${FDO_MIME_DESKTOP_FILES}" ]; then
58 debug-print "No desktop file to install"
59 return
60 fi
61
62 ebegin "Updating desktop mime database ..."
63 "${updater}" -q "${EROOT}/usr/share/applications"
64 eend $?
23} 65}
24 66
25# @FUNCTION: fdo-mime_mime_database_update 67# @FUNCTION: fdo-mime_mime_database_update
26# @DESCRIPTION: 68# @DESCRIPTION:
27# Update the mime database. 69# Update the mime database.
28# Creates a general list of mime types from several sources 70# Creates a general list of mime types from several sources
29fdo-mime_mime_database_update() { 71fdo-mime_mime_database_update() {
30 if [ -x "/usr/bin/update-mime-database" ] 72 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
31 then 73 local updater="${EROOT}${FDO_MIME_UPDATE_MIME_BIN}"
32 einfo "Updating shared mime info database ..." 74
33 "/usr/bin/update-mime-database" "${ROOT}/usr/share/mime" 75 if [ ! -x "${updater}" ]; then
76 debug-print "${updater} is not executable"
77 return
34 fi 78 fi
79
80 if [ -z "${FDO_MIME_MIME_FILES}" ]; then
81 debug-print "No desktop file to install"
82 return
83 fi
84
85 ebegin "Updating shared mime info database ..."
86 "${updater}" "${EROOT}/usr/share/mime"
87 eend $?
35} 88}

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

  ViewVC Help
Powered by ViewVC 1.1.20