/[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.56
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.56 2009/03/12 12:08:47 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 ] || firstrun=t
325 328
326 if [ "${firstrun}" ] && [ ! -e "${ROOT}${SITELISP}"/site-start.el ]; then 329 if [ "${firstrun}" ] && [ ! -e "${ROOT}${SITELISP}"/site-start.el ]; then
327 einfo "Creating default ${SITELISP}/site-start.el ..." 330 einfo "Creating default site-start.el ..."
328 cat <<-EOF >"${tmpdir}"/site-start.el 331 cat <<-EOF >"${T}"/site-start.el
329 ;;; site-start.el 332 ;;; site-start.el
330 333
331 ;;; Commentary: 334 ;;; Commentary:
332 ;; This default site startup file is installed by elisp-common.eclass. 335 ;; This default site startup file is installed by elisp-common.eclass.
333 ;; You may replace this file by your own site initialisation, or even 336 ;; You may replace this file by your own site initialisation, or even
339 342
340 ;;; site-start.el ends here 343 ;;; site-start.el ends here
341 EOF 344 EOF
342 fi 345 fi
343 346
344 einfon "Regenerating ${SITELISP}/site-gentoo.el ..." 347 einfon "Regenerating site-gentoo.el (${EBUILD_PHASE}) ..."
345 348
346 # remove any auxiliary file (from previous run) 349 # remove any auxiliary file (from previous run)
347 rm -f "${ROOT}${SITELISP}"/00site-gentoo.el 350 rm -f "${ROOT}${SITELISP}"/00site-gentoo.el
348 351
349 # set nullglob option, there may be a directory without matching files 352 # set nullglob option, there may be a directory without matching files
364 [ "${sf%/*}" = "${ROOT}${SITELISP}" ] && obsolete=t 367 [ "${sf%/*}" = "${ROOT}${SITELISP}" ] && obsolete=t
365 done 368 done
366 369
367 eval "${old_shopts}" 370 eval "${old_shopts}"
368 371
369 cat <<-EOF >"${tmpdir}"/site-gentoo.el 372 cat <<-EOF >"${T}"/site-gentoo.el
370 ;;; site-gentoo.el --- site initialisation for Gentoo-installed packages 373 ;;; site-gentoo.el --- site initialisation for Gentoo-installed packages
371 374
372 ;;; Commentary: 375 ;;; Commentary:
373 ;; Automatically generated by elisp-common.eclass 376 ;; Automatically generated by elisp-common.eclass
374 ;; DO NOT EDIT THIS FILE 377 ;; DO NOT EDIT THIS FILE
375 378
376 ;;; Code: 379 ;;; Code:
377 EOF 380 EOF
378 # Use sed instead of cat here, since files may miss a trailing newline. 381 # Use sed instead of cat here, since files may miss a trailing newline.
379 sed '$q' "${sflist[@]}" </dev/null >>"${tmpdir}"/site-gentoo.el 382 sed '$q' "${sflist[@]}" </dev/null >>"${T}"/site-gentoo.el
380 cat <<-EOF >>"${tmpdir}"/site-gentoo.el 383 cat <<-EOF >>"${T}"/site-gentoo.el
381 384
382 (provide 'site-gentoo) 385 (provide 'site-gentoo)
383 386
384 ;; Local Variables: 387 ;; Local Variables:
385 ;; no-byte-compile: t 388 ;; no-byte-compile: t
386 ;; End: 389 ;; End:
387 ;;; site-gentoo.el ends here 390 ;;; site-gentoo.el ends here
388 EOF 391 EOF
389 392
390 if cmp -s "${ROOT}${SITELISP}"/site-gentoo.el "${tmpdir}"/site-gentoo.el 393 if cmp -s "${ROOT}${SITELISP}"/site-gentoo.el "${T}"/site-gentoo.el
391 then 394 then
392 # This prevents outputting unnecessary text when there 395 # This prevents outputting unnecessary text when there
393 # was actually no change. 396 # was actually no change.
394 # A case is a remerge where we have doubled output. 397 # A case is a remerge where we have doubled output.
395 echo " no changes." 398 echo " no changes."
396 else 399 else
397 mv "${tmpdir}"/site-gentoo.el "${ROOT}${SITELISP}"/site-gentoo.el 400 mv "${T}"/site-gentoo.el "${ROOT}${SITELISP}"/site-gentoo.el
398 [ -f "${tmpdir}"/site-start.el ] \ 401 [ -f "${T}"/site-start.el ] \
399 && [ ! -e "${ROOT}${SITELISP}"/site-start.el ] \ 402 && [ ! -e "${ROOT}${SITELISP}"/site-start.el ] \
400 && mv "${tmpdir}"/site-start.el "${ROOT}${SITELISP}"/site-start.el 403 && mv "${T}"/site-start.el "${ROOT}${SITELISP}"/site-start.el
401 echo 404 echo
402 einfo "... ${#sflist[@]} site initialisation file(s) included." 405 einfo "... ${#sflist[@]} site initialisation file(s) included."
403 fi 406 fi
404 407
405 if [ "${firstrun}" ]; then 408 if [ "${firstrun}" ]; then
429 Site-initialisation files of Emacs packages are now installed in 432 Site-initialisation files of Emacs packages are now installed in
430 /usr/share/emacs/site-lisp/site-gentoo.d/. We strongly recommend 433 /usr/share/emacs/site-lisp/site-gentoo.d/. We strongly recommend
431 that you use app-admin/emacs-updater to rebuild the installed 434 that you use app-admin/emacs-updater to rebuild the installed
432 Emacs packages. 435 Emacs packages.
433 EOF 436 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 437 fi
444 438
445 # cleanup 439 # cleanup
446 rm -f "${tmpdir}"/site-{gentoo,start}.el 440 rm -f "${T}"/site-{gentoo,start}.el
447 441
448 return 0 442 return 0
449} 443}

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

  ViewVC Help
Powered by ViewVC 1.1.20