/[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.8 Revision 1.15
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.8 2008/03/22 09:37:44 remi Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v 1.15 2010/12/07 06:21:59 eva Exp $
4 4
5# 5#
6# gnome2-utils.eclass 6# gnome2-utils.eclass
7# 7#
8# Set of auxiliary functions used to perform actions commonly needed by packages 8# Set of auxiliary functions used to perform actions commonly needed by packages
19# Directory where scrollkeeper-update should do its work 19# Directory where scrollkeeper-update should do its work
20: ${SCROLLKEEPER_DIR:="${ROOT}var/lib/scrollkeeper"} 20: ${SCROLLKEEPER_DIR:="${ROOT}var/lib/scrollkeeper"}
21 21
22# Path to scrollkeeper-update 22# Path to scrollkeeper-update
23: ${SCROLLKEEPER_UPDATE_BIN:="${ROOT}usr/bin/scrollkeeper-update"} 23: ${SCROLLKEEPER_UPDATE_BIN:="${ROOT}usr/bin/scrollkeeper-update"}
24
25# Path to gtk-update-icon-cache
26: ${GTK_UPDATE_ICON_CACHE:="/usr/bin/gtk-update-icon-cache"}
27
28# Path to glib-compile-schemas
29: ${GLIB_COMPILE_SCHEMAS:="/usr/bin/glib-compile-schemas"}
24 30
25 31
26 32
27DEPEND=">=sys-apps/sed-4" 33DEPEND=">=sys-apps/sed-4"
28 34
30 36
31# Find the GConf schemas that are about to be installed and save their location 37# Find the GConf schemas that are about to be installed and save their location
32# in the GNOME2_ECLASS_SCHEMAS environment variable 38# in the GNOME2_ECLASS_SCHEMAS environment variable
33gnome2_gconf_savelist() { 39gnome2_gconf_savelist() {
34 pushd "${D}" &> /dev/null 40 pushd "${D}" &> /dev/null
35 export GNOME2_ECLASS_SCHEMAS=$(find 'etc/gconf/schemas/' -name '*.schemas') 41 export GNOME2_ECLASS_SCHEMAS=$(find 'etc/gconf/schemas/' -name '*.schemas' 2> /dev/null)
36 popd &> /dev/null 42 popd &> /dev/null
37} 43}
38 44
39 45
40# Applies any schema files installed by the current ebuild to Gconf's database 46# Applies any schema files installed by the current ebuild to Gconf's database
51 return 57 return
52 fi 58 fi
53 59
54 # We are ready to install the GCONF Scheme now 60 # We are ready to install the GCONF Scheme now
55 unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL 61 unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
56 export GCONF_CONFIG_SOURCE="$("${GCONFTOOL_BIN}" --get-default-source)" 62 export GCONF_CONFIG_SOURCE="$("${GCONFTOOL_BIN}" --get-default-source | sed "s;:/;:${ROOT};")"
57 63
58 einfo "Installing GNOME 2 GConf schemas" 64 einfo "Installing GNOME 2 GConf schemas"
59 65
60 for F in ${GNOME2_ECLASS_SCHEMAS}; do 66 for F in ${GNOME2_ECLASS_SCHEMAS}; do
61 if [[ -e "${ROOT}${F}" ]]; then 67 if [[ -e "${ROOT}${F}" ]]; then
87 einfo "No GNOME 2 GConf schemas found" 93 einfo "No GNOME 2 GConf schemas found"
88 return 94 return
89 fi 95 fi
90 96
91 unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL 97 unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
92 export GCONF_CONFIG_SOURCE=$("${GCONFTOOL_BIN}" --get-default-source) 98 export GCONF_CONFIG_SOURCE="$("${GCONFTOOL_BIN}" --get-default-source | sed "s;:/;:${ROOT};")"
93 99
94 einfo "Uninstalling GNOME 2 GConf schemas" 100 einfo "Uninstalling GNOME 2 GConf schemas"
95 101
96 for F in ${GNOME2_ECLASS_SCHEMAS}; do 102 for F in ${GNOME2_ECLASS_SCHEMAS}; do
97 if [[ -e "${ROOT}${F}" ]]; then 103 if [[ -e "${ROOT}${F}" ]]; then
110} 116}
111 117
112 118
113# Find the icons that are about to be installed and save their location 119# Find the icons that are about to be installed and save their location
114# in the GNOME2_ECLASS_ICONS environment variable 120# in the GNOME2_ECLASS_ICONS environment variable
121# That function should be called from pkg_preinst
115gnome2_icons_savelist() { 122gnome2_icon_savelist() {
116 pushd "${D}" &> /dev/null 123 pushd "${D}" &> /dev/null
117 export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d) 124 export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null)
118 popd &> /dev/null 125 popd &> /dev/null
119} 126}
120 127
121 128
122# Updates Gtk+ icon cache files under /usr/share/icons if the current ebuild 129# Updates Gtk+ icon cache files under /usr/share/icons if the current ebuild
123# have installed anything under that location. 130# have installed anything under that location.
124gnome2_icon_cache_update() { 131gnome2_icon_cache_update() {
125 local updater="$(type -p gtk-update-icon-cache 2> /dev/null)" 132 local updater="${ROOT}${GTK_UPDATE_ICON_CACHE}"
126 133
127 if [[ ! -x "${updater}" ]] ; then 134 if [[ ! -x "${updater}" ]] ; then
128 debug-print "${updater} is not executable" 135 debug-print "${updater} is not executable"
129 return 136 return
130 fi 137 fi
176 if [[ -f ${S}/omf.make ]] ; then 183 if [[ -f ${S}/omf.make ]] ; then
177 omf_makefiles="${omf_makefiles} ${S}/omf.make" 184 omf_makefiles="${omf_makefiles} ${S}/omf.make"
178 fi 185 fi
179 186
180 # testing fixing of all makefiles found 187 # testing fixing of all makefiles found
188 # The sort is important to ensure .am is listed before the respective .in for
189 # maintainer mode regeneration not kicking in due to .am being newer than .in
181 for filename in $(find ./ -name "Makefile.in" -o -name "Makefile.am") ; do 190 for filename in $(find ./ -name "Makefile.in" -o -name "Makefile.am" |sort) ; do
182 omf_makefiles="${omf_makefiles} ${filename}" 191 omf_makefiles="${omf_makefiles} ${filename}"
183 done 192 done
184 193
185 ebegin "Fixing OMF Makefiles" 194 ebegin "Fixing OMF Makefiles"
186 195
203 fi 212 fi
204 done 213 done
205 214
206 eend $retval 215 eend $retval
207 216
208 for (( i = 0 ; i < ${#fails[@]} ; i++ )) ; do 217 for f in "${fails[@]}" ; do
209 ### HACK!! This is needed until bash 3.1 is unmasked.
210 ## The current stable version of bash lists the sizeof fails to be 1
211 ## when there are no elements in the list because it is declared local.
212 ## In order to prevent the declaration from being in global scope, we
213 ## this hack to prevent an empty error message being printed for stable
214 ## users. -- compnerd && allanonjl
215 if [[ "${fails[i]}" != "" && "${fails[i]}" != "()" ]] ; then
216 eerror "Failed to update OMF Makefile ${fails[i]}" 218 eerror "Failed to update OMF Makefile $f"
217 fi
218 done 219 done
219} 220}
220 221
221 222
222# Updates the global scrollkeeper database. 223# Updates the global scrollkeeper database.
224 if [[ -x "${SCROLLKEEPER_UPDATE_BIN}" ]]; then 225 if [[ -x "${SCROLLKEEPER_UPDATE_BIN}" ]]; then
225 einfo "Updating scrollkeeper database ..." 226 einfo "Updating scrollkeeper database ..."
226 "${SCROLLKEEPER_UPDATE_BIN}" -q -p "${SCROLLKEEPER_DIR}" 227 "${SCROLLKEEPER_UPDATE_BIN}" -q -p "${SCROLLKEEPER_DIR}"
227 fi 228 fi
228} 229}
230
231gnome2_schemas_savelist() {
232 pushd "${D}" &>/dev/null
233 export GNOME2_ECLASS_GLIB_SCHEMAS=$(find 'usr/share/glib-2.0/schemas' -name '*.gschema.xml' 2>/dev/null)
234 popd &>/dev/null
235}
236
237gnome2_schemas_update() {
238 local updater="${ROOT}${GLIB_COMPILE_SCHEMAS}"
239
240 if [[ ! -x ${updater} ]]; then
241 debug-print "${updater} is not executable"
242 return
243 fi
244
245 if [[ -z ${GNOME2_ECLASS_GLIB_SCHEMAS} ]]; then
246 debug-print "no schemas to update"
247 return
248 fi
249
250 ebegin "Updating GSettings schemas"
251 ${updater} --allow-any-name "$@" "${ROOT%/}/usr/share/glib-2.0/schemas" &>/dev/null
252 eend $?
253}

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

  ViewVC Help
Powered by ViewVC 1.1.20