public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Ulrich Müller" <ulm@gentoo.org>
To: <gentoo-dev@lists.gentoo.org>
Subject: [gentoo-dev] [PATCH 1/3] elisp-common.eclass: Allow full versions in elisp-need-emacs().
Date: Wed, 18 Dec 2019 12:08:29 +0100	[thread overview]
Message-ID: <1af855e066c3024b9a021dc38211070944867486.1576663643.git.ulm@gentoo.org> (raw)
In-Reply-To: <cover.1576663643.git.ulm@gentoo.org>

[-- 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 --]

  reply	other threads:[~2019-12-18 11:08 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Ulrich Müller [this message]
2019-12-18 11:08 ` [gentoo-dev] [PATCH 2/3] elisp-common.eclass: Update documentation Ulrich Müller
2019-12-18 11:08 ` [gentoo-dev] [PATCH 3/3] elisp.eclass: Depend on app-editors/emacs directly Ulrich Müller
2019-12-18 11:47 ` [gentoo-dev] [PATCH 0/3] elisp{,-common}.eclass update for emacs-vcs consolidation Michał Górny
2019-12-18 12:01   ` Ulrich Mueller
2019-12-18 12:19 ` Michael Orlitzky
2019-12-18 16:34   ` Ulrich Mueller
2019-12-18 23:28     ` Michael Orlitzky
2019-12-20  1:19       ` Michael Orlitzky
2019-12-21  6:57         ` Ulrich Mueller
2019-12-21 11:27           ` Michael Orlitzky
2019-12-21 11:39             ` Ulrich Mueller
2019-12-21 11:41               ` Michael Orlitzky
2019-12-21 11:50                 ` Ulrich Mueller
2019-12-21 11:49               ` Michael Orlitzky
2019-12-21 11:52                 ` Ulrich Mueller
2019-12-21 13:31                   ` Michael 'veremitz' Everitt
2019-12-20 13:43 ` [gentoo-dev] [PATCH v2 1/3] elisp-common.eclass: New function elisp-check-emacs-version Ulrich Müller
2019-12-20 13:43 ` [gentoo-dev] [PATCH v2 2/3] elisp-common.eclass: Update documentation Ulrich Müller
2019-12-20 13:44 ` [gentoo-dev] [PATCH v2 3/3] elisp.eclass: Depend on app-editors/emacs directly Ulrich Müller
2019-12-20 22:10   ` Ulrich Mueller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1af855e066c3024b9a021dc38211070944867486.1576663643.git.ulm@gentoo.org \
    --to=ulm@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox