| 1 | # Copyright 1999-2006 Gentoo Foundation |
1 | # Copyright 1999-2006 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v 1.8 2008/03/22 09:37:44 remi Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v 1.14 2010/12/07 06:18:55 eva Exp $ |
| 4 | |
4 | |
| 5 | # |
5 | # |
| 6 | # gnome2-utils.eclass |
6 | # gnome2-utils.eclass |
| 7 | # |
7 | # |
| 8 | # Set of auxiliary functions used to perform actions commonly needed by packages |
8 | # Set of auxiliary functions used to perform actions commonly needed by packages |
| … | |
… | |
| 30 | |
30 | |
| 31 | # Find the GConf schemas that are about to be installed and save their location |
31 | # Find the GConf schemas that are about to be installed and save their location |
| 32 | # in the GNOME2_ECLASS_SCHEMAS environment variable |
32 | # in the GNOME2_ECLASS_SCHEMAS environment variable |
| 33 | gnome2_gconf_savelist() { |
33 | gnome2_gconf_savelist() { |
| 34 | pushd "${D}" &> /dev/null |
34 | pushd "${D}" &> /dev/null |
| 35 | export GNOME2_ECLASS_SCHEMAS=$(find 'etc/gconf/schemas/' -name '*.schemas') |
35 | export GNOME2_ECLASS_SCHEMAS=$(find 'etc/gconf/schemas/' -name '*.schemas' 2> /dev/null) |
| 36 | popd &> /dev/null |
36 | popd &> /dev/null |
| 37 | } |
37 | } |
| 38 | |
38 | |
| 39 | |
39 | |
| 40 | # Applies any schema files installed by the current ebuild to Gconf's database |
40 | # Applies any schema files installed by the current ebuild to Gconf's database |
| … | |
… | |
| 51 | return |
51 | return |
| 52 | fi |
52 | fi |
| 53 | |
53 | |
| 54 | # We are ready to install the GCONF Scheme now |
54 | # We are ready to install the GCONF Scheme now |
| 55 | unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL |
55 | unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL |
| 56 | export GCONF_CONFIG_SOURCE="$("${GCONFTOOL_BIN}" --get-default-source)" |
56 | export GCONF_CONFIG_SOURCE="$("${GCONFTOOL_BIN}" --get-default-source | sed "s;:/;:${ROOT};")" |
| 57 | |
57 | |
| 58 | einfo "Installing GNOME 2 GConf schemas" |
58 | einfo "Installing GNOME 2 GConf schemas" |
| 59 | |
59 | |
| 60 | for F in ${GNOME2_ECLASS_SCHEMAS}; do |
60 | for F in ${GNOME2_ECLASS_SCHEMAS}; do |
| 61 | if [[ -e "${ROOT}${F}" ]]; then |
61 | if [[ -e "${ROOT}${F}" ]]; then |
| … | |
… | |
| 87 | einfo "No GNOME 2 GConf schemas found" |
87 | einfo "No GNOME 2 GConf schemas found" |
| 88 | return |
88 | return |
| 89 | fi |
89 | fi |
| 90 | |
90 | |
| 91 | unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL |
91 | unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL |
| 92 | export GCONF_CONFIG_SOURCE=$("${GCONFTOOL_BIN}" --get-default-source) |
92 | export GCONF_CONFIG_SOURCE="$("${GCONFTOOL_BIN}" --get-default-source | sed "s;:/;:${ROOT};")" |
| 93 | |
93 | |
| 94 | einfo "Uninstalling GNOME 2 GConf schemas" |
94 | einfo "Uninstalling GNOME 2 GConf schemas" |
| 95 | |
95 | |
| 96 | for F in ${GNOME2_ECLASS_SCHEMAS}; do |
96 | for F in ${GNOME2_ECLASS_SCHEMAS}; do |
| 97 | if [[ -e "${ROOT}${F}" ]]; then |
97 | if [[ -e "${ROOT}${F}" ]]; then |
| … | |
… | |
| 110 | } |
110 | } |
| 111 | |
111 | |
| 112 | |
112 | |
| 113 | # Find the icons that are about to be installed and save their location |
113 | # Find the icons that are about to be installed and save their location |
| 114 | # in the GNOME2_ECLASS_ICONS environment variable |
114 | # in the GNOME2_ECLASS_ICONS environment variable |
|
|
115 | # That function should be called from pkg_preinst |
| 115 | gnome2_icons_savelist() { |
116 | gnome2_icon_savelist() { |
| 116 | pushd "${D}" &> /dev/null |
117 | pushd "${D}" &> /dev/null |
| 117 | export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d) |
118 | export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null) |
| 118 | popd &> /dev/null |
119 | popd &> /dev/null |
| 119 | } |
120 | } |
| 120 | |
121 | |
| 121 | |
122 | |
| 122 | # Updates Gtk+ icon cache files under /usr/share/icons if the current ebuild |
123 | # Updates Gtk+ icon cache files under /usr/share/icons if the current ebuild |
| … | |
… | |
| 176 | if [[ -f ${S}/omf.make ]] ; then |
177 | if [[ -f ${S}/omf.make ]] ; then |
| 177 | omf_makefiles="${omf_makefiles} ${S}/omf.make" |
178 | omf_makefiles="${omf_makefiles} ${S}/omf.make" |
| 178 | fi |
179 | fi |
| 179 | |
180 | |
| 180 | # testing fixing of all makefiles found |
181 | # testing fixing of all makefiles found |
|
|
182 | # The sort is important to ensure .am is listed before the respective .in for |
|
|
183 | # maintainer mode regeneration not kicking in due to .am being newer than .in |
| 181 | for filename in $(find ./ -name "Makefile.in" -o -name "Makefile.am") ; do |
184 | for filename in $(find ./ -name "Makefile.in" -o -name "Makefile.am" |sort) ; do |
| 182 | omf_makefiles="${omf_makefiles} ${filename}" |
185 | omf_makefiles="${omf_makefiles} ${filename}" |
| 183 | done |
186 | done |
| 184 | |
187 | |
| 185 | ebegin "Fixing OMF Makefiles" |
188 | ebegin "Fixing OMF Makefiles" |
| 186 | |
189 | |
| … | |
… | |
| 203 | fi |
206 | fi |
| 204 | done |
207 | done |
| 205 | |
208 | |
| 206 | eend $retval |
209 | eend $retval |
| 207 | |
210 | |
| 208 | for (( i = 0 ; i < ${#fails[@]} ; i++ )) ; do |
211 | for f in "${fails[@]}" ; do |
| 209 | ### HACK!! This is needed until bash 3.1 is unmasked. |
|
|
| 210 | ## The current stable version of bash lists the sizeof fails to be 1 |
|
|
| 211 | ## when there are no elements in the list because it is declared local. |
|
|
| 212 | ## In order to prevent the declaration from being in global scope, we |
|
|
| 213 | ## this hack to prevent an empty error message being printed for stable |
|
|
| 214 | ## users. -- compnerd && allanonjl |
|
|
| 215 | if [[ "${fails[i]}" != "" && "${fails[i]}" != "()" ]] ; then |
|
|
| 216 | eerror "Failed to update OMF Makefile ${fails[i]}" |
212 | eerror "Failed to update OMF Makefile $f" |
| 217 | fi |
|
|
| 218 | done |
213 | done |
| 219 | } |
214 | } |
| 220 | |
215 | |
| 221 | |
216 | |
| 222 | # Updates the global scrollkeeper database. |
217 | # Updates the global scrollkeeper database. |
| … | |
… | |
| 224 | if [[ -x "${SCROLLKEEPER_UPDATE_BIN}" ]]; then |
219 | if [[ -x "${SCROLLKEEPER_UPDATE_BIN}" ]]; then |
| 225 | einfo "Updating scrollkeeper database ..." |
220 | einfo "Updating scrollkeeper database ..." |
| 226 | "${SCROLLKEEPER_UPDATE_BIN}" -q -p "${SCROLLKEEPER_DIR}" |
221 | "${SCROLLKEEPER_UPDATE_BIN}" -q -p "${SCROLLKEEPER_DIR}" |
| 227 | fi |
222 | fi |
| 228 | } |
223 | } |
|
|
224 | |
|
|
225 | gnome2_schemas_savelist() { |
|
|
226 | pushd "${D}" &>/dev/null |
|
|
227 | export GNOME2_ECLASS_GLIB_SCHEMAS=$(find 'usr/share/glib-2.0/schemas' -name '*.gschema.xml' 2>/dev/null) |
|
|
228 | popd &>/dev/null |
|
|
229 | } |
|
|
230 | |
|
|
231 | gnome2_schemas_update() { |
|
|
232 | local updater="$(type -P glib-compile-schemas 2>/dev/null)" |
|
|
233 | |
|
|
234 | if [[ ! -x ${updater} ]]; then |
|
|
235 | debug-print "${updater} is not executable" |
|
|
236 | return |
|
|
237 | fi |
|
|
238 | |
|
|
239 | if [[ -z ${GNOME2_ECLASS_GLIB_SCHEMAS} ]]; then |
|
|
240 | debug-print "no schemas to update" |
|
|
241 | return |
|
|
242 | fi |
|
|
243 | |
|
|
244 | ebegin "Updating GSettings schemas" |
|
|
245 | ${updater} --allow-any-name "$@" "${ROOT%/}/usr/share/glib-2.0/schemas" &>/dev/null |
|
|
246 | eend $? |
|
|
247 | } |