/[gentoo-x86]/eclass/gnome2-utils.eclass
Gentoo

Diff of /eclass/gnome2-utils.eclass

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

Revision 1.21 Revision 1.22
1# Copyright 1999-2006 Gentoo Foundation 1# Copyright 1999-2006 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/gnome2-utils.eclass,v 1.21 2011/01/31 17:03:45 eva Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v 1.22 2011/04/03 18:12:34 eva Exp $
4 4
5#
6# gnome2-utils.eclass 5# @ECLASS: gnome2-utils.eclass
7# 6# @MAINTAINER:
8# Set of auxiliary functions used to perform actions commonly needed by packages 7# gnome@gentoo.org
9# using the GNOME framework. 8# @BLURB: Auxiliary functions commonly used by Gnome packages.
10# 9# @DESCRIPTION:
11# Maintained by Gentoo's GNOME herd <gnome@gentoo.org> 10# This eclass provides a set of auxiliary functions needed by most Gnome
12# 11# packages. It may be used by non-Gnome packages as needed for handling various
12# Gnome stack related functions such as:
13# * Gtk+ icon cache management
14# * GSettings schemas management
15# * GConf schemas management
16# * scrollkeeper (old Gnome help system) management
13 17
14case "${EAPI:-0}" in 18case "${EAPI:-0}" in
15 0|1|2|3|4) ;; 19 0|1|2|3|4) ;;
16 *) die "EAPI=${EAPI} is not supported" ;; 20 *) die "EAPI=${EAPI} is not supported" ;;
17esac 21esac
18 22
23# @ECLASS-VARIABLE: GCONFTOOL_BIN
24# @INTERNAL
25# @DESCRIPTION:
19# Path to gconftool-2 26# Path to gconftool-2
20: ${GCONFTOOL_BIN:="/usr/bin/gconftool-2"} 27: ${GCONFTOOL_BIN:="/usr/bin/gconftool-2"}
21 28
29# @ECLASS-VARIABLE: SCROLLKEEPER_DIR
30# @INTERNAL
31# @DESCRIPTION:
22# Directory where scrollkeeper-update should do its work 32# Directory where scrollkeeper-update should do its work
23: ${SCROLLKEEPER_DIR:="/var/lib/scrollkeeper"} 33: ${SCROLLKEEPER_DIR:="/var/lib/scrollkeeper"}
24 34
35# @ECLASS-VARIABLE: SCROLLKEEPER_UPDATE_BIN
36# @INTERNAL
37# @DESCRIPTION:
25# Path to scrollkeeper-update 38# Path to scrollkeeper-update
26: ${SCROLLKEEPER_UPDATE_BIN:="/usr/bin/scrollkeeper-update"} 39: ${SCROLLKEEPER_UPDATE_BIN:="/usr/bin/scrollkeeper-update"}
27 40
41# @ECLASS-VARIABLE: GTK_UPDATE_ICON_CACHE
42# @INTERNAL
43# @DESCRIPTION:
28# Path to gtk-update-icon-cache 44# Path to gtk-update-icon-cache
29: ${GTK_UPDATE_ICON_CACHE:="/usr/bin/gtk-update-icon-cache"} 45: ${GTK_UPDATE_ICON_CACHE:="/usr/bin/gtk-update-icon-cache"}
30 46
47# @ECLASS-VARIABLE: GLIB_COMPILE_SCHEMAS
48# @INTERNAL
49# @DESCRIPTION:
31# Path to glib-compile-schemas 50# Path to glib-compile-schemas
32: ${GLIB_COMPILE_SCHEMAS:="/usr/bin/glib-compile-schemas"} 51: ${GLIB_COMPILE_SCHEMAS:="/usr/bin/glib-compile-schemas"}
33 52
53# @ECLASS-VARIABLE: GNOME2_ECLASS_SCHEMAS
54# @INTERNAL
55# @DEFAULT_UNSET
56# @DESCRIPTION:
57# List of GConf schemas provided by the package
58
59# @ECLASS-VARIABLE: GNOME2_ECLASS_ICONS
60# @INTERNAL
61# @DEFAULT_UNSET
62# @DESCRIPTION:
63# List of icons provided by the package
64
65# @ECLASS-VARIABLE: GNOME2_ECLASS_GLIB_SCHEMAS
66# @INTERNAL
67# @DEFAULT_UNSET
68# @DESCRIPTION:
69# List of GSettings schemas provided by the package
34 70
35 71
36DEPEND=">=sys-apps/sed-4" 72DEPEND=">=sys-apps/sed-4"
37 73
38 74
39 75# @FUNCTION: gnome2_gconf_savelist
76# @DESCRIPTION:
40# Find the GConf schemas that are about to be installed and save their location 77# Find the GConf schemas that are about to be installed and save their location
41# in the GNOME2_ECLASS_SCHEMAS environment variable 78# in the GNOME2_ECLASS_SCHEMAS environment variable.
79# This function should be called from pkg_preinst.
42gnome2_gconf_savelist() { 80gnome2_gconf_savelist() {
43 has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}" 81 has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
44 pushd "${ED}" &> /dev/null 82 pushd "${ED}" &> /dev/null
45 export GNOME2_ECLASS_SCHEMAS=$(find 'etc/gconf/schemas/' -name '*.schemas' 2> /dev/null) 83 export GNOME2_ECLASS_SCHEMAS=$(find 'etc/gconf/schemas/' -name '*.schemas' 2> /dev/null)
46 popd &> /dev/null 84 popd &> /dev/null
47} 85}
48 86
49 87# @FUNCTION: gnome2_gconf_install
88# @DESCRIPTION:
50# Applies any schema files installed by the current ebuild to Gconf's database 89# Applies any schema files installed by the current ebuild to Gconf's database
51# using gconftool-2 90# using gconftool-2.
91# This function should be called from pkg_postinst.
52gnome2_gconf_install() { 92gnome2_gconf_install() {
53 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" 93 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
54 local updater="${EROOT}${GCONFTOOL_BIN}" 94 local updater="${EROOT}${GCONFTOOL_BIN}"
55 95
56 if [[ ! -x "${updater}" ]]; then 96 if [[ ! -x "${updater}" ]]; then
84 kill -HUP ${pids} 124 kill -HUP ${pids}
85 eend $? 125 eend $?
86 fi 126 fi
87} 127}
88 128
89 129# @FUNCTION: gnome2_gconf_uninstall
130# @DESCRIPTION:
90# Removes schema files previously installed by the current ebuild from Gconf's 131# Removes schema files previously installed by the current ebuild from Gconf's
91# database. 132# database.
92gnome2_gconf_uninstall() { 133gnome2_gconf_uninstall() {
93 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" 134 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
94 local updater="${EROOT}${GCONFTOOL_BIN}" 135 local updater="${EROOT}${GCONFTOOL_BIN}"
123 kill -HUP ${pids} 164 kill -HUP ${pids}
124 eend $? 165 eend $?
125 fi 166 fi
126} 167}
127 168
128 169# @FUNCTION: gnome2_icon_savelist
170# @DESCRIPTION:
129# Find the icons that are about to be installed and save their location 171# Find the icons that are about to be installed and save their location
130# in the GNOME2_ECLASS_ICONS environment variable 172# in the GNOME2_ECLASS_ICONS environment variable.
131# That function should be called from pkg_preinst 173# This function should be called from pkg_preinst.
132gnome2_icon_savelist() { 174gnome2_icon_savelist() {
133 has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}" 175 has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
134 pushd "${ED}" &> /dev/null 176 pushd "${ED}" &> /dev/null
135 export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null) 177 export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null)
136 popd &> /dev/null 178 popd &> /dev/null
137} 179}
138 180
139 181# @FUNCTION: gnome2_icon_cache_update
182# @DESCRIPTION:
140# Updates Gtk+ icon cache files under /usr/share/icons if the current ebuild 183# Updates Gtk+ icon cache files under /usr/share/icons if the current ebuild
141# have installed anything under that location. 184# have installed anything under that location.
185# This function should be called from pkg_postinst and pkg_postrm.
142gnome2_icon_cache_update() { 186gnome2_icon_cache_update() {
143 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" 187 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
144 local updater="${EROOT}${GTK_UPDATE_ICON_CACHE}" 188 local updater="${EROOT}${GTK_UPDATE_ICON_CACHE}"
145 189
146 if [[ ! -x "${updater}" ]] ; then 190 if [[ ! -x "${updater}" ]] ; then
182 for f in "${fails[@]}" ; do 226 for f in "${fails[@]}" ; do
183 eerror "Failed to update cache with icon $f" 227 eerror "Failed to update cache with icon $f"
184 done 228 done
185} 229}
186 230
187 231# @FUNCTION: gnome2_omf_fix
232# @DESCRIPTION:
188# Workaround applied to Makefile rules in order to remove redundant 233# Workaround applied to Makefile rules in order to remove redundant
189# calls to scrollkeeper-update and sandbox violations. 234# calls to scrollkeeper-update and sandbox violations.
235# This function should be called from src_prepare.
190gnome2_omf_fix() { 236gnome2_omf_fix() {
191 local omf_makefiles filename 237 local omf_makefiles filename
192 238
193 omf_makefiles="$@" 239 omf_makefiles="$@"
194 240
229 for f in "${fails[@]}" ; do 275 for f in "${fails[@]}" ; do
230 eerror "Failed to update OMF Makefile $f" 276 eerror "Failed to update OMF Makefile $f"
231 done 277 done
232} 278}
233 279
234 280# @FUNCTION: gnome2_scrollkeeper_update
281# @DESCRIPTION:
235# Updates the global scrollkeeper database. 282# Updates the global scrollkeeper database.
283# This function should be called from pkg_postinst and pkg_postrm.
236gnome2_scrollkeeper_update() { 284gnome2_scrollkeeper_update() {
237 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" 285 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
238 if [[ -x "${EROOT}${SCROLLKEEPER_UPDATE_BIN}" ]]; then 286 if [[ -x "${EROOT}${SCROLLKEEPER_UPDATE_BIN}" ]]; then
239 einfo "Updating scrollkeeper database ..." 287 einfo "Updating scrollkeeper database ..."
240 "${EROOT}${SCROLLKEEPER_UPDATE_BIN}" -q -p "${EROOT}${SCROLLKEEPER_DIR}" 288 "${EROOT}${SCROLLKEEPER_UPDATE_BIN}" -q -p "${EROOT}${SCROLLKEEPER_DIR}"
241 fi 289 fi
242} 290}
243 291
292# @FUNCTION: gnome2_schemas_savelist
293# @DESCRIPTION:
294# Find if there is any GSettings schema to install and save the list in
295# GNOME2_ECLASS_GLIB_SCHEMAS variable.
296# This function should be called from pkg_preinst.
244gnome2_schemas_savelist() { 297gnome2_schemas_savelist() {
245 has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}" 298 has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
246 pushd "${ED}" &>/dev/null 299 pushd "${ED}" &>/dev/null
247 export GNOME2_ECLASS_GLIB_SCHEMAS=$(find 'usr/share/glib-2.0/schemas' -name '*.gschema.xml' 2>/dev/null) 300 export GNOME2_ECLASS_GLIB_SCHEMAS=$(find 'usr/share/glib-2.0/schemas' -name '*.gschema.xml' 2>/dev/null)
248 popd &>/dev/null 301 popd &>/dev/null
249} 302}
250 303
304# @FUNCTION: gnome2_schemas_update
305# @USAGE: gnome2_schemas_update [--uninstall]
306# @DESCRIPTION:
307# Updates GSettings schemas if GNOME2_ECLASS_GLIB_SCHEMAS has some.
308# This function should be called from pkg_postinst and pkg_postrm with --uninstall.
251gnome2_schemas_update() { 309gnome2_schemas_update() {
252 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" 310 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
253 local updater="${EROOT}${GLIB_COMPILE_SCHEMAS}" 311 local updater="${EROOT}${GLIB_COMPILE_SCHEMAS}"
254 312
255 if [[ ! -x ${updater} ]]; then 313 if [[ ! -x ${updater} ]]; then

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22

  ViewVC Help
Powered by ViewVC 1.1.20