/[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.6 Revision 1.9
1# Copyright 1999-2004 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.6 2008/02/10 14:47:14 eva 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# Author: 5# @ECLASS: fdo-mime.eclass
6# @MAINTAINER: freedesktop-bugs@gentoo.org
7#
8#
6# 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
7 11
8# utility eclass to update the desktop mime info as laid out in the freedesktop specs & implementations 12# @ECLASS-VARIABLE: FDO_MIME_UPDATE_DESKTOP_BIN
9# <references here> 13# @DESCRIPTION:
14# Path to update-desktop-database
15: ${FDO_MIME_UPDATE_DESKTOP_BIN:="/usr/bin/update-desktop-database"}
10 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"}
11 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}
43
44# @FUNCTION: fdo-mime_desktop_database_update
45# @DESCRIPTION:
12# Updates the desktop database 46# Updates the desktop database.
13# 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
48fdo-mime_desktop_database_update() {
49 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
50 local updater="${EROOT}${FDO_MIME_UPDATE_DESKTOP_BIN}"
14 51
15fdo-mime_desktop_database_update() { 52 if [ ! -x "${updater}" ]; then
16 53 debug-print "${updater} is not executable"
17 if [ -x "${ROOT}/usr/bin/update-desktop-database" ] 54 return
18 then
19 einfo "Updating desktop mime database ..."
20 "${ROOT}/usr/bin/update-desktop-database" -q "${ROOT}/usr/share/applications"
21 fi 55 fi
22 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
67# @FUNCTION: fdo-mime_mime_database_update
68# @DESCRIPTION:
25# Update the mime database 69# Update the mime database.
26# Creates a general list of mime types from several sources 70# Creates a general list of mime types from several sources
71fdo-mime_mime_database_update() {
72 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
73 local updater="${EROOT}${FDO_MIME_UPDATE_MIME_BIN}"
27 74
28fdo-mime_mime_database_update() { 75 if [ ! -x "${updater}" ]; then
29 76 debug-print "${updater} is not executable"
30 if [ -x "${ROOT}/usr/bin/update-mime-database" ] 77 return
31 then
32 einfo "Updating shared mime info database ..."
33 "${ROOT}/usr/bin/update-mime-database" "${ROOT}/usr/share/mime"
34 fi 78 fi
35 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 $?
36} 88}

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

  ViewVC Help
Powered by ViewVC 1.1.20