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

Contents of /eclass/gnome2-utils.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.17 - (show annotations) (download)
Tue Dec 7 06:25:23 2010 UTC (4 years ago) by eva
Branch: MAIN
Changes since 1.16: +11 -9 lines
cosmetic fixes, use debug-print instead of einfo.

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

  ViewVC Help
Powered by ViewVC 1.1.20