summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2014-05-18 16:41:18 +0200
committerUlrich Müller <ulm@gentoo.org>2014-05-18 16:41:18 +0200
commit20f13fc2b967d676455e78874b3a3317539da520 (patch)
tree4f1d694cf9cf7056609af2e38f8d54b39dceda3d /eclass
parentelisp-common.eclass: Look for site-init files in site-gentoo.d only. (diff)
downloademacs-20f13fc2b967d676455e78874b3a3317539da520.tar.gz
emacs-20f13fc2b967d676455e78874b3a3317539da520.tar.bz2
emacs-20f13fc2b967d676455e78874b3a3317539da520.zip
elisp-common.eclass: Die on errors in elisp-site-regen.
* elisp-common.eclass (elisp-site-regen): Die on errors.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/ChangeLog2
-rw-r--r--eclass/elisp-common.eclass31
2 files changed, 17 insertions, 16 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog
index 34ffa34..a246178 100644
--- a/eclass/ChangeLog
+++ b/eclass/ChangeLog
@@ -1,5 +1,7 @@
2014-05-18 Ulrich Müller <ulm@gentoo.org>
+ * elisp-common.eclass (elisp-site-regen): Die on errors.
+
* elisp-common.eclass (elisp-site-regen): Look for site-init files
only in site-gentoo.d subdirectory.
diff --git a/eclass/elisp-common.eclass b/eclass/elisp-common.eclass
index 12bbc00..bf01c83 100644
--- a/eclass/elisp-common.eclass
+++ b/eclass/elisp-common.eclass
@@ -349,31 +349,27 @@ elisp-site-file-install() {
elisp-site-regen() {
local sitelisp=${ROOT}${EPREFIX}${SITELISP}
- local sf i null="" page=$'\f'
+ local sf i ret=0 null="" page=$'\f'
local -a sflist
- if [[ ! -d ${sitelisp} ]]; then
- eerror "elisp-site-regen: Directory ${sitelisp} does not exist"
- return 1
- fi
-
- if [[ ! -d ${T} ]]; then
- eerror "elisp-site-regen: Temporary directory ${T} does not exist"
- return 1
- fi
-
if [[ ${EBUILD_PHASE} = *rm && ! -e ${sitelisp}/site-gentoo.el ]]; then
ewarn "Refusing to create site-gentoo.el in ${EBUILD_PHASE} phase."
return 0
fi
+ [[ -d ${sitelisp} ]] \
+ || die "elisp-site-regen: Directory ${sitelisp} does not exist"
+
+ [[ -d ${T} ]] \
+ || die "elisp-site-regen: Temporary directory ${T} does not exist"
+
ebegin "Regenerating site-gentoo.el for GNU Emacs (${EBUILD_PHASE})"
for sf in "${sitelisp}"/site-gentoo.d/[0-9][0-9]*.el; do
[[ -r ${sf} ]] && sflist+=("${sf}")
done
- cat <<-EOF >"${T}"/site-gentoo.el
+ cat <<-EOF >"${T}"/site-gentoo.el || ret=$?
;;; site-gentoo.el --- site initialisation for Gentoo-installed packages
;;; Commentary:
@@ -383,8 +379,8 @@ elisp-site-regen() {
;;; Code:
EOF
# Use sed instead of cat here, since files may miss a trailing newline.
- sed '$q' "${sflist[@]}" </dev/null >>"${T}"/site-gentoo.el
- cat <<-EOF >>"${T}"/site-gentoo.el
+ sed '$q' "${sflist[@]}" </dev/null >>"${T}"/site-gentoo.el || ret=$?
+ cat <<-EOF >>"${T}"/site-gentoo.el || ret=$?
${page}
(provide 'site-gentoo)
@@ -397,7 +393,10 @@ elisp-site-regen() {
;;; site-gentoo.el ends here
EOF
- if cmp -s "${sitelisp}"/site-gentoo.el "${T}"/site-gentoo.el; then
+ if [[ ${ret} -ne 0 ]]; then
+ eend ${ret} "elisp-site-regen: Writing site-gentoo.el failed."
+ die
+ elif cmp -s "${sitelisp}"/site-gentoo.el "${T}"/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.
@@ -406,7 +405,7 @@ elisp-site-regen() {
einfo "... no changes."
else
mv "${T}"/site-gentoo.el "${sitelisp}"/site-gentoo.el
- eend
+ eend $? "elisp-site-regen: Replacing site-gentoo.el failed" || die
case ${#sflist[@]} in
0) [[ ${PN} = emacs-common-gentoo ]] \
|| ewarn "... Huh? No site initialisation files found." ;;