Gentoo Archives: gentoo-dev

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] [PATCH] elisp.eclass: Use EAPI defaults where possible.
Date: Thu, 05 Sep 2019 11:36:40
Message-Id: w6gpnkf3rjp.fsf@kph.uni-mainz.de
1 src_unpack: Call default instead of explicit unpack.
2 src_prepare: Call default, so that the PATCHES variable will be
3 respected in EAPIs 6 and 7.
4 src_install: Call einstalldocs in EAPIs where it is supported.
5
6 Drop unnecessary die statements, because helpers die by themselves
7 in all supported EAPIs.
8
9 Signed-off-by: Ulrich Müller <ulm@g.o>
10 ---
11 eclass/elisp.eclass | 32 ++++++++++++++------------------
12 1 file changed, 14 insertions(+), 18 deletions(-)
13
14 diff --git a/eclass/elisp.eclass b/eclass/elisp.eclass
15 index c885345a7a8..d1b6cf71731 100644
16 --- a/eclass/elisp.eclass
17 +++ b/eclass/elisp.eclass
18 @@ -1,209 +1,205 @@
19 # Copyright 1999-2019 Gentoo Authors
20 # Distributed under the terms of the GNU General Public License v2
21
22 # @ECLASS: elisp.eclass
23 # @MAINTAINER:
24 # Gentoo GNU Emacs project <gnu-emacs@g.o>
25 # @AUTHOR:
26 # Matthew Kennedy <mkennedy@g.o>
27 # Jeremy Maitin-Shepard <jbms@×××××.com>
28 # Christian Faulhammer <fauli@g.o>
29 # Ulrich Müller <ulm@g.o>
30 # @SUPPORTED_EAPIS: 4 5 6 7
31 # @BLURB: Eclass for Emacs Lisp packages
32 # @DESCRIPTION:
33 #
34 # This eclass is designed to install elisp files of Emacs related
35 # packages into the site-lisp directory. The majority of elisp packages
36 # will only need to define the standard ebuild variables (like SRC_URI)
37 # and optionally SITEFILE for successful installation.
38 #
39 # Emacs support for other than pure elisp packages is handled by
40 # elisp-common.eclass where you won't have a dependency on Emacs itself.
41 # All elisp-* functions are documented there.
42 #
43 # If the package's source is a single (in whatever way) compressed elisp
44 # file with the file name ${P}.el, then this eclass will move ${P}.el to
45 # ${PN}.el in src_unpack().
46
47 # @ECLASS-VARIABLE: NEED_EMACS
48 # @DEFAULT_UNSET
49 # @DESCRIPTION:
50 # If you need anything different from Emacs 23, use the NEED_EMACS
51 # variable before inheriting elisp.eclass. Set it to the major version
52 # your package uses and the dependency will be adjusted.
53
54 # @ECLASS-VARIABLE: ELISP_PATCHES
55 # @DEFAULT_UNSET
56 # @DESCRIPTION:
57 # Space separated list of patches to apply after unpacking the sources.
58 # Patch files are searched for in the current working dir, WORKDIR, and
59 -# FILESDIR.
60 +# FILESDIR. This variable is semi-deprecated, preferably use the
61 +# PATCHES array instead if the EAPI supports it.
62
63 # @ECLASS-VARIABLE: ELISP_REMOVE
64 # @DEFAULT_UNSET
65 # @DESCRIPTION:
66 # Space separated list of files to remove after unpacking the sources.
67
68 # @ECLASS-VARIABLE: SITEFILE
69 # @DEFAULT_UNSET
70 # @DESCRIPTION:
71 # Name of package's site-init file. The filename must match the shell
72 # pattern "[1-8][0-9]*-gentoo.el"; numbers below 10 and above 89 are
73 # reserved for internal use. "50${PN}-gentoo.el" is a reasonable choice
74 # in most cases.
75
76 # @ECLASS-VARIABLE: ELISP_TEXINFO
77 # @DEFAULT_UNSET
78 # @DESCRIPTION:
79 # Space separated list of Texinfo sources. Respective GNU Info files
80 # will be generated in src_compile() and installed in src_install().
81
82 -# @ECLASS-VARIABLE: DOCS
83 -# @DEFAULT_UNSET
84 -# @DESCRIPTION:
85 -# DOCS="blah.txt ChangeLog" is automatically used to install the given
86 -# files by dodoc in src_install().
87 -
88 inherit elisp-common
89 case ${EAPI:-0} in
90 4|5) inherit epatch ;;
91 6|7) ;;
92 *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
93 esac
94
95 EXPORT_FUNCTIONS src_{unpack,prepare,configure,compile,install} \
96 pkg_{setup,postinst,postrm}
97
98 RDEPEND=">=virtual/emacs-${NEED_EMACS:-23}"
99 case ${EAPI} in
100 4|5|6) DEPEND="${RDEPEND}" ;;
101 *) BDEPEND="${RDEPEND}" ;;
102 esac
103
104 # @FUNCTION: elisp_pkg_setup
105 # @DESCRIPTION:
106 # Test if the eselected Emacs version is sufficient to fulfil the major
107 # version requirement of the NEED_EMACS variable.
108
109 elisp_pkg_setup() {
110 elisp-need-emacs "${NEED_EMACS:-23}"
111 case $? in
112 0) ;;
113 1) die "Emacs version too low" ;;
114 *) die "Could not determine Emacs version" ;;
115 esac
116 }
117
118 # @FUNCTION: elisp_src_unpack
119 # @DESCRIPTION:
120 # Unpack the sources; also handle the case of a single *.el file in
121 # WORKDIR for packages distributed that way.
122
123 elisp_src_unpack() {
124 - [[ -n ${A} ]] && unpack ${A}
125 + default
126 if [[ -f ${P}.el ]]; then
127 # the "simple elisp" case with a single *.el file in WORKDIR
128 mv ${P}.el ${PN}.el || die
129 [[ -d ${S} ]] || S=${WORKDIR}
130 fi
131 }
132
133 # @FUNCTION: elisp_src_prepare
134 # @DESCRIPTION:
135 # Apply any patches listed in ELISP_PATCHES. Patch files are searched
136 # for in the current working dir, WORKDIR, and FILESDIR.
137
138 elisp_src_prepare() {
139 local patch file
140 for patch in ${ELISP_PATCHES}; do
141 if [[ -f ${patch} ]]; then
142 file="${patch}"
143 elif [[ -f ${WORKDIR}/${patch} ]]; then
144 file="${WORKDIR}/${patch}"
145 elif [[ -f ${FILESDIR}/${patch} ]]; then
146 file="${FILESDIR}/${patch}"
147 else
148 die "Cannot find ${patch}"
149 fi
150 case ${EAPI} in
151 4|5) epatch "${file}" ;;
152 *) eapply "${file}" ;;
153 esac
154 done
155 + if [[ -n ${ELISP_REMOVE} ]]; then
156 + rm ${ELISP_REMOVE} || die
157 + fi
158
159 - # apply any user patches
160 + default
161 + # apply user patches in EAPIs where it isn't done by default
162 case ${EAPI} in
163 4|5) epatch_user ;;
164 - *) eapply_user ;;
165 esac
166 -
167 - if [[ -n ${ELISP_REMOVE} ]]; then
168 - rm ${ELISP_REMOVE} || die
169 - fi
170 }
171
172 # @FUNCTION: elisp_src_configure
173 # @DESCRIPTION:
174 # Do nothing, because Emacs packages seldomly bring a full build system.
175
176 elisp_src_configure() { :; }
177
178 # @FUNCTION: elisp_src_compile
179 # @DESCRIPTION:
180 # Call elisp-compile to byte-compile all Emacs Lisp (*.el) files.
181 # If ELISP_TEXINFO lists any Texinfo sources, call makeinfo to generate
182 # GNU Info files from them.
183
184 elisp_src_compile() {
185 elisp-compile *.el
186 if [[ -n ${ELISP_TEXINFO} ]]; then
187 makeinfo ${ELISP_TEXINFO} || die
188 fi
189 }
190
191 # @FUNCTION: elisp_src_install
192 # @DESCRIPTION:
193 # Call elisp-install to install all Emacs Lisp (*.el and *.elc) files.
194 # If the SITEFILE variable specifies a site-init file, install it with
195 # elisp-site-file-install. Also install any GNU Info files listed in
196 # ELISP_TEXINFO and documentation listed in the DOCS variable.
197
198 elisp_src_install() {
199 elisp-install ${PN} *.el *.elc
200 if [[ -n ${SITEFILE} ]]; then
201 elisp-site-file-install "${FILESDIR}/${SITEFILE}"
202 fi
203 if [[ -n ${ELISP_TEXINFO} ]]; then
204 set -- ${ELISP_TEXINFO}
205 set -- ${@##*/}
206 - doinfo ${@/%.*/.info*} || die
207 + doinfo ${@/%.*/.info*}
208 fi
209 - if [[ -n ${DOCS} ]]; then
210 - dodoc ${DOCS} || die
211 - fi
212 + # install documentation only when explicitly requested
213 + case ${EAPI} in
214 + 4|5) [[ -n ${DOCS} ]] && dodoc ${DOCS} ;;
215 + *) declare -p DOCS &>/dev/null && einstalldocs ;;
216 + esac
217 if declare -f readme.gentoo_create_doc >/dev/null; then
218 readme.gentoo_create_doc
219 fi
220 }
221
222 # @FUNCTION: elisp_pkg_postinst
223 # @DESCRIPTION:
224 # Call elisp-site-regen, in order to collect the site initialisation for
225 # all installed Emacs Lisp packages in the site-gentoo.el file.
226
227 elisp_pkg_postinst() {
228 elisp-site-regen
229 if declare -f readme.gentoo_print_elog >/dev/null; then
230 readme.gentoo_print_elog
231 fi
232 }
233
234 # @FUNCTION: elisp_pkg_postrm
235 # @DESCRIPTION:
236 # Call elisp-site-regen, in order to collect the site initialisation for
237 # all installed Emacs Lisp packages in the site-gentoo.el file.
238
239 elisp_pkg_postrm() {
240 elisp-site-regen
241 }
242 --
243 2.23.0

Attachments

File name MIME type
signature.asc application/pgp-signature