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

Contents of /eclass/gnome2-utils.eclass

Parent Directory Parent Directory | Revision Log Revision Log


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

1 leonardop 1.1 # Copyright 1999-2006 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3 eva 1.17 # $Header: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v 1.16 2010/12/07 06:23:34 eva Exp $
4 leonardop 1.1
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 eva 1.16 : ${GCONFTOOL_BIN:="/usr/bin/gconftool-2"}
18 leonardop 1.1
19     # Directory where scrollkeeper-update should do its work
20 eva 1.16 : ${SCROLLKEEPER_DIR:="/var/lib/scrollkeeper"}
21 leonardop 1.1
22     # Path to scrollkeeper-update
23 eva 1.16 : ${SCROLLKEEPER_UPDATE_BIN:="/usr/bin/scrollkeeper-update"}
24 leonardop 1.1
25 eva 1.15 # 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 leonardop 1.1
32    
33     DEPEND=">=sys-apps/sed-4"
34    
35    
36    
37 remi 1.8 # 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 remi 1.10 export GNOME2_ECLASS_SCHEMAS=$(find 'etc/gconf/schemas/' -name '*.schemas' 2> /dev/null)
42 remi 1.8 popd &> /dev/null
43     }
44    
45    
46 leonardop 1.1 # Applies any schema files installed by the current ebuild to Gconf's database
47 swegener 1.2 # using gconftool-2
48 leonardop 1.1 gnome2_gconf_install() {
49 eva 1.16 local updater="${ROOT}${GCONFTOOL_BIN}"
50 remi 1.8
51 eva 1.16 if [[ ! -x "${updater}" ]]; then
52 eva 1.17 debug-print "${updater} is not executable"
53 remi 1.8 return
54     fi
55    
56     if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
57 eva 1.17 debug-print "No GNOME 2 GConf schemas found"
58 leonardop 1.1 return
59     fi
60    
61     # We are ready to install the GCONF Scheme now
62     unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
63 eva 1.16 export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${ROOT};")"
64 leonardop 1.1
65     einfo "Installing GNOME 2 GConf schemas"
66    
67 eva 1.17 local F
68 remi 1.8 for F in ${GNOME2_ECLASS_SCHEMAS}; do
69     if [[ -e "${ROOT}${F}" ]]; then
70 eva 1.17 debug-print "Installing schema: ${F}"
71 eva 1.16 "${updater}" --makefile-install-rule "${ROOT}${F}" 1>/dev/null
72 leonardop 1.1 fi
73     done
74    
75     # have gconf reload the new schemas
76 dang 1.6 pids=$(pgrep -x gconfd-2)
77 compnerd 1.3 if [[ $? == 0 ]] ; then
78     ebegin "Reloading GConf schemas"
79     kill -HUP ${pids}
80     eend $?
81     fi
82 leonardop 1.1 }
83    
84    
85     # Removes schema files previously installed by the current ebuild from Gconf's
86     # database.
87     gnome2_gconf_uninstall() {
88 eva 1.16 local updater="${ROOT}${GCONFTOOL_BIN}"
89 remi 1.8
90 eva 1.16 if [[ ! -x "${updater}" ]]; then
91 eva 1.17 debug-print "${updater} is not executable"
92 remi 1.8 return
93     fi
94    
95     if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
96 eva 1.17 debug-print "No GNOME 2 GConf schemas found"
97 leonardop 1.1 return
98     fi
99    
100     unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
101 eva 1.16 export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${ROOT};")"
102 leonardop 1.1
103     einfo "Uninstalling GNOME 2 GConf schemas"
104    
105 eva 1.17 local F
106 remi 1.8 for F in ${GNOME2_ECLASS_SCHEMAS}; do
107     if [[ -e "${ROOT}${F}" ]]; then
108 eva 1.17 debug-print "Uninstalling gconf schema: ${F}"
109 eva 1.16 "${updater}" --makefile-uninstall-rule "${ROOT}${F}" 1>/dev/null
110 remi 1.8 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 leonardop 1.1
123 remi 1.8 # Find the icons that are about to be installed and save their location
124     # in the GNOME2_ECLASS_ICONS environment variable
125 remi 1.9 # That function should be called from pkg_preinst
126     gnome2_icon_savelist() {
127 remi 1.8 pushd "${D}" &> /dev/null
128 remi 1.10 export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null)
129 remi 1.8 popd &> /dev/null
130 leonardop 1.1 }
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 eva 1.15 local updater="${ROOT}${GTK_UPDATE_ICON_CACHE}"
137 leonardop 1.1
138 remi 1.8 if [[ ! -x "${updater}" ]] ; then
139 leonardop 1.1 debug-print "${updater} is not executable"
140 remi 1.8 return
141     fi
142 leonardop 1.1
143 remi 1.8 if [[ -z "${GNOME2_ECLASS_ICONS}" ]]; then
144 eva 1.17 debug-print "No icon cache to update"
145 leonardop 1.1 return
146     fi
147    
148     ebegin "Updating icons cache"
149    
150     local retval=0
151     local fails=( )
152    
153 remi 1.8 for dir in ${GNOME2_ECLASS_ICONS}
154 leonardop 1.1 do
155 remi 1.8 if [[ -f "${ROOT}${dir}/index.theme" ]] ; then
156 leonardop 1.1 local rv=0
157    
158 remi 1.8 "${updater}" -qf "${ROOT}${dir}"
159 leonardop 1.1 rv=$?
160    
161     if [[ ! $rv -eq 0 ]] ; then
162 remi 1.8 debug-print "Updating cache failed on ${ROOT}${dir}"
163 leonardop 1.1
164     # Add to the list of failures
165 remi 1.8 fails[$(( ${#fails[@]} + 1 ))]="${ROOT}${dir}"
166 leonardop 1.1
167     retval=2
168     fi
169     fi
170     done
171    
172     eend ${retval}
173    
174 remi 1.8 for f in "${fails[@]}" ; do
175     eerror "Failed to update cache with icon $f"
176 leonardop 1.1 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 leio 1.11 # 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 leonardop 1.1 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 remi 1.8 sed -i -e 's:scrollkeeper-update:true:' "${omf}"
207 leonardop 1.1 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 remi 1.10 for f in "${fails[@]}" ; do
222     eerror "Failed to update OMF Makefile $f"
223 leonardop 1.1 done
224     }
225    
226    
227     # Updates the global scrollkeeper database.
228     gnome2_scrollkeeper_update() {
229 eva 1.16 if [[ -x "${ROOT}${SCROLLKEEPER_UPDATE_BIN}" ]]; then
230 leonardop 1.1 einfo "Updating scrollkeeper database ..."
231 eva 1.16 "${ROOT}${SCROLLKEEPER_UPDATE_BIN}" -q -p "${ROOT}${SCROLLKEEPER_DIR}"
232 leonardop 1.1 fi
233     }
234 eva 1.14
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 eva 1.15 local updater="${ROOT}${GLIB_COMPILE_SCHEMAS}"
243 eva 1.14
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 eva 1.17 debug-print "No GSettings schemas to update"
251 eva 1.14 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