diff options
author | Leonardo Boshell <leonardop@gentoo.org> | 2006-12-12 02:58:22 +0000 |
---|---|---|
committer | Leonardo Boshell <leonardop@gentoo.org> | 2006-12-12 02:58:22 +0000 |
commit | 3040c767ef60e9a88387437b56bd44adfe771890 (patch) | |
tree | 7730a6fed93abde70bbf59bedea563f36e63e2dd /eclass | |
parent | waste of space (diff) | |
download | gentoo-2-3040c767ef60e9a88387437b56bd44adfe771890.tar.gz gentoo-2-3040c767ef60e9a88387437b56bd44adfe771890.tar.bz2 gentoo-2-3040c767ef60e9a88387437b56bd44adfe771890.zip |
* gnome2.eclass: Pre-split clean-ups.
Added a small comment header at the top.
Prefix $SCROLLKEEPER_DIR with $ROOT and make sure it's used only in
gnome2_scrollkeeper_update().
(gnome2_src_configure): Clarify the comment for the addwrite call.
(gnome2_src_install): Replace $SCROLLKEEPER_DIR with the local
$sk_tmp_dir, since this function creates this dir under $D. Replace
single debug-print call with specific mesages according to the method of
installation used.
(gnome2_gconf_install), (gnome2_gconf_uninstall): Added short comment.
Return early if $GCONFTOOL_BIN is not valid. Declare F as local.
(gnome2_icon_cache_update): Added short comment. Show output only if the
function actually performs an update.
(gnome2_omf_fix): Added comment about the function before its declaration.
Removed redundant addition to $omf_makefiles.
(gnome2_scrollkeeper_update): Added short comment.
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/gnome2.eclass | 138 |
1 files changed, 72 insertions, 66 deletions
diff --git a/eclass/gnome2.eclass b/eclass/gnome2.eclass index 444a03994271..a9445380b469 100644 --- a/eclass/gnome2.eclass +++ b/eclass/gnome2.eclass @@ -1,10 +1,20 @@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2.eclass,v 1.76 2006/12/07 03:13:25 compnerd Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2.eclass,v 1.77 2006/12/12 02:58:22 leonardop Exp $ + +# +# gnome2.eclass +# +# Exports portage base functions used by ebuilds written for packages using the +# GNOME framework. +# +# Maintained by Gentoo's GNOME herd <gnome@gentoo.org> +# + -# GNOME 2 ECLASS inherit libtool gnome.org debug fdo-mime eutils + # Extra configure opts passed to econf G2CONF=${G2CONF:=""} @@ -17,14 +27,14 @@ USE_EINSTALL=${USE_EINSTALL:=""} # Run scrollkeeper for this package? SCROLLKEEPER_UPDATE=${SCROLLKEEPER_UPDATE:="1"} -# Where to put scrollkeeper data lives -SCROLLKEEPER_DIR=${SCROLLKEEPER_DIR:="/var/lib/scrollkeeper"} +# Directory where scrollkeeper-update should do its work +SCROLLKEEPER_DIR=${SCROLLKEEPER_DIR:="${ROOT}var/lib/scrollkeeper"} # Path to scrollkeeper-update -SCROLLKEEPER_UPDATE_BIN=${SCROLLKEEPER_UPDATE_BIN:="${ROOT}/usr/bin/scrollkeeper-update"} +SCROLLKEEPER_UPDATE_BIN=${SCROLLKEEPER_UPDATE_BIN:="${ROOT}usr/bin/scrollkeeper-update"} # Path to gconftool-2 -GCONFTOOL_BIN=${GCONFTOOL_BIN:="${ROOT}/usr/bin/gconftool-2"} +GCONFTOOL_BIN=${GCONFTOOL_BIN:="${ROOT}usr/bin/gconftool-2"} if [[ ${GCONF_DEBUG} != "no" ]]; then IUSE="debug" @@ -56,8 +66,8 @@ gnome2_src_configure() { # Run libtoolize elibtoolize ${ELTCONF} - # Do not remove the addwrite. bug #128289 - addwrite "${ROOT}/root/.gnome2" + # Avoid sandbox violations caused by misbehaving packages (bug #128289) + addwrite "${ROOT}root/.gnome2" # GST_REGISTRY is to work around gst-inspect trying to read/write /root GST_REGISTRY="${S}/registry.xml" econf "$@" ${G2CONF} || die "configure failed" @@ -71,16 +81,18 @@ gnome2_src_compile() { gnome2_src_install() { # if this is not present, scrollkeeper-update may segfault and # create bogus directories in /var/lib/ - dodir "${SCROLLKEEPER_DIR}" + local sk_tmp_dir="/var/lib/scrollkeeper" + dodir "${sk_tmp_dir}" # we must delay gconf schema installation due to sandbox export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL="1" - debug-print "You are testing with DESTDIR by default - AllanonJL" if [[ -z "${USE_EINSTALL}" || "${USE_EINSTALL}" = "0" ]]; then - make DESTDIR=${D} "scrollkeeper_localstate_dir=${D}${SCROLLKEEPER_DIR} " "$@" install || die "install failed" + debug-print "Installing with 'make install'" + make DESTDIR=${D} "scrollkeeper_localstate_dir=${D}${sk_tmp_dir} " "$@" install || die "install failed" else - einstall "scrollkeeper_localstate_dir=${D}${SCROLLKEEPER_DIR} " "$@" || die "einstall failed" + debug-print "Installing with 'einstall'" + einstall "scrollkeeper_localstate_dir=${D}${sk_tmp_dir} " "$@" || die "einstall failed" fi unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL @@ -89,75 +101,78 @@ gnome2_src_install() { [[ -n "${DOCS}" ]] && dodoc ${DOCS} # Do not keep /var/lib/scrollkeeper because: - # 1. scrollkeeper will get regenerated at pkg_postinst() + # 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 export SCROLLKEEPER_UPDATE="0" fi - - # Regenerate these in pkg_postinst() - rm -rf "${D}${SCROLLKEEPER_DIR}" + rm -rf "${D}${sk_tmp_dir}" # Make sure this one doesn't get in the portage db rm -fr "${D}/usr/share/applications/mimeinfo.cache" } -gnome2_gconf_install() { - if [[ -x ${GCONFTOOL_BIN} ]]; then - # We are ready to install the GCONF Scheme now - unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL - export GCONF_CONFIG_SOURCE=$(${GCONFTOOL_BIN} --get-default-source) +# Applies any schema files installed by the current ebuild to Gconf's database +# using gconftool-2 +gnome2_gconf_install() { + if [[ ! -x ${GCONFTOOL_BIN} ]]; then + return + fi - einfo "Installing GNOME 2 GConf schemas" + # We are ready to install the GCONF Scheme now + unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL + export GCONF_CONFIG_SOURCE=$(${GCONFTOOL_BIN} --get-default-source) - local contents="${ROOT}/var/db/pkg/*/${PN}-${PVR}/CONTENTS" + einfo "Installing GNOME 2 GConf schemas" - for F in $(grep "^obj /etc/gconf/schemas/.\+\.schemas\b" ${contents} | gawk '{print $2}' ); do - if [[ -e "${F}" ]]; then - # echo "DEBUG::gconf install ${F}" - ${GCONFTOOL_BIN} --makefile-install-rule ${F} 1>/dev/null - fi - done + local contents="${ROOT}/var/db/pkg/*/${PN}-${PVR}/CONTENTS" + local F - # have gconf reload the new schemas - ebegin "Reloading GConf schemas" - killall -HUP gconfd-2 - eend $? - fi + for F in $(grep "^obj /etc/gconf/schemas/.\+\.schemas\b" ${contents} | gawk '{print $2}' ); do + if [[ -e "${F}" ]]; then + # echo "DEBUG::gconf install ${F}" + ${GCONFTOOL_BIN} --makefile-install-rule ${F} 1>/dev/null + fi + done + # have gconf reload the new schemas + ebegin "Reloading GConf schemas" + killall -HUP gconfd-2 + eend $? } +# Removes schema files previously installed by the current ebuild from Gconf's +# database. gnome2_gconf_uninstall() { - if [[ -x ${GCONFTOOL_BIN} ]]; then - unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL - export GCONF_CONFIG_SOURCE=$(${GCONFTOOL_BIN} --get-default-source) + if [[ ! -x ${GCONFTOOL_BIN} ]]; then + return + fi - einfo "Uninstalling GNOME 2 GConf schemas" + unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL + export GCONF_CONFIG_SOURCE=$(${GCONFTOOL_BIN} --get-default-source) - local contents="${ROOT}/var/db/pkg/*/${PN}-${PVR}/CONTENTS" + einfo "Uninstalling GNOME 2 GConf schemas" - 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 - done - fi + 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 + done } +# 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) - ebegin "Updating icons cache" - if [[ ! -x ${updater} ]] ; then debug-print "${updater} is not executable" - # We failed to run - eend 1 - return fi @@ -165,12 +180,11 @@ gnome2_icon_cache_update() { then debug-print "No items to update" - # We are done successfully - eend 0 - return fi + ebegin "Updating icons cache" + local retval=0 local fails=( ) @@ -208,23 +222,13 @@ gnome2_icon_cache_update() { done } +# Workaround applied to Makefile rules in order to remove redundant +# calls to scrollkeeper-update and sandbox violations. gnome2_omf_fix() { - # workaround/patch against omf.make or omf-install/Makefile.in - # in order to remove redundant scrollkeeper-updates. - # - <liquidx@gentoo.org> - local omf_makefiles filename omf_makefiles="$@" - if [[ -f ${S}/omf-install/Makefile.in ]] ; then - omf_makefiles="${omf_makefiles} ${S}/omf-install/Makefile.in" - fi - - # FIXME: does this really work? because omf.make only gets included - # when autoconf/automake is run. You should directly patch - # the Makefile.in's - if [[ -f ${S}/omf.make ]] ; then omf_makefiles="${omf_makefiles} ${S}/omf.make" fi @@ -270,11 +274,13 @@ gnome2_omf_fix() { done } +# Updates the scrollkeeper database if necessary. To force this action, make +# sure to set SCROLLKEPER_UPDATE to 1. gnome2_scrollkeeper_update() { if [[ -x ${SCROLLKEEPER_UPDATE_BIN} && "${SCROLLKEEPER_UPDATE}" = "1" ]] then einfo "Updating scrollkeeper database ..." - ${SCROLLKEEPER_UPDATE_BIN} -q -p ${ROOT}${SCROLLKEEPER_DIR} + ${SCROLLKEEPER_UPDATE_BIN} -q -p ${SCROLLKEEPER_DIR} fi } |