/[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.17 Revision 1.21
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.17 2010/12/07 06:25:23 eva Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v 1.21 2011/01/31 17:03:45 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
9# using the GNOME framework. 9# using the GNOME framework.
10# 10#
11# Maintained by Gentoo's GNOME herd <gnome@gentoo.org> 11# Maintained by Gentoo's GNOME herd <gnome@gentoo.org>
12# 12#
13 13
14 14case "${EAPI:-0}" in
15 0|1|2|3|4) ;;
16 *) die "EAPI=${EAPI} is not supported" ;;
17esac
15 18
16# Path to gconftool-2 19# Path to gconftool-2
17: ${GCONFTOOL_BIN:="/usr/bin/gconftool-2"} 20: ${GCONFTOOL_BIN:="/usr/bin/gconftool-2"}
18 21
19# Directory where scrollkeeper-update should do its work 22# Directory where scrollkeeper-update should do its work
35 38
36 39
37# Find the GConf schemas that are about to be installed and save their location 40# Find the GConf schemas that are about to be installed and save their location
38# in the GNOME2_ECLASS_SCHEMAS environment variable 41# in the GNOME2_ECLASS_SCHEMAS environment variable
39gnome2_gconf_savelist() { 42gnome2_gconf_savelist() {
43 has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
40 pushd "${D}" &> /dev/null 44 pushd "${ED}" &> /dev/null
41 export GNOME2_ECLASS_SCHEMAS=$(find 'etc/gconf/schemas/' -name '*.schemas' 2> /dev/null) 45 export GNOME2_ECLASS_SCHEMAS=$(find 'etc/gconf/schemas/' -name '*.schemas' 2> /dev/null)
42 popd &> /dev/null 46 popd &> /dev/null
43} 47}
44 48
45 49
46# Applies any schema files installed by the current ebuild to Gconf's database 50# Applies any schema files installed by the current ebuild to Gconf's database
47# using gconftool-2 51# using gconftool-2
48gnome2_gconf_install() { 52gnome2_gconf_install() {
53 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
49 local updater="${ROOT}${GCONFTOOL_BIN}" 54 local updater="${EROOT}${GCONFTOOL_BIN}"
50 55
51 if [[ ! -x "${updater}" ]]; then 56 if [[ ! -x "${updater}" ]]; then
52 debug-print "${updater} is not executable" 57 debug-print "${updater} is not executable"
53 return 58 return
54 fi 59 fi
64 69
65 einfo "Installing GNOME 2 GConf schemas" 70 einfo "Installing GNOME 2 GConf schemas"
66 71
67 local F 72 local F
68 for F in ${GNOME2_ECLASS_SCHEMAS}; do 73 for F in ${GNOME2_ECLASS_SCHEMAS}; do
69 if [[ -e "${ROOT}${F}" ]]; then 74 if [[ -e "${EROOT}${F}" ]]; then
70 debug-print "Installing schema: ${F}" 75 debug-print "Installing schema: ${F}"
71 "${updater}" --makefile-install-rule "${ROOT}${F}" 1>/dev/null 76 "${updater}" --makefile-install-rule "${EROOT}${F}" 1>/dev/null
72 fi 77 fi
73 done 78 done
74 79
75 # have gconf reload the new schemas 80 # have gconf reload the new schemas
76 pids=$(pgrep -x gconfd-2) 81 pids=$(pgrep -x gconfd-2)
83 88
84 89
85# Removes schema files previously installed by the current ebuild from Gconf's 90# Removes schema files previously installed by the current ebuild from Gconf's
86# database. 91# database.
87gnome2_gconf_uninstall() { 92gnome2_gconf_uninstall() {
93 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
88 local updater="${ROOT}${GCONFTOOL_BIN}" 94 local updater="${EROOT}${GCONFTOOL_BIN}"
89 95
90 if [[ ! -x "${updater}" ]]; then 96 if [[ ! -x "${updater}" ]]; then
91 debug-print "${updater} is not executable" 97 debug-print "${updater} is not executable"
92 return 98 return
93 fi 99 fi
102 108
103 einfo "Uninstalling GNOME 2 GConf schemas" 109 einfo "Uninstalling GNOME 2 GConf schemas"
104 110
105 local F 111 local F
106 for F in ${GNOME2_ECLASS_SCHEMAS}; do 112 for F in ${GNOME2_ECLASS_SCHEMAS}; do
107 if [[ -e "${ROOT}${F}" ]]; then 113 if [[ -e "${EROOT}${F}" ]]; then
108 debug-print "Uninstalling gconf schema: ${F}" 114 debug-print "Uninstalling gconf schema: ${F}"
109 "${updater}" --makefile-uninstall-rule "${ROOT}${F}" 1>/dev/null 115 "${updater}" --makefile-uninstall-rule "${EROOT}${F}" 1>/dev/null
110 fi 116 fi
111 done 117 done
112 118
113 # have gconf reload the new schemas 119 # have gconf reload the new schemas
114 pids=$(pgrep -x gconfd-2) 120 pids=$(pgrep -x gconfd-2)
122 128
123# Find the icons that are about to be installed and save their location 129# Find the icons that are about to be installed and save their location
124# in the GNOME2_ECLASS_ICONS environment variable 130# in the GNOME2_ECLASS_ICONS environment variable
125# That function should be called from pkg_preinst 131# That function should be called from pkg_preinst
126gnome2_icon_savelist() { 132gnome2_icon_savelist() {
133 has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
127 pushd "${D}" &> /dev/null 134 pushd "${ED}" &> /dev/null
128 export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null) 135 export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null)
129 popd &> /dev/null 136 popd &> /dev/null
130} 137}
131 138
132 139
133# Updates Gtk+ icon cache files under /usr/share/icons if the current ebuild 140# Updates Gtk+ icon cache files under /usr/share/icons if the current ebuild
134# have installed anything under that location. 141# have installed anything under that location.
135gnome2_icon_cache_update() { 142gnome2_icon_cache_update() {
143 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
136 local updater="${ROOT}${GTK_UPDATE_ICON_CACHE}" 144 local updater="${EROOT}${GTK_UPDATE_ICON_CACHE}"
137 145
138 if [[ ! -x "${updater}" ]] ; then 146 if [[ ! -x "${updater}" ]] ; then
139 debug-print "${updater} is not executable" 147 debug-print "${updater} is not executable"
140 return 148 return
141 fi 149 fi
150 local retval=0 158 local retval=0
151 local fails=( ) 159 local fails=( )
152 160
153 for dir in ${GNOME2_ECLASS_ICONS} 161 for dir in ${GNOME2_ECLASS_ICONS}
154 do 162 do
155 if [[ -f "${ROOT}${dir}/index.theme" ]] ; then 163 if [[ -f "${EROOT}${dir}/index.theme" ]] ; then
156 local rv=0 164 local rv=0
157 165
158 "${updater}" -qf "${ROOT}${dir}" 166 "${updater}" -qf "${EROOT}${dir}"
159 rv=$? 167 rv=$?
160 168
161 if [[ ! $rv -eq 0 ]] ; then 169 if [[ ! $rv -eq 0 ]] ; then
162 debug-print "Updating cache failed on ${ROOT}${dir}" 170 debug-print "Updating cache failed on ${EROOT}${dir}"
163 171
164 # Add to the list of failures 172 # Add to the list of failures
165 fails[$(( ${#fails[@]} + 1 ))]="${ROOT}${dir}" 173 fails[$(( ${#fails[@]} + 1 ))]="${EROOT}${dir}"
166 174
167 retval=2 175 retval=2
168 fi 176 fi
169 fi 177 fi
170 done 178 done
224} 232}
225 233
226 234
227# Updates the global scrollkeeper database. 235# Updates the global scrollkeeper database.
228gnome2_scrollkeeper_update() { 236gnome2_scrollkeeper_update() {
237 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
229 if [[ -x "${ROOT}${SCROLLKEEPER_UPDATE_BIN}" ]]; then 238 if [[ -x "${EROOT}${SCROLLKEEPER_UPDATE_BIN}" ]]; then
230 einfo "Updating scrollkeeper database ..." 239 einfo "Updating scrollkeeper database ..."
231 "${ROOT}${SCROLLKEEPER_UPDATE_BIN}" -q -p "${ROOT}${SCROLLKEEPER_DIR}" 240 "${EROOT}${SCROLLKEEPER_UPDATE_BIN}" -q -p "${EROOT}${SCROLLKEEPER_DIR}"
232 fi 241 fi
233} 242}
234 243
235gnome2_schemas_savelist() { 244gnome2_schemas_savelist() {
245 has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
236 pushd "${D}" &>/dev/null 246 pushd "${ED}" &>/dev/null
237 export GNOME2_ECLASS_GLIB_SCHEMAS=$(find 'usr/share/glib-2.0/schemas' -name '*.gschema.xml' 2>/dev/null) 247 export GNOME2_ECLASS_GLIB_SCHEMAS=$(find 'usr/share/glib-2.0/schemas' -name '*.gschema.xml' 2>/dev/null)
238 popd &>/dev/null 248 popd &>/dev/null
239} 249}
240 250
241gnome2_schemas_update() { 251gnome2_schemas_update() {
252 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
242 local updater="${ROOT}${GLIB_COMPILE_SCHEMAS}" 253 local updater="${EROOT}${GLIB_COMPILE_SCHEMAS}"
243 254
244 if [[ ! -x ${updater} ]]; then 255 if [[ ! -x ${updater} ]]; then
245 debug-print "${updater} is not executable" 256 debug-print "${updater} is not executable"
246 return 257 return
247 fi 258 fi
250 debug-print "No GSettings schemas to update" 261 debug-print "No GSettings schemas to update"
251 return 262 return
252 fi 263 fi
253 264
254 ebegin "Updating GSettings schemas" 265 ebegin "Updating GSettings schemas"
255 ${updater} --allow-any-name "$@" "${ROOT%/}/usr/share/glib-2.0/schemas" &>/dev/null 266 ${updater} --allow-any-name "$@" "${EROOT%/}/usr/share/glib-2.0/schemas" &>/dev/null
256 eend $? 267 eend $?
257} 268}

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

  ViewVC Help
Powered by ViewVC 1.1.20