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

Contents of /eclass/gnome2-utils.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.15 - (show annotations) (download)
Tue Dec 7 06:21:59 2010 UTC (3 years, 10 months ago) by eva
Branch: MAIN
Changes since 1.14: +9 -3 lines
replace usage of type -P by variables

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

  ViewVC Help
Powered by ViewVC 1.1.20