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

Contents of /eclass/gnome2-utils.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.16 - (hide annotations) (download)
Tue Dec 7 06:23:34 2010 UTC (3 years, 10 months ago) by eva
Branch: MAIN
Changes since 1.15: +14 -12 lines
make sure we refer to $ROOT where needed

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

  ViewVC Help
Powered by ViewVC 1.1.20