public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download: 
* [gentoo-dev] [PATCH 1/3] elisp-common.eclass: Allow full versions in elisp-need-emacs().
  @ 2019-12-18 11:08 99% ` Ulrich Müller
  0 siblings, 0 replies; 1+ results
From: Ulrich Müller @ 2019-12-18 11:08 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1465 bytes --]

To this end, replace the simple numeric comparison of the first
component by a call to ver_test.

Signed-off-by: Ulrich Müller <ulm@gentoo.org>
---
 eclass/elisp-common.eclass | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/eclass/elisp-common.eclass b/eclass/elisp-common.eclass
index 79f29ef95ad..6f79caee2f0 100644
--- a/eclass/elisp-common.eclass
+++ b/eclass/elisp-common.eclass
@@ -158,7 +158,8 @@
 # merge and unmerge of a package.
 
 case ${EAPI:-0} in
-	4|5|6|7) ;;
+	4|5|6) inherit eapi7-ver ;;
+	7) ;;
 	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
@@ -230,11 +231,16 @@ elisp-need-emacs() {
 	have_emacs=$(elisp-emacs-version) || return 2
 	einfo "Emacs version: ${have_emacs}"
 	if [[ ${have_emacs} =~ XEmacs|Lucid ]]; then
-		eerror "This package needs GNU Emacs."
+		eerror "XEmacs detected. This package needs GNU Emacs."
 		return 1
 	fi
-	if ! [[ ${have_emacs%%.*} -ge ${need_emacs%%.*} ]]; then
-		eerror "This package needs at least Emacs ${need_emacs%%.*}."
+	# GNU Emacs versions have only numeric components.
+	if ! [[ ${have_emacs} =~ ^[0-9]+(\.[0-9]+)*$ ]]; then
+		eerror "Malformed version string: ${have_emacs}"
+		return 2
+	fi
+	if ! ver_test "${have_emacs}" -ge "${need_emacs}"; then
+		eerror "This package needs at least Emacs ${need_emacs}."
 		eerror "Use \"eselect emacs\" to select the active version."
 		return 1
 	fi
-- 
2.24.1

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply related	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2019-12-18 11:08     [gentoo-dev] [PATCH 0/3] elisp{,-common}.eclass update for emacs-vcs consolidation Ulrich Müller
2019-12-18 11:08 99% ` [gentoo-dev] [PATCH 1/3] elisp-common.eclass: Allow full versions in elisp-need-emacs() Ulrich Müller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox