Gentoo Archives: gentoo-commits

From: Mikle Kolyada <zlogene@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Sun, 09 Feb 2020 10:25:24
Message-Id: 1581243916.595611085bc532afb9f31fa23cee734bc37d21a4.zlogene@gentoo
1 commit: 595611085bc532afb9f31fa23cee734bc37d21a4
2 Author: Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jan 20 19:18:58 2020 +0000
4 Commit: Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
5 CommitDate: Sun Feb 9 10:25:16 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=59561108
7
8 latex-package: kill POSIX and old EAPI
9
10 Reviewed-by: David Saifert <soap <AT> gentoo.org>
11 Reviewed-by: Michał Górny <mgorny <AT> gentoo.org>
12 Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>
13
14 eclass/latex-package.eclass | 136 +++++++++++++++++++++-----------------------
15 1 file changed, 64 insertions(+), 72 deletions(-)
16
17 diff --git a/eclass/latex-package.eclass b/eclass/latex-package.eclass
18 index 1a684ef00a6..e24fd1875f4 100644
19 --- a/eclass/latex-package.eclass
20 +++ b/eclass/latex-package.eclass
21 @@ -1,4 +1,4 @@
22 -# Copyright 1999-2018 Gentoo Foundation
23 +# Copyright 1999-2020 Gentoo Authors
24 # Distributed under the terms of the GNU General Public License v2
25
26 # @ECLASS: latex-package.eclass
27 @@ -7,7 +7,7 @@
28 # @AUTHOR:
29 # Matthew Turk <satai@g.o>
30 # Martin Ehmsen <ehmsen@g.o>
31 -# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
32 +# @SUPPORTED_EAPIS: 7
33 # @BLURB: An eclass for easy installation of LaTeX packages
34 # @DESCRIPTION:
35 # This eClass is designed to be easy to use and implement. The vast majority of
36 @@ -50,21 +50,21 @@
37 # signatures EVERY TIME. For this reason, if you are grabbing from the CTAN,
38 # you must either grab each file individually, or find a place to mirror an
39 # archive of them. (iBiblio)
40 -#
41 -# It inherits base and eutils in EAPI 5 and earlier.
42
43 -case ${EAPI:-0} in
44 - 0|1|2|3|4|5) inherit base eutils ;;
45 -esac
46 +if [[ -z ${_LATEX_PACKAGE_ECLASS} ]]; then
47 +_LATEX_PACKAGE_ECLASS=1
48
49 RDEPEND="virtual/latex-base"
50 DEPEND="${RDEPEND}
51 >=sys-apps/texinfo-4.2-r5"
52 +
53 case ${EAPI:-0} in
54 - 0|1|2|3|4|5|6) ;;
55 - 7) BDEPEND="${DEPEND}"; DEPEND="" ;;
56 - *) die "${ECLASS}: Unknown EAPI ${EAPI}" ;;
57 + [0-6])
58 + die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" ;;
59 + 7) ;;
60 + *) die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" ;;
61 esac
62 +
63 HOMEPAGE="http://www.tug.org/"
64 TEXMF="/usr/share/texmf-site"
65
66 @@ -81,14 +81,6 @@ SUPPLIER="misc"
67 # must be set after inherit, as it gets automatically cleared otherwise.
68 LATEX_DOC_ARGUMENTS=""
69
70 -# Kept for backwards compatibility
71 -latex-package_has_tetex_3() {
72 - case ${EAPI:-0} in
73 - 0|1|2|3|4|5) return 0 ;;
74 - *) die "${FUNCNAME} no longer supported in EAPI ${EAPI}" ;;
75 - esac
76 -}
77 -
78 # @FUNCTION: latex-package_src_doinstall
79 # @USAGE: [ module ]
80 # @DESCRIPTION:
81 @@ -105,93 +97,94 @@ latex-package_src_doinstall() {
82
83 # This actually follows the directions for a "single-user" system
84 # at http://www.ctan.org/installationadvice/ modified for gentoo.
85 - [ -z "$1" ] && latex-package_src_install all
86 + [[ -z ${1} ]] && latex-package_src_install all
87
88 - while [ "$1" ]; do
89 - case $1 in
90 + while [[ ${1} ]]; do
91 + case ${1} in
92 "sh")
93 - for i in `find . -maxdepth 1 -type f -name "*.${1}"`
94 - do
95 - dobin $i || die "dobin $i failed"
96 - done
97 + while read -r -d '' i; do
98 + dobin ${i}
99 + done < <(find -maxdepth 1 -type f -name "*.${1}")
100 ;;
101 +
102 "sty" | "cls" | "fd" | "clo" | "def" | "cfg")
103 - for i in `find . -maxdepth 1 -type f -name "*.${1}"`
104 - do
105 + while read -r -d '' i; do
106 insinto ${TEXMF}/tex/latex/${PN}
107 - doins $i || die "doins $i failed"
108 - done
109 + doins ${i}
110 + done < <(find -maxdepth 1 -type f -name "*.${1}")
111 ;;
112 +
113 "dvi" | "ps" | "pdf")
114 - for i in `find . -maxdepth 1 -type f -name "*.${1}"`
115 - do
116 + while read -r -d '' i; do
117 insinto /usr/share/doc/${PF}
118 - doins $i || die "doins $i failed"
119 + doins ${i}
120 dosym /usr/share/doc/${PF}/$(basename ${i}) ${TEXMF}/doc/latex/${PN}/${i}
121 - case "${EAPI:-0}" in
122 - 0|1|2|3) ;;
123 - *)
124 - # prevent compression of symlink target
125 - docompress -x /usr/share/doc/${PF}/$(basename ${i})
126 - ;;
127 - esac
128 - done
129 + docompress -x /usr/share/doc/${PF}/$(basename ${i})
130 + done < <(find -maxdepth 1 -type f -name "*.${1}")
131 ;;
132 +
133 "tex" | "dtx")
134 if ! in_iuse doc || use doc ; then
135 - for i in `find . -maxdepth 1 -type f -name "*.${1}"`
136 - do
137 - [ -n "${LATEX_PACKAGE_SKIP}" ] && has ${i##*/} ${LATEX_PACKAGE_SKIP} && continue
138 - einfo "Making documentation: $i"
139 - if pdflatex ${LATEX_DOC_ARGUMENTS} --halt-on-error --interaction=nonstopmode $i ; then
140 - pdflatex ${LATEX_DOC_ARGUMENTS} --halt-on-error --interaction=nonstopmode $i || die
141 + while read -r -d '' i; do
142 + [[ -n ${LATEX_PACKAGE_SKIP} ]] && \
143 + has ${i##*/} ${LATEX_PACKAGE_SKIP} && \
144 + continue
145 +
146 + einfo "Making documentation: ${i}"
147 + # some macros need compiler called twice, do it here.
148 + set -- pdflatex ${LATEX_DOC_ARGUMENTS} --halt-on-error --interaction=nonstopmode ${i}
149 + if "${@}"; then
150 + "${@}"
151 else
152 einfo "pdflatex failed, trying texi2dvi"
153 - texi2dvi -q -c --language=latex $i || die
154 + texi2dvi -q -c --language=latex ${i} || die
155 fi
156 - done
157 + done < <(find -maxdepth 1 -type f -name "*.${1}")
158 fi
159 ;;
160 +
161 "tfm" | "vf" | "afm")
162 - for i in `find . -maxdepth 1 -type f -name "*.${1}"`
163 - do
164 + while read -r -d '' i; do
165 insinto ${TEXMF}/fonts/${1}/${SUPPLIER}/${PN}
166 - doins $i || die "doins $i failed"
167 - done
168 + doins ${i}
169 + done < <(find -maxdepth 1 -type f -name "*.${1}")
170 ;;
171 +
172 "pfb")
173 - for i in `find . -maxdepth 1 -type f -name "*.pfb"`
174 - do
175 + while read -r -d '' i; do
176 insinto ${TEXMF}/fonts/type1/${SUPPLIER}/${PN}
177 - doins $i || die "doins $i failed"
178 - done
179 + doins ${i}
180 + done < <(find -maxdepth 1 -type f -name "*.pfb")
181 ;;
182 "ttf")
183 - for i in `find . -maxdepth 1 -type f -name "*.ttf"`
184 - do
185 + while read -r -d '' i; do
186 insinto ${TEXMF}/fonts/truetype/${SUPPLIER}/${PN}
187 - doins $i || die "doins $i failed"
188 - done
189 + doins ${i}
190 + done < <(find -maxdepth 1 -type f -name "*.ttf")
191 ;;
192 "bst")
193 - for i in `find . -maxdepth 1 -type f -name "*.bst"`
194 - do
195 + while read -r -d '' i; do
196 insinto ${TEXMF}/bibtex/bst/${PN}
197 - doins $i || die "doins $i failed"
198 - done
199 + doins ${i}
200 + done < <(find -maxdepth 1 -type f -name "*.bst")
201 ;;
202 +
203 "styles")
204 latex-package_src_doinstall sty cls fd clo def cfg bst
205 ;;
206 +
207 "doc")
208 latex-package_src_doinstall tex dtx dvi ps pdf
209 ;;
210 +
211 "fonts")
212 latex-package_src_doinstall tfm vf afm pfb ttf
213 ;;
214 +
215 "bin")
216 latex-package_src_doinstall sh
217 ;;
218 +
219 "all")
220 latex-package_src_doinstall styles fonts bin doc
221 ;;
222 @@ -206,11 +199,10 @@ latex-package_src_doinstall() {
223 # relevant files that will be installed
224 latex-package_src_compile() {
225 debug-print function $FUNCNAME $*
226 - for i in `find \`pwd\` -maxdepth 1 -type f -name "*.ins"`
227 - do
228 - einfo "Extracting from $i"
229 - latex --halt-on-error --interaction=nonstopmode $i || die
230 - done
231 + while read -r -d '' i; do
232 + einfo "Extracting from ${i}"
233 + latex --halt-on-error --interaction=nonstopmode ${i} || die
234 + done < <(find -maxdepth 1 -type f -name "*.ins")
235 }
236
237 # @FUNCTION: latex-package_src_install
238 @@ -219,9 +211,7 @@ latex-package_src_compile() {
239 latex-package_src_install() {
240 debug-print function $FUNCNAME $*
241 latex-package_src_doinstall all
242 - if [ -n "${DOCS}" ] ; then
243 - dodoc ${DOCS}
244 - fi
245 + einstalldocs
246 }
247
248 # @FUNCTION: latex-package_pkg_postinst
249 @@ -251,3 +241,5 @@ latex-package_rehash() {
250 }
251
252 EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm
253 +
254 +fi