/[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.52 Revision 1.57
1# Copyright 1999-2008 Gentoo Foundation 1# Copyright 1999-2009 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.52 2008/11/24 14:21:04 ulm Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/elisp-common.eclass,v 1.57 2009/03/12 14:10:48 ulm Exp $
4# 4#
5# Copyright 2002-2004 Matthew Kennedy <mkennedy@gentoo.org> 5# Copyright 2002-2004 Matthew Kennedy <mkennedy@gentoo.org>
6# Copyright 2003 Jeremy Maitin-Shepard <jbms@attbi.com> 6# Copyright 2003 Jeremy Maitin-Shepard <jbms@attbi.com>
7# Copyright 2004-2005 Mamoru Komachi <usata@gentoo.org> 7# Copyright 2004-2005 Mamoru Komachi <usata@gentoo.org>
8# Copyright 2007-2008 Christian Faulhammer <opfer@gentoo.org> 8# Copyright 2007-2008 Christian Faulhammer <fauli@gentoo.org>
9# Copyright 2007-2008 Ulrich Müller <ulm@gentoo.org> 9# Copyright 2007-2009 Ulrich Müller <ulm@gentoo.org>
10# 10#
11# @ECLASS: elisp-common.eclass 11# @ECLASS: elisp-common.eclass
12# @MAINTAINER: 12# @MAINTAINER:
13# Feel free to contact the Emacs team through <emacs@gentoo.org> if you have 13# Feel free to contact the Emacs team through <emacs@gentoo.org> if you have
14# problems, suggestions or questions. 14# problems, suggestions or questions.
311# still supported when generating site-gentoo.el. 311# still supported when generating site-gentoo.el.
312 312
313elisp-site-regen() { 313elisp-site-regen() {
314 local i sf line firstrun obsolete 314 local i sf line firstrun obsolete
315 local -a sflist 315 local -a sflist
316 # Work around Paludis borkage: variable T is empty in pkg_postrm
317 local tmpdir=${T:-$(mktemp -d)}
318 316
319 if [ ! -d "${ROOT}${SITELISP}" ]; then 317 if [ ! -d "${ROOT}${SITELISP}" ]; then
320 eerror "elisp-site-regen: Directory ${SITELISP} does not exist" 318 eerror "elisp-site-regen: Directory ${SITELISP} does not exist"
321 return 1 319 return 1
322 fi 320 fi
323 321
322 if [ ! -d "${T}" ]; then
323 eerror "elisp-site-regen: Temporary directory ${T} does not exist"
324 return 1
325 fi
326
324 [ -e "${ROOT}${SITELISP}"/site-gentoo.el ] || firstrun=t 327 [ -e "${ROOT}${SITELISP}"/site-gentoo.el ] \
328 || [ "${PN}" = emacs-common-gentoo ] || firstrun=t
325 329
326 if [ "${firstrun}" ] && [ ! -e "${ROOT}${SITELISP}"/site-start.el ]; then 330 if [ "${firstrun}" ] && [ ! -e "${ROOT}${SITELISP}"/site-start.el ]; then
327 einfo "Creating default ${SITELISP}/site-start.el ..." 331 einfo "Creating default site-start.el ..."
328 cat <<-EOF >"${tmpdir}"/site-start.el 332 cat <<-EOF >"${T}"/site-start.el
329 ;;; site-start.el 333 ;;; site-start.el
330 334
331 ;;; Commentary: 335 ;;; Commentary:
332 ;; This default site startup file is installed by elisp-common.eclass. 336 ;; This default site startup file is installed by elisp-common.eclass.
333 ;; You may replace this file by your own site initialisation, or even 337 ;; You may replace this file by your own site initialisation, or even
339 343
340 ;;; site-start.el ends here 344 ;;; site-start.el ends here
341 EOF 345 EOF
342 fi 346 fi
343 347
344 einfon "Regenerating ${SITELISP}/site-gentoo.el ..." 348 einfon "Regenerating site-gentoo.el (${EBUILD_PHASE}) ..."
345 349
346 # remove any auxiliary file (from previous run) 350 # remove any auxiliary file (from previous run)
347 rm -f "${ROOT}${SITELISP}"/00site-gentoo.el 351 rm -f "${ROOT}${SITELISP}"/00site-gentoo.el
348 352
349 # set nullglob option, there may be a directory without matching files 353 # set nullglob option, there may be a directory without matching files
364 [ "${sf%/*}" = "${ROOT}${SITELISP}" ] && obsolete=t 368 [ "${sf%/*}" = "${ROOT}${SITELISP}" ] && obsolete=t
365 done 369 done
366 370
367 eval "${old_shopts}" 371 eval "${old_shopts}"
368 372
369 cat <<-EOF >"${tmpdir}"/site-gentoo.el 373 cat <<-EOF >"${T}"/site-gentoo.el
370 ;;; site-gentoo.el --- site initialisation for Gentoo-installed packages 374 ;;; site-gentoo.el --- site initialisation for Gentoo-installed packages
371 375
372 ;;; Commentary: 376 ;;; Commentary:
373 ;; Automatically generated by elisp-common.eclass 377 ;; Automatically generated by elisp-common.eclass
374 ;; DO NOT EDIT THIS FILE 378 ;; DO NOT EDIT THIS FILE
375 379
376 ;;; Code: 380 ;;; Code:
377 EOF 381 EOF
378 # Use sed instead of cat here, since files may miss a trailing newline. 382 # Use sed instead of cat here, since files may miss a trailing newline.
379 sed '$q' "${sflist[@]}" </dev/null >>"${tmpdir}"/site-gentoo.el 383 sed '$q' "${sflist[@]}" </dev/null >>"${T}"/site-gentoo.el
380 cat <<-EOF >>"${tmpdir}"/site-gentoo.el 384 cat <<-EOF >>"${T}"/site-gentoo.el
381 385
382 (provide 'site-gentoo) 386 (provide 'site-gentoo)
383 387
384 ;; Local Variables: 388 ;; Local Variables:
385 ;; no-byte-compile: t 389 ;; no-byte-compile: t
386 ;; End: 390 ;; End:
387 ;;; site-gentoo.el ends here 391 ;;; site-gentoo.el ends here
388 EOF 392 EOF
389 393
390 if cmp -s "${ROOT}${SITELISP}"/site-gentoo.el "${tmpdir}"/site-gentoo.el 394 if cmp -s "${ROOT}${SITELISP}"/site-gentoo.el "${T}"/site-gentoo.el
391 then 395 then
392 # This prevents outputting unnecessary text when there 396 # This prevents outputting unnecessary text when there
393 # was actually no change. 397 # was actually no change.
394 # A case is a remerge where we have doubled output. 398 # A case is a remerge where we have doubled output.
395 echo " no changes." 399 echo " no changes."
396 else 400 else
397 mv "${tmpdir}"/site-gentoo.el "${ROOT}${SITELISP}"/site-gentoo.el 401 mv "${T}"/site-gentoo.el "${ROOT}${SITELISP}"/site-gentoo.el
398 [ -f "${tmpdir}"/site-start.el ] \ 402 [ -f "${T}"/site-start.el ] \
399 && [ ! -e "${ROOT}${SITELISP}"/site-start.el ] \ 403 && [ ! -e "${ROOT}${SITELISP}"/site-start.el ] \
400 && mv "${tmpdir}"/site-start.el "${ROOT}${SITELISP}"/site-start.el 404 && mv "${T}"/site-start.el "${ROOT}${SITELISP}"/site-start.el
401 echo 405 echo
402 einfo "... ${#sflist[@]} site initialisation file(s) included." 406 einfo "... ${#sflist[@]} site initialisation file(s) included."
403 fi 407 fi
404 408
405 if [ "${firstrun}" ]; then 409 if [ "${firstrun}" ]; then
429 Site-initialisation files of Emacs packages are now installed in 433 Site-initialisation files of Emacs packages are now installed in
430 /usr/share/emacs/site-lisp/site-gentoo.d/. We strongly recommend 434 /usr/share/emacs/site-lisp/site-gentoo.d/. We strongly recommend
431 that you use app-admin/emacs-updater to rebuild the installed 435 that you use app-admin/emacs-updater to rebuild the installed
432 Emacs packages. 436 Emacs packages.
433 EOF 437 EOF
434
435 # Kludge for backwards compatibility: During pkg_postrm, old versions
436 # of this eclass (saved in the VDB) won't find packages' site-init
437 # files in the new location. So we copy them to an auxiliary file
438 # that is visible to old eclass versions.
439 for sf in "${sflist[@]}"; do
440 [ "${sf%/*}" = "${ROOT}${SITELISP}/site-gentoo.d" ] \
441 && cat "${sf}" >>"${ROOT}${SITELISP}"/00site-gentoo.el
442 done
443 fi 438 fi
444 439
445 # cleanup 440 # cleanup
446 rm -f "${tmpdir}"/site-{gentoo,start}.el 441 rm -f "${T}"/site-{gentoo,start}.el
447 442
448 return 0 443 return 0
449} 444}

Legend:
Removed from v.1.52  
changed lines
  Added in v.1.57

  ViewVC Help
Powered by ViewVC 1.1.20