From: "Ulrich Müller" <ulm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/proj/emacs:master commit in: eclass/
Date: Sat, 21 Dec 2019 18:30:46 +0000 (UTC) [thread overview]
Message-ID: <1576952767.6da4969af2e59af57c07dc42745eeb9460e0d34f.ulm@gentoo> (raw)
commit: 6da4969af2e59af57c07dc42745eeb9460e0d34f
Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 21 18:26:07 2019 +0000
Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Sat Dec 21 18:26:07 2019 +0000
URL: https://gitweb.gentoo.org/repo/proj/emacs.git/commit/?id=6da4969a
elisp*.eclass: Sync from gentoo repo.
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>
eclass/elisp-common.eclass | 100 ++++++++++++++++++++++++++++++++++++---------
eclass/elisp.eclass | 20 ++++-----
2 files changed, 88 insertions(+), 32 deletions(-)
diff --git a/eclass/elisp-common.eclass b/eclass/elisp-common.eclass
index 05b03f4..d76c9e5 100644
--- a/eclass/elisp-common.eclass
+++ b/eclass/elisp-common.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: elisp-common.eclass
@@ -23,26 +23,25 @@
# When relying on the emacs USE flag, you need to add
#
# @CODE
-# emacs? ( virtual/emacs )
+# emacs? ( >=app-editors/emacs-23.1:* )
# @CODE
#
# to your DEPEND/RDEPEND line and use the functions provided here to
# bring the files to the correct locations.
#
-# If your package requires a minimum Emacs version, e.g. Emacs 24, then
-# the dependency should be on >=virtual/emacs-24 instead. Because the
-# user can select the Emacs executable with eselect, you should also
-# make sure that the active Emacs version is sufficient. This can be
-# tested with function elisp-need-emacs(), which would typically be
-# called from pkg_setup(), as in the following example:
+# If your package requires a minimum Emacs version, e.g. Emacs 26.1,
+# then the dependency should be on >=app-editors/emacs-26.1:* instead.
+# Because the user can select the Emacs executable with eselect, you
+# should also make sure that the active Emacs version is sufficient.
+# The eclass will automatically ensure this if you assign variable
+# NEED_EMACS with the Emacs version, as in the following example:
#
# @CODE
-# elisp-need-emacs 24 || die "Emacs version too low"
+# NEED_EMACS=26.1
# @CODE
#
-# Please note that such tests should be limited to packages that are
-# known to fail with lower Emacs versions; the standard case is to
-# depend on virtual/emacs without version.
+# Please note that this should be done only for packages that are known
+# to fail with lower Emacs versions.
#
# @ROFF .SS
# src_compile() usage:
@@ -134,6 +133,23 @@
# the differing name as second argument.
#
# @ROFF .SS
+# pkg_setup() usage:
+#
+# If your ebuild uses the elisp-compile eclass function to compile
+# its elisp files (see above), then you don't need a pkg_setup phase,
+# because elisp-compile and elisp-make-autoload-file do their own sanity
+# checks. On the other hand, if the elisp files are compiled by the
+# package's build system, then there is often no check for the Emacs
+# version. In this case, you can add an explicit check in pkg_setup:
+#
+# @CODE
+# elisp-check-emacs-version
+# @CODE
+#
+# When having optional Emacs support, you should prepend "use emacs &&"
+# to above call of elisp-check-emacs-version().
+#
+# @ROFF .SS
# pkg_postinst() / pkg_postrm() usage:
#
# After that you need to recreate the start-up file of Emacs after
@@ -149,12 +165,14 @@
# }
# @CODE
#
-# When having optional Emacs support, you should prepend "use emacs &&"
+# Again, with optional Emacs support, you should prepend "use emacs &&"
# to above calls of elisp-site-regen().
-# Don't use "has_version virtual/emacs"! When unmerging the state of
-# the emacs USE flag is taken from the package database and not from the
-# environment, so it is no problem when you unset USE=emacs between
-# merge and unmerge of a package.
+
+case ${EAPI:-0} in
+ 4|5|6) inherit eapi7-ver ;;
+ 7) ;;
+ *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
# @ECLASS-VARIABLE: SITELISP
# @DESCRIPTION:
@@ -182,6 +200,17 @@ EMACSFLAGS="-batch -q --no-site-file"
# Emacs flags used for byte-compilation in elisp-compile().
BYTECOMPFLAGS="-L ."
+# @ECLASS-VARIABLE: NEED_EMACS
+# @DESCRIPTION:
+# The minimum Emacs version required for the package.
+: ${NEED_EMACS:=23.1}
+
+# @ECLASS-VARIABLE: _ELISP_EMACS_VERSION
+# @INTERNAL
+# @DESCRIPTION:
+# Cached value of Emacs version detected in elisp-check-emacs-version().
+_ELISP_EMACS_VERSION=""
+
# @FUNCTION: elisp-emacs-version
# @RETURN: exit status of Emacs
# @DESCRIPTION:
@@ -212,12 +241,39 @@ elisp-emacs-version() {
echo "${version}"
}
-# @FUNCTION: elisp-need-emacs
-# @USAGE: <version>
-# @RETURN: 0 if true, 1 if false, 2 if trouble
+# @FUNCTION: elisp-check-emacs-version
+# @USAGE: [version]
# @DESCRIPTION:
+# Test if the eselected Emacs version is at least the version of
+# GNU Emacs specified in the NEED_EMACS variable, or die otherwise.
+
+elisp-check-emacs-version() {
+ if [[ -z ${_ELISP_EMACS_VERSION} ]]; then
+ local have_emacs
+ have_emacs=$(elisp-emacs-version) \
+ || die "Could not determine Emacs version"
+ elog "Emacs version: ${have_emacs}"
+ if [[ ${have_emacs} =~ XEmacs|Lucid ]]; then
+ die "XEmacs detected. This package needs GNU Emacs."
+ fi
+ # GNU Emacs versions have only numeric components.
+ if ! [[ ${have_emacs} =~ ^[0-9]+(\.[0-9]+)*$ ]]; then
+ die "Malformed version string: ${have_emacs}"
+ fi
+ _ELISP_EMACS_VERSION=${have_emacs}
+ fi
+
+ if ! ver_test "${_ELISP_EMACS_VERSION}" -ge "${NEED_EMACS}"; then
+ eerror "This package needs at least Emacs ${NEED_EMACS}."
+ eerror "Use \"eselect emacs\" to select the active version."
+ die "Emacs version too low"
+ fi
+}
+
# Test if the eselected Emacs version is at least the major version
# of GNU Emacs specified as argument.
+# Return 0 if true, 1 if false, 2 if trouble.
+# Deprecated, use elisp-check-emacs-version instead.
elisp-need-emacs() {
local need_emacs=$1 have_emacs
@@ -249,6 +305,8 @@ elisp-need-emacs() {
# in case they require or load one another.
elisp-compile() {
+ elisp-check-emacs-version
+
ebegin "Compiling GNU Emacs Elisp files"
${EMACS} ${EMACSFLAGS} ${BYTECOMPFLAGS} -f batch-byte-compile "$@"
eend $? "elisp-compile: batch-byte-compile failed" || die
@@ -262,6 +320,8 @@ elisp-compile() {
elisp-make-autoload-file() {
local f="${1:-${PN}-autoloads.el}" null="" page=$'\f'
shift
+ elisp-check-emacs-version
+
ebegin "Generating autoload file for GNU Emacs"
cat >"${f}" <<-EOF
diff --git a/eclass/elisp.eclass b/eclass/elisp.eclass
index bcd80a9..a411f60 100644
--- a/eclass/elisp.eclass
+++ b/eclass/elisp.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 2002-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: elisp.eclass
@@ -30,8 +30,8 @@
# @DEFAULT_UNSET
# @DESCRIPTION:
# If you need anything different from Emacs 23, use the NEED_EMACS
-# variable before inheriting elisp.eclass. Set it to the major version
-# your package uses and the dependency will be adjusted.
+# variable before inheriting elisp.eclass. Set it to the version your
+# package uses and the dependency will be adjusted.
# @ECLASS-VARIABLE: ELISP_PATCHES
# @DEFAULT_UNSET
@@ -70,24 +70,20 @@ esac
EXPORT_FUNCTIONS src_{unpack,prepare,configure,compile,install} \
pkg_{setup,postinst,postrm}
-RDEPEND=">=virtual/emacs-${NEED_EMACS:-23}"
+RDEPEND=">=app-editors/emacs-${NEED_EMACS}:*"
case ${EAPI} in
- 4|5|6) DEPEND="${RDEPEND}" ;;
+ 4) RDEPEND="${RDEPEND%:*}"; DEPEND="${RDEPEND}" ;;
+ 5|6) DEPEND="${RDEPEND}" ;;
*) BDEPEND="${RDEPEND}" ;;
esac
# @FUNCTION: elisp_pkg_setup
# @DESCRIPTION:
-# Test if the eselected Emacs version is sufficient to fulfil the major
+# Test if the eselected Emacs version is sufficient to fulfil the
# version requirement of the NEED_EMACS variable.
elisp_pkg_setup() {
- elisp-need-emacs "${NEED_EMACS:-23}"
- case $? in
- 0) ;;
- 1) die "Emacs version too low" ;;
- *) die "Could not determine Emacs version" ;;
- esac
+ elisp-check-emacs-version
}
# @FUNCTION: elisp_src_unpack
next reply other threads:[~2019-12-21 18:30 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-21 18:30 Ulrich Müller [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-09-02 15:31 [gentoo-commits] repo/proj/emacs:master commit in: eclass/ Ulrich Müller
2024-09-02 15:18 Ulrich Müller
2024-09-02 15:18 Ulrich Müller
2023-10-22 10:01 Ulrich Müller
2023-10-20 12:18 Ulrich Müller
2022-10-20 8:05 Ulrich Müller
2022-10-20 8:05 Ulrich Müller
2022-04-03 18:29 Ulrich Müller
2022-04-03 18:02 Ulrich Müller
2022-03-24 6:44 Ulrich Müller
2021-07-28 7:53 Ulrich Müller
2021-04-20 18:13 Ulrich Müller
2021-04-13 7:43 Ulrich Müller
2021-04-13 7:27 Ulrich Müller
2021-04-13 7:15 Ulrich Müller
2021-04-13 7:15 Ulrich Müller
2021-04-13 7:12 Ulrich Müller
2021-04-13 7:12 Ulrich Müller
2021-04-12 19:09 Ulrich Müller
2021-04-12 19:09 Ulrich Müller
2021-03-22 9:00 Ulrich Müller
2020-09-25 17:58 Ulrich Müller
2020-08-04 14:37 Ulrich Müller
2020-02-22 11:42 Ulrich Müller
2019-12-22 12:34 Ulrich Müller
2019-12-21 18:54 Ulrich Müller
2019-09-09 8:25 Ulrich Müller
2019-08-17 22:08 Ulrich Müller
2018-06-01 18:07 Ulrich Müller
2018-06-01 18:07 Ulrich Müller
2018-02-22 13:25 Ulrich Müller
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=1576952767.6da4969af2e59af57c07dc42745eeb9460e0d34f.ulm@gentoo \
--to=ulm@gentoo.org \
--cc=gentoo-commits@lists.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