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

Contents of /eclass/gnome2-utils.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.21 - (show annotations) (download)
Mon Jan 31 17:03:45 2011 UTC (3 years, 8 months ago) by eva
Branch: MAIN
Changes since 1.20: +2 -2 lines
Add EAPI=4 to the list of supported EAPIs (xfconf needs it), bug #353210.

1 # Copyright 1999-2006 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v 1.20 2011/01/20 23:50:49 abcd Exp $
4
5 #
6 # gnome2-utils.eclass
7 #
8 # Set of auxiliary functions used to perform actions commonly needed by packages
9 # using the GNOME framework.
10 #
11 # Maintained by Gentoo's GNOME herd <gnome@gentoo.org>
12 #
13
14 case "${EAPI:-0}" in
15 0|1|2|3|4) ;;
16 *) die "EAPI=${EAPI} is not supported" ;;
17 esac
18
19 # Path to gconftool-2
20 : ${GCONFTOOL_BIN:="/usr/bin/gconftool-2"}
21
22 # Directory where scrollkeeper-update should do its work
23 : ${SCROLLKEEPER_DIR:="/var/lib/scrollkeeper"}
24
25 # Path to scrollkeeper-update
26 : ${SCROLLKEEPER_UPDATE_BIN:="/usr/bin/scrollkeeper-update"}
27
28 # Path to gtk-update-icon-cache
29 : ${GTK_UPDATE_ICON_CACHE:="/usr/bin/gtk-update-icon-cache"}
30
31 # Path to glib-compile-schemas
32 : ${GLIB_COMPILE_SCHEMAS:="/usr/bin/glib-compile-schemas"}
33
34
35
36 DEPEND=">=sys-apps/sed-4"
37
38
39
40 # Find the GConf schemas that are about to be installed and save their location
41 # in the GNOME2_ECLASS_SCHEMAS environment variable
42 gnome2_gconf_savelist() {
43 has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
44 pushd "${ED}" &> /dev/null
45 export GNOME2_ECLASS_SCHEMAS=$(find 'etc/gconf/schemas/' -name '*.schemas' 2> /dev/null)
46 popd &> /dev/null
47 }
48
49
50 # Applies any schema files installed by the current ebuild to Gconf's database
51 # using gconftool-2
52 gnome2_gconf_install() {
53 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
54 local updater="${EROOT}${GCONFTOOL_BIN}"
55
56 if [[ ! -x "${updater}" ]]; then
57 debug-print "${updater} is not executable"
58 return
59 fi
60
61 if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
62 debug-print "No GNOME 2 GConf schemas found"
63 return
64 fi
65
66 # We are ready to install the GCONF Scheme now
67 unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
68 export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${ROOT};")"
69
70 einfo "Installing GNOME 2 GConf schemas"
71
72 local F
73 for F in ${GNOME2_ECLASS_SCHEMAS}; do
74 if [[ -e "${EROOT}${F}" ]]; then
75 debug-print "Installing schema: ${F}"
76 "${updater}" --makefile-install-rule "${EROOT}${F}" 1>/dev/null
77 fi
78 done
79
80 # have gconf reload the new schemas
81 pids=$(pgrep -x gconfd-2)
82 if [[ $? == 0 ]] ; then
83 ebegin "Reloading GConf schemas"
84 kill -HUP ${pids}
85 eend $?
86 fi
87 }
88
89
90 # Removes schema files previously installed by the current ebuild from Gconf's
91 # database.
92 gnome2_gconf_uninstall() {
93 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
94 local updater="${EROOT}${GCONFTOOL_BIN}"
95
96 if [[ ! -x "${updater}" ]]; then
97 debug-print "${updater} is not executable"
98 return
99 fi
100
101 if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
102 debug-print "No GNOME 2 GConf schemas found"
103 return
104 fi
105
106 unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
107 export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${ROOT};")"
108
109 einfo "Uninstalling GNOME 2 GConf schemas"
110
111 local F
112 for F in ${GNOME2_ECLASS_SCHEMAS}; do
113 if [[ -e "${EROOT}${F}" ]]; then
114 debug-print "Uninstalling gconf schema: ${F}"
115 "${updater}" --makefile-uninstall-rule "${EROOT}${F}" 1>/dev/null
116 fi
117 done
118
119 # have gconf reload the new schemas
120 pids=$(pgrep -x gconfd-2)
121 if [[ $? == 0 ]] ; then
122 ebegin "Reloading GConf schemas"
123 kill -HUP ${pids}
124 eend $?
125 fi
126 }
127
128
129 # Find the icons that are about to be installed and save their location
130 # in the GNOME2_ECLASS_ICONS environment variable
131 # That function should be called from pkg_preinst
132 gnome2_icon_savelist() {
133 has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
134 pushd "${ED}" &> /dev/null
135 export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null)
136 popd &> /dev/null
137 }
138
139
140 # Updates Gtk+ icon cache files under /usr/share/icons if the current ebuild
141 # have installed anything under that location.
142 gnome2_icon_cache_update() {
143 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
144 local updater="${EROOT}${GTK_UPDATE_ICON_CACHE}"
145
146 if [[ ! -x "${updater}" ]] ; then
147 debug-print "${updater} is not executable"
148 return
149 fi
150
151 if [[ -z "${GNOME2_ECLASS_ICONS}" ]]; then
152 debug-print "No icon cache to update"
153 return
154 fi
155
156 ebegin "Updating icons cache"
157
158 local retval=0
159 local fails=( )
160
161 for dir in ${GNOME2_ECLASS_ICONS}
162 do
163 if [[ -f "${EROOT}${dir}/index.theme" ]] ; then
164 local rv=0
165
166 "${updater}" -qf "${EROOT}${dir}"
167 rv=$?
168
169 if [[ ! $rv -eq 0 ]] ; then
170 debug-print "Updating cache failed on ${EROOT}${dir}"
171
172 # Add to the list of failures
173 fails[$(( ${#fails[@]} + 1 ))]="${EROOT}${dir}"
174
175 retval=2
176 fi
177 fi
178 done
179
180 eend ${retval}
181
182 for f in "${fails[@]}" ; do
183 eerror "Failed to update cache with icon $f"
184 done
185 }
186
187
188 # Workaround applied to Makefile rules in order to remove redundant
189 # calls to scrollkeeper-update and sandbox violations.
190 gnome2_omf_fix() {
191 local omf_makefiles filename
192
193 omf_makefiles="$@"
194
195 if [[ -f ${S}/omf.make ]] ; then
196 omf_makefiles="${omf_makefiles} ${S}/omf.make"
197 fi
198
199 # testing fixing of all makefiles found
200 # The sort is important to ensure .am is listed before the respective .in for
201 # maintainer mode regeneration not kicking in due to .am being newer than .in
202 for filename in $(find ./ -name "Makefile.in" -o -name "Makefile.am" |sort) ; do
203 omf_makefiles="${omf_makefiles} ${filename}"
204 done
205
206 ebegin "Fixing OMF Makefiles"
207
208 local retval=0
209 local fails=( )
210
211 for omf in ${omf_makefiles} ; do
212 local rv=0
213
214 sed -i -e 's:scrollkeeper-update:true:' "${omf}"
215 retval=$?
216
217 if [[ ! $rv -eq 0 ]] ; then
218 debug-print "updating of ${omf} failed"
219
220 # Add to the list of failures
221 fails[$(( ${#fails[@]} + 1 ))]=$omf
222
223 retval=2
224 fi
225 done
226
227 eend $retval
228
229 for f in "${fails[@]}" ; do
230 eerror "Failed to update OMF Makefile $f"
231 done
232 }
233
234
235 # Updates the global scrollkeeper database.
236 gnome2_scrollkeeper_update() {
237 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
238 if [[ -x "${EROOT}${SCROLLKEEPER_UPDATE_BIN}" ]]; then
239 einfo "Updating scrollkeeper database ..."
240 "${EROOT}${SCROLLKEEPER_UPDATE_BIN}" -q -p "${EROOT}${SCROLLKEEPER_DIR}"
241 fi
242 }
243
244 gnome2_schemas_savelist() {
245 has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
246 pushd "${ED}" &>/dev/null
247 export GNOME2_ECLASS_GLIB_SCHEMAS=$(find 'usr/share/glib-2.0/schemas' -name '*.gschema.xml' 2>/dev/null)
248 popd &>/dev/null
249 }
250
251 gnome2_schemas_update() {
252 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
253 local updater="${EROOT}${GLIB_COMPILE_SCHEMAS}"
254
255 if [[ ! -x ${updater} ]]; then
256 debug-print "${updater} is not executable"
257 return
258 fi
259
260 if [[ -z ${GNOME2_ECLASS_GLIB_SCHEMAS} ]]; then
261 debug-print "No GSettings schemas to update"
262 return
263 fi
264
265 ebegin "Updating GSettings schemas"
266 ${updater} --allow-any-name "$@" "${EROOT%/}/usr/share/glib-2.0/schemas" &>/dev/null
267 eend $?
268 }

  ViewVC Help
Powered by ViewVC 1.1.20