/[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.9 Revision 1.11
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.9 2011/04/21 20:59:59 eva Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/fdo-mime.eclass,v 1.11 2011/08/09 18:43:05 darkside 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}
43 12
44# @FUNCTION: fdo-mime_desktop_database_update 13# @FUNCTION: fdo-mime_desktop_database_update
45# @DESCRIPTION: 14# @DESCRIPTION:
46# Updates the desktop database. 15# Updates the desktop database.
47# Generates a list of mimetypes linked to applications that can handle them 16# Generates a list of mimetypes linked to applications that can handle them
48fdo-mime_desktop_database_update() { 17fdo-mime_desktop_database_update() {
49 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" 18 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
50 local updater="${EROOT}${FDO_MIME_UPDATE_DESKTOP_BIN}" 19 if [ -x "${EPREFIX}/usr/bin/update-desktop-database" ]
51 20 then
52 if [ ! -x "${updater}" ]; then 21 einfo "Updating desktop mime database ..."
53 debug-print "${updater} is not executable" 22 "${EPREFIX}/usr/bin/update-desktop-database" -q "${EROOT}/usr/share/applications"
54 return
55 fi 23 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 $?
65} 24}
66 25
67# @FUNCTION: fdo-mime_mime_database_update 26# @FUNCTION: fdo-mime_mime_database_update
68# @DESCRIPTION: 27# @DESCRIPTION:
69# Update the mime database. 28# Update the mime database.
70# Creates a general list of mime types from several sources 29# Creates a general list of mime types from several sources
71fdo-mime_mime_database_update() { 30fdo-mime_mime_database_update() {
72 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" 31 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
73 local updater="${EROOT}${FDO_MIME_UPDATE_MIME_BIN}" 32 if [ -x "${EPREFIX}/usr/bin/update-mime-database" ]
74 33 then
75 if [ ! -x "${updater}" ]; then 34 einfo "Updating shared mime info database ..."
76 debug-print "${updater} is not executable" 35 "${EPREFIX}/usr/bin/update-mime-database" "${EROOT%/}/usr/share/mime"
77 return
78 fi 36 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 $?
88} 37}

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

  ViewVC Help
Powered by ViewVC 1.1.20