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

Contents of /eclass/gnome2-utils.eclass

Parent Directory Parent Directory | Revision Log Revision Log


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

1 leonardop 1.1 # Copyright 1999-2006 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3 eva 1.15 # $Header: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v 1.14 2010/12/07 06:18:55 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 remi 1.8 : ${GCONFTOOL_BIN:="${ROOT}usr/bin/gconftool-2"}
18 leonardop 1.1
19     # Directory where scrollkeeper-update should do its work
20 remi 1.8 : ${SCROLLKEEPER_DIR:="${ROOT}var/lib/scrollkeeper"}
21 leonardop 1.1
22     # Path to scrollkeeper-update
23 remi 1.8 : ${SCROLLKEEPER_UPDATE_BIN:="${ROOT}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 remi 1.8 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 leonardop 1.1 return
58     fi
59    
60     # We are ready to install the GCONF Scheme now
61     unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
62 eva 1.12 export GCONF_CONFIG_SOURCE="$("${GCONFTOOL_BIN}" --get-default-source | sed "s;:/;:${ROOT};")"
63 leonardop 1.1
64     einfo "Installing GNOME 2 GConf schemas"
65    
66 remi 1.8 for F in ${GNOME2_ECLASS_SCHEMAS}; do
67     if [[ -e "${ROOT}${F}" ]]; then
68 leonardop 1.1 # echo "DEBUG::gconf install ${F}"
69 remi 1.8 "${GCONFTOOL_BIN}" --makefile-install-rule "${ROOT}${F}" 1>/dev/null
70 leonardop 1.1 fi
71     done
72    
73     # have gconf reload the new schemas
74 dang 1.6 pids=$(pgrep -x gconfd-2)
75 compnerd 1.3 if [[ $? == 0 ]] ; then
76     ebegin "Reloading GConf schemas"
77     kill -HUP ${pids}
78     eend $?
79     fi
80 leonardop 1.1 }
81    
82    
83     # Removes schema files previously installed by the current ebuild from Gconf's
84     # database.
85     gnome2_gconf_uninstall() {
86 remi 1.8 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 leonardop 1.1 return
95     fi
96    
97     unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
98 eva 1.13 export GCONF_CONFIG_SOURCE="$("${GCONFTOOL_BIN}" --get-default-source | sed "s;:/;:${ROOT};")"
99 leonardop 1.1
100     einfo "Uninstalling GNOME 2 GConf schemas"
101    
102 remi 1.8 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 leonardop 1.1
119 remi 1.8 # Find the icons that are about to be installed and save their location
120     # in the GNOME2_ECLASS_ICONS environment variable
121 remi 1.9 # That function should be called from pkg_preinst
122     gnome2_icon_savelist() {
123 remi 1.8 pushd "${D}" &> /dev/null
124 remi 1.10 export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null)
125 remi 1.8 popd &> /dev/null
126 leonardop 1.1 }
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 eva 1.15 local updater="${ROOT}${GTK_UPDATE_ICON_CACHE}"
133 leonardop 1.1
134 remi 1.8 if [[ ! -x "${updater}" ]] ; then
135 leonardop 1.1 debug-print "${updater} is not executable"
136 remi 1.8 return
137     fi
138 leonardop 1.1
139 remi 1.8 if [[ -z "${GNOME2_ECLASS_ICONS}" ]]; then
140 leonardop 1.1 return
141     fi
142    
143 remi 1.8
144 leonardop 1.1 ebegin "Updating icons cache"
145    
146     local retval=0
147     local fails=( )
148    
149 remi 1.8 for dir in ${GNOME2_ECLASS_ICONS}
150 leonardop 1.1 do
151 remi 1.8 if [[ -f "${ROOT}${dir}/index.theme" ]] ; then
152 leonardop 1.1 local rv=0
153    
154 remi 1.8 "${updater}" -qf "${ROOT}${dir}"
155 leonardop 1.1 rv=$?
156    
157     if [[ ! $rv -eq 0 ]] ; then
158 remi 1.8 debug-print "Updating cache failed on ${ROOT}${dir}"
159 leonardop 1.1
160     # Add to the list of failures
161 remi 1.8 fails[$(( ${#fails[@]} + 1 ))]="${ROOT}${dir}"
162 leonardop 1.1
163     retval=2
164     fi
165     fi
166     done
167    
168     eend ${retval}
169    
170 remi 1.8 for f in "${fails[@]}" ; do
171     eerror "Failed to update cache with icon $f"
172 leonardop 1.1 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 leio 1.11 # 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 leonardop 1.1 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 remi 1.8 sed -i -e 's:scrollkeeper-update:true:' "${omf}"
203 leonardop 1.1 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 remi 1.10 for f in "${fails[@]}" ; do
218     eerror "Failed to update OMF Makefile $f"
219 leonardop 1.1 done
220     }
221    
222    
223     # Updates the global scrollkeeper database.
224     gnome2_scrollkeeper_update() {
225 remi 1.8 if [[ -x "${SCROLLKEEPER_UPDATE_BIN}" ]]; then
226 leonardop 1.1 einfo "Updating scrollkeeper database ..."
227 remi 1.8 "${SCROLLKEEPER_UPDATE_BIN}" -q -p "${SCROLLKEEPER_DIR}"
228 leonardop 1.1 fi
229     }
230 eva 1.14
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 eva 1.15 local updater="${ROOT}${GLIB_COMPILE_SCHEMAS}"
239 eva 1.14
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