/[gentoo-x86]/eclass/elisp-common.eclass
Gentoo

Diff of /eclass/elisp-common.eclass

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

Revision 1.88 Revision 1.89
1# Copyright 1999-2014 Gentoo Foundation 1# Copyright 1999-2014 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/elisp-common.eclass,v 1.88 2014/05/24 08:47:29 ulm Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/elisp-common.eclass,v 1.89 2014/05/24 08:48:40 ulm Exp $
4# 4#
5# @ECLASS: elisp-common.eclass 5# @ECLASS: elisp-common.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Gentoo Emacs team <emacs@gentoo.org> 7# Gentoo Emacs team <emacs@gentoo.org>
8# @AUTHOR: 8# @AUTHOR:
343# initialisation files in the /usr/share/emacs/site-lisp/site-gentoo.d/ 343# initialisation files in the /usr/share/emacs/site-lisp/site-gentoo.d/
344# directory. 344# directory.
345 345
346elisp-site-regen() { 346elisp-site-regen() {
347 local sitelisp=${ROOT}${EPREFIX}${SITELISP} 347 local sitelisp=${ROOT}${EPREFIX}${SITELISP}
348 local sf i null="" page=$'\f' 348 local sf i ret=0 null="" page=$'\f'
349 local -a sflist 349 local -a sflist
350
351 if [[ ! -d ${sitelisp} ]]; then
352 eerror "elisp-site-regen: Directory ${sitelisp} does not exist"
353 return 1
354 fi
355
356 if [[ ! -d ${T} ]]; then
357 eerror "elisp-site-regen: Temporary directory ${T} does not exist"
358 return 1
359 fi
360 350
361 if [[ ${EBUILD_PHASE} = *rm && ! -e ${sitelisp}/site-gentoo.el ]]; then 351 if [[ ${EBUILD_PHASE} = *rm && ! -e ${sitelisp}/site-gentoo.el ]]; then
362 ewarn "Refusing to create site-gentoo.el in ${EBUILD_PHASE} phase." 352 ewarn "Refusing to create site-gentoo.el in ${EBUILD_PHASE} phase."
363 return 0 353 return 0
364 fi 354 fi
365 355
356 [[ -d ${sitelisp} ]] \
357 || die "elisp-site-regen: Directory ${sitelisp} does not exist"
358
359 [[ -d ${T} ]] \
360 || die "elisp-site-regen: Temporary directory ${T} does not exist"
361
366 ebegin "Regenerating site-gentoo.el for GNU Emacs (${EBUILD_PHASE})" 362 ebegin "Regenerating site-gentoo.el for GNU Emacs (${EBUILD_PHASE})"
367 363
368 for sf in "${sitelisp}"/site-gentoo.d/[0-9][0-9]*.el; do 364 for sf in "${sitelisp}"/site-gentoo.d/[0-9][0-9]*.el; do
369 [[ -r ${sf} ]] && sflist+=("${sf}") 365 [[ -r ${sf} ]] && sflist+=("${sf}")
370 done 366 done
371 367
372 cat <<-EOF >"${T}"/site-gentoo.el 368 cat <<-EOF >"${T}"/site-gentoo.el || ret=$?
373 ;;; site-gentoo.el --- site initialisation for Gentoo-installed packages 369 ;;; site-gentoo.el --- site initialisation for Gentoo-installed packages
374 370
375 ;;; Commentary: 371 ;;; Commentary:
376 ;; Automatically generated by elisp-common.eclass 372 ;; Automatically generated by elisp-common.eclass
377 ;; DO NOT EDIT THIS FILE 373 ;; DO NOT EDIT THIS FILE
378 374
379 ;;; Code: 375 ;;; Code:
380 EOF 376 EOF
381 # Use sed instead of cat here, since files may miss a trailing newline. 377 # Use sed instead of cat here, since files may miss a trailing newline.
382 sed '$q' "${sflist[@]}" </dev/null >>"${T}"/site-gentoo.el 378 sed '$q' "${sflist[@]}" </dev/null >>"${T}"/site-gentoo.el || ret=$?
383 cat <<-EOF >>"${T}"/site-gentoo.el 379 cat <<-EOF >>"${T}"/site-gentoo.el || ret=$?
384 380
385 ${page} 381 ${page}
386 (provide 'site-gentoo) 382 (provide 'site-gentoo)
387 383
388 ;; Local ${null}Variables: 384 ;; Local ${null}Variables:
391 ;; End: 387 ;; End:
392 388
393 ;;; site-gentoo.el ends here 389 ;;; site-gentoo.el ends here
394 EOF 390 EOF
395 391
392 if [[ ${ret} -ne 0 ]]; then
393 eend ${ret} "elisp-site-regen: Writing site-gentoo.el failed."
394 die
396 if cmp -s "${sitelisp}"/site-gentoo.el "${T}"/site-gentoo.el; then 395 elif cmp -s "${sitelisp}"/site-gentoo.el "${T}"/site-gentoo.el; then
397 # This prevents outputting unnecessary text when there 396 # This prevents outputting unnecessary text when there
398 # was actually no change. 397 # was actually no change.
399 # A case is a remerge where we have doubled output. 398 # A case is a remerge where we have doubled output.
400 rm -f "${T}"/site-gentoo.el 399 rm -f "${T}"/site-gentoo.el
401 eend 400 eend
402 einfo "... no changes." 401 einfo "... no changes."
403 else 402 else
404 mv "${T}"/site-gentoo.el "${sitelisp}"/site-gentoo.el 403 mv "${T}"/site-gentoo.el "${sitelisp}"/site-gentoo.el
405 eend 404 eend $? "elisp-site-regen: Replacing site-gentoo.el failed" || die
406 case ${#sflist[@]} in 405 case ${#sflist[@]} in
407 0) [[ ${PN} = emacs-common-gentoo ]] \ 406 0) [[ ${PN} = emacs-common-gentoo ]] \
408 || ewarn "... Huh? No site initialisation files found." ;; 407 || ewarn "... Huh? No site initialisation files found." ;;
409 1) einfo "... ${#sflist[@]} site initialisation file included." ;; 408 1) einfo "... ${#sflist[@]} site initialisation file included." ;;
410 *) einfo "... ${#sflist[@]} site initialisation files included." ;; 409 *) einfo "... ${#sflist[@]} site initialisation files included." ;;

Legend:
Removed from v.1.88  
changed lines
  Added in v.1.89

  ViewVC Help
Powered by ViewVC 1.1.20