diff options
author | Rémi Cardona <remi@gentoo.org> | 2008-03-22 09:37:44 +0000 |
---|---|---|
committer | Rémi Cardona <remi@gentoo.org> | 2008-03-22 09:37:44 +0000 |
commit | 27b843cb91551cb1c0f4b3fbad8343f8b6afecf1 (patch) | |
tree | 6db8465e29ddc90979c72510d4f75b736b18c1c8 /eclass | |
parent | amd64 stable wrt #213283 (diff) | |
download | gentoo-2-27b843cb91551cb1c0f4b3fbad8343f8b6afecf1.tar.gz gentoo-2-27b843cb91551cb1c0f4b3fbad8343f8b6afecf1.tar.bz2 gentoo-2-27b843cb91551cb1c0f4b3fbad8343f8b6afecf1.zip |
fix gnome2 and xfce44 eclasses (see bug #155993)
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/gnome2-utils.eclass | 113 | ||||
-rw-r--r-- | eclass/gnome2.eclass | 14 | ||||
-rw-r--r-- | eclass/xfce44.eclass | 8 |
3 files changed, 88 insertions, 47 deletions
diff --git a/eclass/gnome2-utils.eclass b/eclass/gnome2-utils.eclass index 334052ba56e1..b72f0f1a925d 100644 --- a/eclass/gnome2-utils.eclass +++ b/eclass/gnome2-utils.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v 1.7 2008/02/10 14:47:14 eva Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v 1.8 2008/03/22 09:37:44 remi Exp $ # # gnome2-utils.eclass @@ -14,13 +14,13 @@ # Path to gconftool-2 -GCONFTOOL_BIN=${GCONFTOOL_BIN:="${ROOT}usr/bin/gconftool-2"} +: ${GCONFTOOL_BIN:="${ROOT}usr/bin/gconftool-2"} # Directory where scrollkeeper-update should do its work -SCROLLKEEPER_DIR=${SCROLLKEEPER_DIR:="${ROOT}var/lib/scrollkeeper"} +: ${SCROLLKEEPER_DIR:="${ROOT}var/lib/scrollkeeper"} # Path to scrollkeeper-update -SCROLLKEEPER_UPDATE_BIN=${SCROLLKEEPER_UPDATE_BIN:="${ROOT}usr/bin/scrollkeeper-update"} +: ${SCROLLKEEPER_UPDATE_BIN:="${ROOT}usr/bin/scrollkeeper-update"} @@ -28,26 +28,39 @@ DEPEND=">=sys-apps/sed-4" +# Find the GConf schemas that are about to be installed and save their location +# in the GNOME2_ECLASS_SCHEMAS environment variable +gnome2_gconf_savelist() { + pushd "${D}" &> /dev/null + export GNOME2_ECLASS_SCHEMAS=$(find 'etc/gconf/schemas/' -name '*.schemas') + popd &> /dev/null +} + + # Applies any schema files installed by the current ebuild to Gconf's database # using gconftool-2 gnome2_gconf_install() { - if [[ ! -x ${GCONFTOOL_BIN} ]]; then + local F + + if [[ ! -x "${GCONFTOOL_BIN}" ]]; then + return + fi + + if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then + einfo "No GNOME 2 GConf schemas found" return fi # We are ready to install the GCONF Scheme now unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL - export GCONF_CONFIG_SOURCE=$(${GCONFTOOL_BIN} --get-default-source) + export GCONF_CONFIG_SOURCE="$("${GCONFTOOL_BIN}" --get-default-source)" einfo "Installing GNOME 2 GConf schemas" - local contents="${ROOT}var/db/pkg/*/${PN}-${PVR}/CONTENTS" - local F - - for F in $(grep "^obj /etc/gconf/schemas/.\+\.schemas\b" ${contents} | gawk '{print $2}' ); do - if [[ -e "${F}" ]]; then + for F in ${GNOME2_ECLASS_SCHEMAS}; do + if [[ -e "${ROOT}${F}" ]]; then # echo "DEBUG::gconf install ${F}" - ${GCONFTOOL_BIN} --makefile-install-rule ${F} 1>/dev/null + "${GCONFTOOL_BIN}" --makefile-install-rule "${ROOT}${F}" 1>/dev/null fi done @@ -64,54 +77,81 @@ gnome2_gconf_install() { # Removes schema files previously installed by the current ebuild from Gconf's # database. gnome2_gconf_uninstall() { - if [[ ! -x ${GCONFTOOL_BIN} ]]; then + local F + + if [[ ! -x "${GCONFTOOL_BIN}" ]]; then + return + fi + + if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then + einfo "No GNOME 2 GConf schemas found" return fi unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL - export GCONF_CONFIG_SOURCE=$(${GCONFTOOL_BIN} --get-default-source) + export GCONF_CONFIG_SOURCE=$("${GCONFTOOL_BIN}" --get-default-source) einfo "Uninstalling GNOME 2 GConf schemas" - local contents="${ROOT}/var/db/pkg/*/${PN}-${PVR}/CONTENTS" - local F - - for F in $(grep "obj /etc/gconf/schemas" ${contents} | sed 's:obj \([^ ]*\) .*:\1:' ); do - # echo "DEBUG::gconf install ${F}" - ${GCONFTOOL_BIN} --makefile-uninstall-rule ${F} 1>/dev/null + for F in ${GNOME2_ECLASS_SCHEMAS}; do + if [[ -e "${ROOT}${F}" ]]; then + # echo "DEBUG::gconf uninstall ${F}" + "${GCONFTOOL_BIN}" --makefile-uninstall-rule "${ROOT}${F}" 1>/dev/null + fi done + + # have gconf reload the new schemas + pids=$(pgrep -x gconfd-2) + if [[ $? == 0 ]] ; then + ebegin "Reloading GConf schemas" + kill -HUP ${pids} + eend $? + fi +} + + +# Find the icons that are about to be installed and save their location +# in the GNOME2_ECLASS_ICONS environment variable +gnome2_icons_savelist() { + pushd "${D}" &> /dev/null + export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d) + popd &> /dev/null } # Updates Gtk+ icon cache files under /usr/share/icons if the current ebuild # have installed anything under that location. gnome2_icon_cache_update() { - local updater=$(type -p gtk-update-icon-cache 2> /dev/null) + local updater="$(type -p gtk-update-icon-cache 2> /dev/null)" - if [[ ! -x ${updater} ]] ; then + if [[ ! -x "${updater}" ]] ; then debug-print "${updater} is not executable" + return + fi + if [[ -z "${GNOME2_ECLASS_ICONS}" ]]; then return fi + ebegin "Updating icons cache" local retval=0 local fails=( ) - for dir in $(find "${ROOT}/usr/share/icons" -maxdepth 1 -mindepth 1 -type d) + for dir in ${GNOME2_ECLASS_ICONS} do - if [[ -f "${dir}/index.theme" ]] ; then + if [[ -f "${ROOT}${dir}/index.theme" ]] ; then local rv=0 - ${updater} -qf ${dir} + "${updater}" -qf "${ROOT}${dir}" rv=$? if [[ ! $rv -eq 0 ]] ; then - debug-print "Updating cache failed on ${dir}" + debug-print "Updating cache failed on ${ROOT}${dir}" # Add to the list of failures - fails[$(( ${#fails[@]} + 1 ))]=$dir + fails[$(( ${#fails[@]} + 1 ))]="${ROOT}${dir}" retval=2 fi @@ -120,16 +160,8 @@ gnome2_icon_cache_update() { eend ${retval} - for (( i = 0 ; i < ${#fails[@]} ; i++ )) ; do - ### HACK!! This is needed until bash 3.1 is unmasked. - ## The current stable version of bash lists the sizeof fails to be 1 - ## when there are no elements in the list because it is declared local. - ## In order to prevent the declaration from being in global scope, we - ## this hack to prevent an empty error message being printed for stable - ## users. -- compnerd && allanonjl - if [[ "${fails[i]}" != "" && "${fails[i]}" != "()" ]] ; then - eerror "Failed to update cache with icon ${fails[i]}" - fi + for f in "${fails[@]}" ; do + eerror "Failed to update cache with icon $f" done } @@ -158,7 +190,7 @@ gnome2_omf_fix() { for omf in ${omf_makefiles} ; do local rv=0 - sed -i -e 's:scrollkeeper-update:true:' ${omf} + sed -i -e 's:scrollkeeper-update:true:' "${omf}" retval=$? if [[ ! $rv -eq 0 ]] ; then @@ -189,9 +221,8 @@ gnome2_omf_fix() { # Updates the global scrollkeeper database. gnome2_scrollkeeper_update() { - if [[ -x ${SCROLLKEEPER_UPDATE_BIN} ]]; then + if [[ -x "${SCROLLKEEPER_UPDATE_BIN}" ]]; then einfo "Updating scrollkeeper database ..." - ${SCROLLKEEPER_UPDATE_BIN} -q -p ${SCROLLKEEPER_DIR} + "${SCROLLKEEPER_UPDATE_BIN}" -q -p "${SCROLLKEEPER_DIR}" fi } - diff --git a/eclass/gnome2.eclass b/eclass/gnome2.eclass index f720b985d0c8..7cb7c1d8d75b 100644 --- a/eclass/gnome2.eclass +++ b/eclass/gnome2.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2.eclass,v 1.83 2008/02/10 14:47:14 eva Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2.eclass,v 1.84 2008/03/22 09:37:44 remi Exp $ # # gnome2.eclass @@ -82,7 +82,7 @@ gnome2_src_install() { if [[ -z "${USE_EINSTALL}" || "${USE_EINSTALL}" = "0" ]]; then debug-print "Installing with 'make install'" - make DESTDIR="${D}" "scrollkeeper_localstate_dir=${D}${sk_tmp_dir} " "$@" install || die "install failed" + emake DESTDIR="${D}" "scrollkeeper_localstate_dir=${D}${sk_tmp_dir} " "$@" install || die "install failed" else debug-print "Installing with 'einstall'" einstall "scrollkeeper_localstate_dir=${D}${sk_tmp_dir} " "$@" || die "einstall failed" @@ -97,7 +97,7 @@ gnome2_src_install() { # 1. The scrollkeeper database is regenerated at pkg_postinst() # 2. ${D}/var/lib/scrollkeeper contains only indexes for the current pkg # thus it makes no sense if pkg_postinst ISN'T run for some reason. - if [[ -z "$(find ${D} -name '*.omf')" ]]; then + if [[ -z "$(find "${D}" -name '*.omf')" ]]; then export SCROLLKEEPER_UPDATE="0" fi rm -rf "${D}${sk_tmp_dir}" @@ -106,6 +106,11 @@ gnome2_src_install() { rm -fr "${D}/usr/share/applications/mimeinfo.cache" } +gnome2_pkg_preinst() { + gnome2_gconf_savelist + gnome2_icons_savelist +} + gnome2_pkg_postinst() { gnome2_gconf_install fdo-mime_desktop_database_update @@ -131,4 +136,5 @@ gnome2_pkg_postrm() { fi } -EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_postinst pkg_postrm +# pkg_prerm +EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_postrm diff --git a/eclass/xfce44.eclass b/eclass/xfce44.eclass index 52cc38894ad1..5757e97eb3da 100644 --- a/eclass/xfce44.eclass +++ b/eclass/xfce44.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/xfce44.eclass,v 1.20 2007/05/24 19:05:21 drac Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/xfce44.eclass,v 1.21 2008/03/22 09:37:44 remi Exp $ # Xfce44 Eclass # @@ -145,6 +145,10 @@ xfce44_src_install() { ${INSTALL} ${JOBS} || die } +xfce44_pkg_preinst() { + gnome2_icons_savelist +} + xfce44_pkg_postinst() { fdo-mime_desktop_database_update fdo-mime_mime_database_update @@ -157,4 +161,4 @@ xfce44_pkg_postrm() { gnome2_icon_cache_update } -EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm +EXPORT_FUNCTIONS src_compile src_install pkg_preinst pkg_postinst pkg_postrm |