diff options
author | 2010-10-21 12:15:04 +0200 | |
---|---|---|
committer | 2010-10-21 12:15:04 +0200 | |
commit | 8d1ae5d01aedac16c6b3e9787b4300244aea7a31 (patch) | |
tree | bebad0323fbc2e572b98feacdc62e55e99684302 /eclass | |
parent | eclass/gnome2-utils.eclass: cosmetic fixes (diff) | |
download | gnome-8d1ae5d01aedac16c6b3e9787b4300244aea7a31.tar.gz gnome-8d1ae5d01aedac16c6b3e9787b4300244aea7a31.tar.bz2 gnome-8d1ae5d01aedac16c6b3e9787b4300244aea7a31.zip |
eclass/gnome2-utils.eclass: add support for EAPI 3
Integrate changes from the prefix overlay and keep backward
compatibility.
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/gnome2-utils.eclass | 51 |
1 files changed, 31 insertions, 20 deletions
diff --git a/eclass/gnome2-utils.eclass b/eclass/gnome2-utils.eclass index 6ebbb88d..5db49c80 100644 --- a/eclass/gnome2-utils.eclass +++ b/eclass/gnome2-utils.eclass @@ -11,7 +11,10 @@ # Maintained by Gentoo's GNOME herd <gnome@gentoo.org> # - +case "${EAPI:-0}" in + 0|1|2|3) ;; + *) die "EAPI=${EAPI} is not supported" ;; +esac # Path to gconftool-2 : ${GCONFTOOL_BIN:="/usr/bin/gconftool-2"} @@ -37,7 +40,8 @@ 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 + has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}" + pushd "${ED}" &> /dev/null export GNOME2_ECLASS_SCHEMAS=$(find 'etc/gconf/schemas/' -name '*.schemas' 2> /dev/null) popd &> /dev/null } @@ -46,7 +50,8 @@ gnome2_gconf_savelist() { # Applies any schema files installed by the current ebuild to Gconf's database # using gconftool-2 gnome2_gconf_install() { - local updater="${ROOT}${GCONFTOOL_BIN}" + has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" + local updater="${EROOT}${GCONFTOOL_BIN}" if [[ ! -x "${updater}" ]]; then return @@ -59,15 +64,15 @@ gnome2_gconf_install() { # We are ready to install the GCONF Scheme now unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL - export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${ROOT};")" + export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${EROOT};")" einfo "Installing GNOME 2 GConf schemas" local F for F in ${GNOME2_ECLASS_SCHEMAS}; do - if [[ -e "${ROOT}${F}" ]]; then + if [[ -e "${EROOT}${F}" ]]; then debug-print "Installing schema: ${F}" - "${updater}" --makefile-install-rule "${ROOT}${F}" 1>/dev/null + "${updater}" --makefile-install-rule "${EROOT}${F}" 1>/dev/null fi done @@ -84,7 +89,8 @@ gnome2_gconf_install() { # Removes schema files previously installed by the current ebuild from Gconf's # database. gnome2_gconf_uninstall() { - local updater="${ROOT}${GCONFTOOL_BIN}" + has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" + local updater="${EROOT}${GCONFTOOL_BIN}" if [[ ! -x "${updater}" ]]; then return @@ -96,15 +102,15 @@ gnome2_gconf_uninstall() { fi unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL - export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${ROOT};")" + export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${EROOT};")" einfo "Uninstalling GNOME 2 GConf schemas" local F for F in ${GNOME2_ECLASS_SCHEMAS}; do - if [[ -e "${ROOT}${F}" ]]; then + if [[ -e "${EROOT}${F}" ]]; then debug-print "Uninstalling gconf schema: ${F}" - "${updater}" --makefile-uninstall-rule "${ROOT}${F}" 1>/dev/null + "${updater}" --makefile-uninstall-rule "${EROOT}${F}" 1>/dev/null fi done @@ -122,7 +128,8 @@ gnome2_gconf_uninstall() { # in the GNOME2_ECLASS_ICONS environment variable # That function should be called from pkg_preinst gnome2_icon_savelist() { - pushd "${D}" &> /dev/null + has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}" + pushd "${ED}" &> /dev/null export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null) popd &> /dev/null } @@ -131,7 +138,8 @@ gnome2_icon_savelist() { # 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="${ROOT}${GTK_UPDATE_ICON_CACHE}" + has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" + local updater="${EROOT}${GTK_UPDATE_ICON_CACHE}" if [[ ! -x "${updater}" ]] ; then debug-print "${updater} is not executable" @@ -153,14 +161,14 @@ gnome2_icon_cache_update() { if [[ -f "${ROOT}${dir}/index.theme" ]] ; then local rv=0 - "${updater}" -qf "${ROOT}${dir}" + "${updater}" -qf "${EROOT}${dir}" rv=$? if [[ ! $rv -eq 0 ]] ; then - debug-print "Updating cache failed on ${ROOT}${dir}" + debug-print "Updating cache failed on ${EROOT}${dir}" # Add to the list of failures - fails[$(( ${#fails[@]} + 1 ))]="${ROOT}${dir}" + fails[$(( ${#fails[@]} + 1 ))]="${EROOT}${dir}" retval=2 fi @@ -224,20 +232,23 @@ gnome2_omf_fix() { # Updates the global scrollkeeper database. gnome2_scrollkeeper_update() { - if [[ -x "${ROOT}${SCROLLKEEPER_UPDATE_BIN}" ]]; then + has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" + if [[ -x "${EROOT}${SCROLLKEEPER_UPDATE_BIN}" ]]; then einfo "Updating scrollkeeper database ..." - "${ROOT}${SCROLLKEEPER_UPDATE_BIN}" -q -p "${ROOT}${SCROLLKEEPER_DIR}" + "${EROOT}${SCROLLKEEPER_UPDATE_BIN}" -q -p "${EROOT}${SCROLLKEEPER_DIR}" fi } gnome2_schemas_savelist() { - pushd "${D}" &>/dev/null + has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}" + pushd "${ED}" &>/dev/null export GNOME2_ECLASS_GLIB_SCHEMAS=$(find 'usr/share/glib-2.0/schemas' -name '*.gschema.xml' 2>/dev/null) popd &>/dev/null } gnome2_schemas_update() { - local updater="${ROOT}${GLIB_COMPILE_SCHEMAS}" + has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" + local updater="${EROOT}${GLIB_COMPILE_SCHEMAS}" if [[ ! -x ${updater} ]]; then debug-print "${updater} is not executable" @@ -250,6 +261,6 @@ gnome2_schemas_update() { fi ebegin "Updating GSettings schemas" - ${updater} --allow-any-name "$@" "${ROOT%/}/usr/share/glib-2.0/schemas" &>/dev/null + ${updater} --allow-any-name "$@" "${EROOT%/}/usr/share/glib-2.0/schemas" &>/dev/null eend $? } |