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

Contents of /eclass/gnome2-utils.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.18 - (hide annotations) (download)
Tue Dec 7 06:26:37 2010 UTC (3 years, 10 months ago) by eva
Branch: MAIN
Changes since 1.17: +32 -21 lines
add support for EAPI 3, importing changes from prefix overlay.

1 leonardop 1.1 # Copyright 1999-2006 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3 eva 1.18 # $Header: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v 1.17 2010/12/07 06:25:23 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 eva 1.18 case "${EAPI:-0}" in
15     0|1|2|3) ;;
16     *) die "EAPI=${EAPI} is not supported" ;;
17     esac
18 leonardop 1.1
19     # Path to gconftool-2
20 eva 1.16 : ${GCONFTOOL_BIN:="/usr/bin/gconftool-2"}
21 leonardop 1.1
22     # Directory where scrollkeeper-update should do its work
23 eva 1.16 : ${SCROLLKEEPER_DIR:="/var/lib/scrollkeeper"}
24 leonardop 1.1
25     # Path to scrollkeeper-update
26 eva 1.16 : ${SCROLLKEEPER_UPDATE_BIN:="/usr/bin/scrollkeeper-update"}
27 leonardop 1.1
28 eva 1.15 # 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 leonardop 1.1
35    
36     DEPEND=">=sys-apps/sed-4"
37    
38    
39    
40 remi 1.8 # 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 eva 1.18 has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
44     pushd "${ED}" &> /dev/null
45 remi 1.10 export GNOME2_ECLASS_SCHEMAS=$(find 'etc/gconf/schemas/' -name '*.schemas' 2> /dev/null)
46 remi 1.8 popd &> /dev/null
47     }
48    
49    
50 leonardop 1.1 # Applies any schema files installed by the current ebuild to Gconf's database
51 swegener 1.2 # using gconftool-2
52 leonardop 1.1 gnome2_gconf_install() {
53 eva 1.18 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
54     local updater="${EROOT}${GCONFTOOL_BIN}"
55 remi 1.8
56 eva 1.16 if [[ ! -x "${updater}" ]]; then
57 eva 1.17 debug-print "${updater} is not executable"
58 remi 1.8 return
59     fi
60    
61     if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
62 eva 1.17 debug-print "No GNOME 2 GConf schemas found"
63 leonardop 1.1 return
64     fi
65    
66     # We are ready to install the GCONF Scheme now
67     unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
68 eva 1.18 export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${EROOT};")"
69 leonardop 1.1
70     einfo "Installing GNOME 2 GConf schemas"
71    
72 eva 1.17 local F
73 remi 1.8 for F in ${GNOME2_ECLASS_SCHEMAS}; do
74 eva 1.18 if [[ -e "${EROOT}${F}" ]]; then
75 eva 1.17 debug-print "Installing schema: ${F}"
76 eva 1.18 "${updater}" --makefile-install-rule "${EROOT}${F}" 1>/dev/null
77 leonardop 1.1 fi
78     done
79    
80     # have gconf reload the new schemas
81 dang 1.6 pids=$(pgrep -x gconfd-2)
82 compnerd 1.3 if [[ $? == 0 ]] ; then
83     ebegin "Reloading GConf schemas"
84     kill -HUP ${pids}
85     eend $?
86     fi
87 leonardop 1.1 }
88    
89    
90     # Removes schema files previously installed by the current ebuild from Gconf's
91     # database.
92     gnome2_gconf_uninstall() {
93 eva 1.18 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
94     local updater="${EROOT}${GCONFTOOL_BIN}"
95 remi 1.8
96 eva 1.16 if [[ ! -x "${updater}" ]]; then
97 eva 1.17 debug-print "${updater} is not executable"
98 remi 1.8 return
99     fi
100    
101     if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
102 eva 1.17 debug-print "No GNOME 2 GConf schemas found"
103 leonardop 1.1 return
104     fi
105    
106     unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
107 eva 1.18 export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${EROOT};")"
108 leonardop 1.1
109     einfo "Uninstalling GNOME 2 GConf schemas"
110    
111 eva 1.17 local F
112 remi 1.8 for F in ${GNOME2_ECLASS_SCHEMAS}; do
113 eva 1.18 if [[ -e "${EROOT}${F}" ]]; then
114 eva 1.17 debug-print "Uninstalling gconf schema: ${F}"
115 eva 1.18 "${updater}" --makefile-uninstall-rule "${EROOT}${F}" 1>/dev/null
116 remi 1.8 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 leonardop 1.1
129 remi 1.8 # Find the icons that are about to be installed and save their location
130     # in the GNOME2_ECLASS_ICONS environment variable
131 remi 1.9 # That function should be called from pkg_preinst
132     gnome2_icon_savelist() {
133 eva 1.18 has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
134     pushd "${ED}" &> /dev/null
135 remi 1.10 export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null)
136 remi 1.8 popd &> /dev/null
137 leonardop 1.1 }
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 eva 1.18 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
144     local updater="${EROOT}${GTK_UPDATE_ICON_CACHE}"
145 leonardop 1.1
146 remi 1.8 if [[ ! -x "${updater}" ]] ; then
147 leonardop 1.1 debug-print "${updater} is not executable"
148 remi 1.8 return
149     fi
150 leonardop 1.1
151 remi 1.8 if [[ -z "${GNOME2_ECLASS_ICONS}" ]]; then
152 eva 1.17 debug-print "No icon cache to update"
153 leonardop 1.1 return
154     fi
155    
156     ebegin "Updating icons cache"
157    
158     local retval=0
159     local fails=( )
160    
161 remi 1.8 for dir in ${GNOME2_ECLASS_ICONS}
162 leonardop 1.1 do
163 remi 1.8 if [[ -f "${ROOT}${dir}/index.theme" ]] ; then
164 leonardop 1.1 local rv=0
165    
166 eva 1.18 "${updater}" -qf "${EROOT}${dir}"
167 leonardop 1.1 rv=$?
168    
169     if [[ ! $rv -eq 0 ]] ; then
170 eva 1.18 debug-print "Updating cache failed on ${EROOT}${dir}"
171 leonardop 1.1
172     # Add to the list of failures
173 eva 1.18 fails[$(( ${#fails[@]} + 1 ))]="${EROOT}${dir}"
174 leonardop 1.1
175     retval=2
176     fi
177     fi
178     done
179    
180     eend ${retval}
181    
182 remi 1.8 for f in "${fails[@]}" ; do
183     eerror "Failed to update cache with icon $f"
184 leonardop 1.1 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 leio 1.11 # 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 leonardop 1.1 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 remi 1.8 sed -i -e 's:scrollkeeper-update:true:' "${omf}"
215 leonardop 1.1 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 remi 1.10 for f in "${fails[@]}" ; do
230     eerror "Failed to update OMF Makefile $f"
231 leonardop 1.1 done
232     }
233    
234    
235     # Updates the global scrollkeeper database.
236     gnome2_scrollkeeper_update() {
237 eva 1.18 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
238     if [[ -x "${EROOT}${SCROLLKEEPER_UPDATE_BIN}" ]]; then
239 leonardop 1.1 einfo "Updating scrollkeeper database ..."
240 eva 1.18 "${EROOT}${SCROLLKEEPER_UPDATE_BIN}" -q -p "${EROOT}${SCROLLKEEPER_DIR}"
241 leonardop 1.1 fi
242     }
243 eva 1.14
244     gnome2_schemas_savelist() {
245 eva 1.18 has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
246     pushd "${ED}" &>/dev/null
247 eva 1.14 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 eva 1.18 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
253     local updater="${EROOT}${GLIB_COMPILE_SCHEMAS}"
254 eva 1.14
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 eva 1.17 debug-print "No GSettings schemas to update"
262 eva 1.14 return
263     fi
264    
265     ebegin "Updating GSettings schemas"
266 eva 1.18 ${updater} --allow-any-name "$@" "${EROOT%/}/usr/share/glib-2.0/schemas" &>/dev/null
267 eva 1.14 eend $?
268     }

  ViewVC Help
Powered by ViewVC 1.1.20