summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2012-12-12 08:37:41 +0100
committerUlrich Müller <ulm@gentoo.org>2012-12-12 08:37:41 +0100
commit10b28ea07a1ea737f175221e0a695db0cd543c2b (patch)
tree4ab43b6262daaf4ad9112bc3c59dfcee46db3ec8 /eclass
parentpackage.mask: Update mask for emacs-xwidget. Remove mask for emacs-vcs. (diff)
downloademacs-10b28ea07a1ea737f175221e0a695db0cd543c2b.tar.gz
emacs-10b28ea07a1ea737f175221e0a695db0cd543c2b.tar.bz2
emacs-10b28ea07a1ea737f175221e0a695db0cd543c2b.zip
elisp*.eclass: Better error handling in version comparison functions.
* elisp-common.eclass (elisp-need-emacs): Return 2 as exit status if the comparison could not be done, e.g., if emacs could not be executed in elisp-emacs-version. * elisp.eclass (elisp_pkg_setup): Distinguish between "version too low" and "could not determine version".
Diffstat (limited to 'eclass')
-rw-r--r--eclass/ChangeLog8
-rw-r--r--eclass/elisp-common.eclass6
-rw-r--r--eclass/elisp.eclass7
3 files changed, 17 insertions, 4 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog
index 4341f72..c24ca06 100644
--- a/eclass/ChangeLog
+++ b/eclass/ChangeLog
@@ -1,3 +1,11 @@
+2012-12-12 Ulrich Müller <ulm@gentoo.org>
+
+ * elisp-common.eclass (elisp-need-emacs): Return 2 as exit status
+ if the comparison could not be done, e.g., if emacs could not be
+ executed in elisp-emacs-version.
+ * elisp.eclass (elisp_pkg_setup): Distinguish between "version too
+ low" and "could not determine version".
+
2012-09-11 Ulrich Müller <ulm@gentoo.org>
* elisp-common.eclass (elisp-site-regen): Remove last remnants of
diff --git a/eclass/elisp-common.eclass b/eclass/elisp-common.eclass
index 90fbb9a..666b5b3 100644
--- a/eclass/elisp-common.eclass
+++ b/eclass/elisp-common.eclass
@@ -186,14 +186,14 @@ elisp-emacs-version() {
# @FUNCTION: elisp-need-emacs
# @USAGE: <version>
-# @RETURN: 0 if true, 1 otherwise
+# @RETURN: 0 if true, 1 if false, 2 if trouble
# @DESCRIPTION:
# Test if the eselected Emacs version is at least the major version
-# specified as argument.
+# of GNU Emacs specified as argument.
elisp-need-emacs() {
local need_emacs=$1 have_emacs
- have_emacs=$(elisp-emacs-version) || return
+ have_emacs=$(elisp-emacs-version) || return 2
einfo "Emacs version: ${have_emacs}"
if [[ ${have_emacs} =~ XEmacs|Lucid ]]; then
eerror "This package needs GNU Emacs."
diff --git a/eclass/elisp.eclass b/eclass/elisp.eclass
index 4d86be1..22f7ffe 100644
--- a/eclass/elisp.eclass
+++ b/eclass/elisp.eclass
@@ -83,7 +83,12 @@ RDEPEND="${DEPEND}"
# version requirement of the NEED_EMACS variable.
elisp_pkg_setup() {
- elisp-need-emacs "${NEED_EMACS:-21}" || die "Emacs version too low"
+ elisp-need-emacs "${NEED_EMACS:-21}"
+ case $? in
+ 0) ;;
+ 1) die "Emacs version too low" ;;
+ *) die "Could not determine Emacs version" ;;
+ esac
}
# @FUNCTION: elisp_src_unpack