diff options
author | Ulrich Müller <ulm@gentoo.org> | 2008-03-07 08:19:19 +0000 |
---|---|---|
committer | Ulrich Müller <ulm@gentoo.org> | 2008-03-07 08:19:19 +0000 |
commit | 874496de0b723a81d9a55b2de2f3f7e05e9b3ae7 (patch) | |
tree | 79d570148c9477dc26e4af77d1b57636abe1ec8f /eclass/elisp-common.eclass | |
parent | fix digests (diff) | |
download | gentoo-2-874496de0b723a81d9a55b2de2f3f7e05e9b3ae7.tar.gz gentoo-2-874496de0b723a81d9a55b2de2f3f7e05e9b3ae7.tar.bz2 gentoo-2-874496de0b723a81d9a55b2de2f3f7e05e9b3ae7.zip |
Sync eclasses from Emacs overlay (revision 1012).
elisp-common.eclass:
Work around Paludis borkage, where variable T is empty in pkg_postrm.
Clean up temporary files.
Diffstat (limited to 'eclass/elisp-common.eclass')
-rw-r--r-- | eclass/elisp-common.eclass | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/eclass/elisp-common.eclass b/eclass/elisp-common.eclass index e9f4909a9077..11d09451771d 100644 --- a/eclass/elisp-common.eclass +++ b/eclass/elisp-common.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/elisp-common.eclass,v 1.36 2008/02/22 09:30:40 ulm Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/elisp-common.eclass,v 1.37 2008/03/07 08:19:19 ulm Exp $ # # Copyright 2002-2004 Matthew Kennedy <mkennedy@gentoo.org> # Copyright 2003 Jeremy Maitin-Shepard <jbms@attbi.com> @@ -203,6 +203,7 @@ elisp-emacs-version() { # The following will work for at least versions 18--23. echo "(princ emacs-version)" >"${T}"/emacs-version.el ${EMACS} ${EMACSFLAGS} -l "${T}"/emacs-version.el + rm -f "${T}"/emacs-version.el } # @FUNCTION: elisp-make-autoload-file @@ -262,16 +263,18 @@ elisp-install() { # Install Emacs site-init file in SITELISP directory. elisp-site-file-install() { - local sf="${1##*/}" my_pn="${2:-${PN}}" + local sf="${T}/${1##*/}" my_pn="${2:-${PN}}" ret ebegin "Installing site initialisation file for GNU Emacs" - cp "$1" "${T}/${sf}" + cp "$1" "${sf}" sed -i -e "s:@SITELISP@:${SITELISP}/${my_pn}:g" \ - -e "s:@SITEETC@:${SITEETC}/${my_pn}:g" "${T}/${sf}" + -e "s:@SITEETC@:${SITEETC}/${my_pn}:g" "${sf}" ( # subshell to avoid pollution of calling environment insinto "${SITELISP}/site-gentoo.d" - doins "${T}/${sf}" + doins "${sf}" ) - eend $? "doins failed" + ret=$? + rm -f "${sf}" + eend ${ret} "doins failed" } # @FUNCTION: elisp-site-regen @@ -285,11 +288,12 @@ elisp-site-file-install() { elisp-site-regen() { local i sf line obsolete local -a sflist + local tmpdir=${T:-/tmp} if [ ! -e "${ROOT}${SITELISP}"/site-gentoo.el ] \ && [ ! -e "${ROOT}${SITELISP}"/site-start.el ]; then einfo "Creating default ${SITELISP}/site-start.el ..." - cat <<-EOF >"${T}"/site-start.el + cat <<-EOF >"${tmpdir}"/site-start.el ;;; site-start.el ;;; Commentary: @@ -330,7 +334,7 @@ elisp-site-regen() { eval "${old_shopts}" - cat <<-EOF >"${T}"/site-gentoo.el + cat <<-EOF >"${tmpdir}"/site-gentoo.el ;;; site-gentoo.el --- site initialisation for Gentoo-installed packages ;;; Commentary: @@ -339,8 +343,8 @@ elisp-site-regen() { ;;; Code: EOF - cat "${sflist[@]}" </dev/null >>"${T}"/site-gentoo.el - cat <<-EOF >>"${T}"/site-gentoo.el + cat "${sflist[@]}" </dev/null >>"${tmpdir}"/site-gentoo.el + cat <<-EOF >>"${tmpdir}"/site-gentoo.el (provide 'site-gentoo) @@ -350,16 +354,17 @@ elisp-site-regen() { ;;; site-gentoo.el ends here EOF - if cmp -s "${ROOT}${SITELISP}"/site-gentoo.el "${T}"/site-gentoo.el; then + if cmp -s "${ROOT}${SITELISP}"/site-gentoo.el "${tmpdir}"/site-gentoo.el + then # This prevents outputting unnecessary text when there # was actually no change. # A case is a remerge where we have doubled output. echo " no changes." else - mv "${T}"/site-gentoo.el "${ROOT}${SITELISP}"/site-gentoo.el - [ -f "${T}"/site-start.el ] \ + mv "${tmpdir}"/site-gentoo.el "${ROOT}${SITELISP}"/site-gentoo.el + [ -f "${tmpdir}"/site-start.el ] \ && [ ! -e "${ROOT}${SITELISP}"/site-start.el ] \ - && mv "${T}"/site-start.el "${ROOT}${SITELISP}"/site-start.el + && mv "${tmpdir}"/site-start.el "${ROOT}${SITELISP}"/site-start.el echo; einfo for sf in "${sflist[@]##*/}"; do einfo " Adding ${sf} ..." @@ -404,4 +409,7 @@ EOF [ "${sf%/*}" = "${ROOT}${SITELISP}/site-gentoo.d" ] \ && cat "${sf}" >>"${ROOT}${SITELISP}"/00site-gentoo.el done + + # cleanup + rm -f "${tmpdir}"/site-{gentoo,start}.el } |