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

Diff of /eclass/gnome2-utils.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.23 Revision 1.27
1# Copyright 1999-2011 Gentoo Foundation 1# Copyright 1999-2012 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.23 2011/08/22 04:46:31 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v 1.27 2012/05/02 21:05:38 eva Exp $
4 4
5# @ECLASS: gnome2-utils.eclass 5# @ECLASS: gnome2-utils.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# gnome@gentoo.org 7# gnome@gentoo.org
8# @BLURB: Auxiliary functions commonly used by Gnome packages. 8# @BLURB: Auxiliary functions commonly used by Gnome packages.
60# @INTERNAL 60# @INTERNAL
61# @DEFAULT_UNSET 61# @DEFAULT_UNSET
62# @DESCRIPTION: 62# @DESCRIPTION:
63# List of icons provided by the package 63# List of icons provided by the package
64 64
65# @ECLASS-VARIABLE: GNOME2_ECLASS_SCROLLS
66# @INTERNAL
67# @DEFAULT_UNSET
68# @DESCRIPTION:
69# List of scrolls (documentation files) provided by the package
70
65# @ECLASS-VARIABLE: GNOME2_ECLASS_GLIB_SCHEMAS 71# @ECLASS-VARIABLE: GNOME2_ECLASS_GLIB_SCHEMAS
66# @INTERNAL 72# @INTERNAL
67# @DEFAULT_UNSET 73# @DEFAULT_UNSET
68# @DESCRIPTION: 74# @DESCRIPTION:
69# List of GSettings schemas provided by the package 75# List of GSettings schemas provided by the package
70 76
71
72DEPEND=">=sys-apps/sed-4" 77DEPEND=">=sys-apps/sed-4"
73 78
79
80# @FUNCTION: gnome2_environment_reset
81# @DESCRIPTION:
82# Reset various variables inherited from root's evironment to a reasonable
83# default for ebuilds to help avoid access violations and test failures.
84gnome2_environment_reset() {
85 # Respected by >=glib-2.30.1-r1
86 export G_HOME="${T}"
87
88 # GST_REGISTRY is to work around gst utilities trying to read/write /root
89 export GST_REGISTRY="${T}/registry.xml"
90
91 # XXX: code for resetting XDG_* directories should probably be moved into
92 # a separate function in a non-gnome eclass
93 export XDG_DATA_HOME="${T}/.local/share"
94 export XDG_CONFIG_HOME="${T}/.config"
95 export XDG_CACHE_HOME="${T}/.cache"
96 export XDG_RUNTIME_DIR="${T}/run"
97 mkdir -p "${XDG_DATA_HOME}" "${XDG_CONFIG_HOME}" "${XDG_CACHE_HOME}" \
98 "${XDG_RUNTIME_DIR}"
99 # This directory needs to be owned by the user, and chmod 0700
100 # http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
101 chmod 0700 "${XDG_RUNTIME_DIR}"
102}
74 103
75# @FUNCTION: gnome2_gconf_savelist 104# @FUNCTION: gnome2_gconf_savelist
76# @DESCRIPTION: 105# @DESCRIPTION:
77# Find the GConf schemas that are about to be installed and save their location 106# Find the GConf schemas that are about to be installed and save their location
78# in the GNOME2_ECLASS_SCHEMAS environment variable. 107# in the GNOME2_ECLASS_SCHEMAS environment variable.
216 # Add to the list of failures 245 # Add to the list of failures
217 fails[$(( ${#fails[@]} + 1 ))]="${EROOT}${dir}" 246 fails[$(( ${#fails[@]} + 1 ))]="${EROOT}${dir}"
218 247
219 retval=2 248 retval=2
220 fi 249 fi
250 elif [[ $(ls "${EROOT}${dir}") = "icon-theme.cache" ]]; then
251 # Clear stale cache files after theme uninstallation
252 rm "${EROOT}${dir}/icon-theme.cache"
253 fi
254
255 if [[ -z $(ls "${EROOT}${dir}") ]]; then
256 # Clear empty theme directories after theme uninstallation
257 rmdir "${EROOT}${dir}"
221 fi 258 fi
222 done 259 done
223 260
224 eend ${retval} 261 eend ${retval}
225 262
240 277
241 if [[ -f ${S}/omf.make ]] ; then 278 if [[ -f ${S}/omf.make ]] ; then
242 omf_makefiles="${omf_makefiles} ${S}/omf.make" 279 omf_makefiles="${omf_makefiles} ${S}/omf.make"
243 fi 280 fi
244 281
282 if [[ -f ${S}/gnome-doc-utils.make ]] ; then
283 omf_makefiles="${omf_makefiles} ${S}/gnome-doc-utils.make"
284 fi
285
245 # testing fixing of all makefiles found 286 # testing fixing of all makefiles found
246 # The sort is important to ensure .am is listed before the respective .in for 287 # The sort is important to ensure .am is listed before the respective .in for
247 # maintainer mode regeneration not kicking in due to .am being newer than .in 288 # maintainer mode regeneration not kicking in due to .am being newer than .in
248 for filename in $(find ./ -name "Makefile.in" -o -name "Makefile.am" |sort) ; do 289 for filename in $(find "${S}" -name "Makefile.in" -o -name "Makefile.am" |sort) ; do
249 omf_makefiles="${omf_makefiles} ${filename}" 290 omf_makefiles="${omf_makefiles} ${filename}"
250 done 291 done
251 292
252 ebegin "Fixing OMF Makefiles" 293 ebegin "Fixing OMF Makefiles"
253 294
254 local retval=0 295 local retval=0
255 local fails=( ) 296 local fails=( )
256 297
257 for omf in ${omf_makefiles} ; do 298 for omf in ${omf_makefiles} ; do
258 local rv=0
259
260 sed -i -e 's:scrollkeeper-update:true:' "${omf}" 299 sed -i -e 's:scrollkeeper-update:true:' "${omf}"
261 retval=$? 300 retval=$?
262 301
263 if [[ ! $rv -eq 0 ]] ; then 302 if [[ $retval -ne 0 ]] ; then
264 debug-print "updating of ${omf} failed" 303 debug-print "updating of ${omf} failed"
265 304
266 # Add to the list of failures 305 # Add to the list of failures
267 fails[$(( ${#fails[@]} + 1 ))]=$omf 306 fails[$(( ${#fails[@]} + 1 ))]=$omf
268 307
273 eend $retval 312 eend $retval
274 313
275 for f in "${fails[@]}" ; do 314 for f in "${fails[@]}" ; do
276 eerror "Failed to update OMF Makefile $f" 315 eerror "Failed to update OMF Makefile $f"
277 done 316 done
317}
318
319# @FUNCTION: gnome2_scrollkeeper_savelist
320# @DESCRIPTION:
321# Find the scrolls that are about to be installed and save their location
322# in the GNOME2_ECLASS_SCROLLS environment variable.
323# This function should be called from pkg_preinst.
324gnome2_scrollkeeper_savelist() {
325 has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
326 pushd "${ED}" &> /dev/null
327 export GNOME2_ECLASS_SCROLLS=$(find 'usr/share/omf' -type f -name "*.omf" 2> /dev/null)
328 popd &> /dev/null
278} 329}
279 330
280# @FUNCTION: gnome2_scrollkeeper_update 331# @FUNCTION: gnome2_scrollkeeper_update
281# @DESCRIPTION: 332# @DESCRIPTION:
282# Updates the global scrollkeeper database. 333# Updates the global scrollkeeper database.
283# This function should be called from pkg_postinst and pkg_postrm. 334# This function should be called from pkg_postinst and pkg_postrm.
284gnome2_scrollkeeper_update() { 335gnome2_scrollkeeper_update() {
285 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" 336 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
286 if [[ -x "${EROOT}${SCROLLKEEPER_UPDATE_BIN}" ]]; then 337 local updater="${EROOT}${SCROLLKEEPER_UPDATE_BIN}"
338
339 if [[ ! -x "${updater}" ]] ; then
340 debug-print "${updater} is not executable"
341 return
342 fi
343
344 if [[ -z "${GNOME2_ECLASS_SCROLLS}" ]]; then
345 debug-print "No scroll cache to update"
346 return
347 fi
348
287 einfo "Updating scrollkeeper database ..." 349 ebegin "Updating scrollkeeper database ..."
288 "${EROOT}${SCROLLKEEPER_UPDATE_BIN}" -q -p "${EROOT}${SCROLLKEEPER_DIR}" 350 "${updater}" -q -p "${EROOT}${SCROLLKEEPER_DIR}"
289 fi 351 eend $?
290} 352}
291 353
292# @FUNCTION: gnome2_schemas_savelist 354# @FUNCTION: gnome2_schemas_savelist
293# @DESCRIPTION: 355# @DESCRIPTION:
294# Find if there is any GSettings schema to install and save the list in 356# Find if there is any GSettings schema to install and save the list in
300 export GNOME2_ECLASS_GLIB_SCHEMAS=$(find 'usr/share/glib-2.0/schemas' -name '*.gschema.xml' 2>/dev/null) 362 export GNOME2_ECLASS_GLIB_SCHEMAS=$(find 'usr/share/glib-2.0/schemas' -name '*.gschema.xml' 2>/dev/null)
301 popd &>/dev/null 363 popd &>/dev/null
302} 364}
303 365
304# @FUNCTION: gnome2_schemas_update 366# @FUNCTION: gnome2_schemas_update
305# @USAGE: gnome2_schemas_update [--uninstall] 367# @USAGE: gnome2_schemas_update
306# @DESCRIPTION: 368# @DESCRIPTION:
307# Updates GSettings schemas if GNOME2_ECLASS_GLIB_SCHEMAS has some. 369# Updates GSettings schemas if GNOME2_ECLASS_GLIB_SCHEMAS has some.
308# This function should be called from pkg_postinst and pkg_postrm with --uninstall. 370# This function should be called from pkg_postinst and pkg_postrm.
309gnome2_schemas_update() { 371gnome2_schemas_update() {
310 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" 372 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
311 local updater="${EROOT}${GLIB_COMPILE_SCHEMAS}" 373 local updater="${EROOT}${GLIB_COMPILE_SCHEMAS}"
312 374
313 if [[ ! -x ${updater} ]]; then 375 if [[ ! -x ${updater} ]]; then

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.27

  ViewVC Help
Powered by ViewVC 1.1.20