1 |
Signed-off-by: David Seifert <soap@g.o> |
2 |
--- |
3 |
eclass/perl-module.eclass | 209 ++++++++++---------------------------- |
4 |
1 file changed, 56 insertions(+), 153 deletions(-) |
5 |
|
6 |
diff --git a/eclass/perl-module.eclass b/eclass/perl-module.eclass |
7 |
index 273cc2bc805..f243be201ce 100644 |
8 |
--- a/eclass/perl-module.eclass |
9 |
+++ b/eclass/perl-module.eclass |
10 |
@@ -1,4 +1,4 @@ |
11 |
-# Copyright 1999-2021 Gentoo Authors |
12 |
+# Copyright 1999-2022 Gentoo Authors |
13 |
# Distributed under the terms of the GNU General Public License v2 |
14 |
|
15 |
# @ECLASS: perl-module.eclass |
16 |
@@ -7,7 +7,7 @@ |
17 |
# @AUTHOR: |
18 |
# Seemant Kulleen <seemant@g.o> |
19 |
# Andreas K. Hüttel <dilfridge@g.o> |
20 |
-# @SUPPORTED_EAPIS: 5 6 7 8 |
21 |
+# @SUPPORTED_EAPIS: 6 7 8 |
22 |
# @PROVIDES: perl-functions |
23 |
# @BLURB: eclass for installing Perl module distributions |
24 |
# @DESCRIPTION: |
25 |
@@ -19,11 +19,7 @@ |
26 |
# ExtUtils::MakeMaker or Module::Build), we recommend to use perl-functions.eclass |
27 |
# instead. |
28 |
|
29 |
-case ${EAPI:-0} in |
30 |
- 5) |
31 |
- inherit eutils multiprocessing unpacker perl-functions |
32 |
- PERL_EXPF="src_unpack src_prepare src_configure src_compile src_test src_install" |
33 |
- ;; |
34 |
+case ${EAPI} in |
35 |
6|7) |
36 |
inherit multiprocessing perl-functions |
37 |
PERL_EXPF="src_prepare src_configure src_compile src_test src_install" |
38 |
@@ -33,7 +29,7 @@ case ${EAPI:-0} in |
39 |
PERL_EXPF="src_prepare src_configure src_compile src_test src_install" |
40 |
;; |
41 |
*) |
42 |
- die "EAPI=${EAPI} is not supported by perl-module.eclass" |
43 |
+ die "${ECLASS}: EAPI ${EAPI:-0} not supported" |
44 |
;; |
45 |
esac |
46 |
|
47 |
@@ -48,37 +44,7 @@ esac |
48 |
# a use-conditional build time dependency on virtual/perl-Test-Simple, and |
49 |
# the required RESTRICT setting. |
50 |
|
51 |
-case ${EAPI:-0} in |
52 |
- 5) |
53 |
- [[ ${CATEGORY} == perl-core ]] && \ |
54 |
- PERL_EXPF+=" pkg_postinst pkg_postrm" |
55 |
- |
56 |
- case "${GENTOO_DEPEND_ON_PERL:-yes}" in |
57 |
- yes) |
58 |
- case "${GENTOO_DEPEND_ON_PERL_SUBSLOT:-yes}" in |
59 |
- yes) |
60 |
- DEPEND="dev-lang/perl:=[-build(-)]" |
61 |
- ;; |
62 |
- *) |
63 |
- DEPEND="dev-lang/perl[-build(-)]" |
64 |
- ;; |
65 |
- esac |
66 |
- RDEPEND="${DEPEND}" |
67 |
- ;; |
68 |
- esac |
69 |
- |
70 |
- case "${PERL_EXPORT_PHASE_FUNCTIONS:-yes}" in |
71 |
- yes) |
72 |
- EXPORT_FUNCTIONS ${PERL_EXPF} |
73 |
- ;; |
74 |
- no) |
75 |
- debug-print "PERL_EXPORT_PHASE_FUNCTIONS=no" |
76 |
- ;; |
77 |
- *) |
78 |
- die "PERL_EXPORT_PHASE_FUNCTIONS=${PERL_EXPORT_PHASE_FUNCTIONS} is not supported by perl-module.eclass" |
79 |
- ;; |
80 |
- esac |
81 |
- ;; |
82 |
+case ${EAPI} in |
83 |
6) |
84 |
[[ ${CATEGORY} == perl-core ]] && \ |
85 |
PERL_EXPF+=" pkg_postinst pkg_postrm" |
86 |
@@ -170,46 +136,43 @@ LICENSE="${LICENSE:-|| ( Artistic GPL-1+ )}" |
87 |
# @ECLASS_VARIABLE: DIST_NAME |
88 |
# @DEFAULT_UNSET |
89 |
# @DESCRIPTION: |
90 |
-# (EAPI=6 and later) This variable provides a way to override PN for the calculation of S, |
91 |
+# This variable provides a way to override PN for the calculation of S, |
92 |
# SRC_URI, and HOMEPAGE. If unset, defaults to PN. |
93 |
|
94 |
# @ECLASS_VARIABLE: DIST_VERSION |
95 |
# @DEFAULT_UNSET |
96 |
# @DESCRIPTION: |
97 |
-# (EAPI=6 and later) This variable provides a way to override PV for the calculation of S and SRC_URI. |
98 |
+# This variable provides a way to override PV for the calculation of S and SRC_URI. |
99 |
# Use it to provide the non-normalized, upstream version number. If unset, defaults to PV. |
100 |
-# Named MODULE_VERSION in EAPI=5. |
101 |
|
102 |
# @ECLASS_VARIABLE: DIST_A_EXT |
103 |
# @DEFAULT_UNSET |
104 |
# @DESCRIPTION: |
105 |
-# (EAPI=6 and later) This variable provides a way to override the distfile extension for the calculation of |
106 |
-# SRC_URI. If unset, defaults to tar.gz. Named MODULE_A_EXT in EAPI=5. |
107 |
+# This variable provides a way to override the distfile extension for the calculation of |
108 |
+# SRC_URI. If unset, defaults to tar.gz. |
109 |
|
110 |
# @ECLASS_VARIABLE: DIST_A |
111 |
# @DEFAULT_UNSET |
112 |
# @DESCRIPTION: |
113 |
-# (EAPI=6 and later) This variable provides a way to override the distfile name for the calculation of |
114 |
-# SRC_URI. If unset, defaults to ${DIST_NAME}-${DIST_VERSION}.${DIST_A_EXT} Named MODULE_A in EAPI=5. |
115 |
+# This variable provides a way to override the distfile name for the calculation of |
116 |
+# SRC_URI. If unset, defaults to ${DIST_NAME}-${DIST_VERSION}.${DIST_A_EXT}. |
117 |
|
118 |
# @ECLASS_VARIABLE: DIST_AUTHOR |
119 |
# @DEFAULT_UNSET |
120 |
# @DESCRIPTION: |
121 |
-# (EAPI=6 and later) This variable sets the module author name for the calculation of |
122 |
-# SRC_URI. Named MODULE_AUTHOR in EAPI=5. |
123 |
+# This variable sets the module author name for the calculation of SRC_URI. |
124 |
|
125 |
# @ECLASS_VARIABLE: DIST_SECTION |
126 |
# @DEFAULT_UNSET |
127 |
# @DESCRIPTION: |
128 |
-# (EAPI=6 and later) This variable sets the module section for the calculation of |
129 |
+# This variable sets the module section for the calculation of |
130 |
# SRC_URI. Only required in rare cases for very special snowflakes. |
131 |
-# Named MODULE_SECTION in EAPI=5. |
132 |
|
133 |
# @ECLASS_VARIABLE: DIST_EXAMPLES |
134 |
# @PRE_INHERIT |
135 |
# @DEFAULT_UNSET |
136 |
# @DESCRIPTION: |
137 |
-# (EAPI=6 and later) This Bash array allows passing a list of example files to be installed |
138 |
+# This Bash array allows passing a list of example files to be installed |
139 |
# in /usr/share/doc/${PF}/examples. If set before inherit, automatically adds |
140 |
# a use-flag examples, if not you'll have to add the useflag in your ebuild. |
141 |
# Examples are installed only if the useflag examples exists and is activated. |
142 |
@@ -233,53 +196,24 @@ if [[ $(declare -p DIST_MAKE 2>&-) != "declare -a DIST_MAKE="* ]]; then |
143 |
DIST_MAKE=( OPTIMIZE="${CFLAGS}" ) |
144 |
fi |
145 |
|
146 |
+DIST_NAME=${DIST_NAME:-${PN}} |
147 |
+DIST_P=${DIST_NAME}-${DIST_VERSION:-${PV}} |
148 |
+S=${WORKDIR}/${DIST_P} |
149 |
|
150 |
-if [[ ${EAPI:-0} == 5 ]]; then |
151 |
- if [[ -n ${MY_PN} || -n ${MY_PV} || -n ${MODULE_VERSION} ]] ; then |
152 |
- : ${MY_P:=${MY_PN:-${PN}}-${MY_PV:-${MODULE_VERSION:-${PV}}}} |
153 |
- S=${MY_S:-${WORKDIR}/${MY_P}} |
154 |
- fi |
155 |
- MODULE_NAME=${MY_PN:-${PN}} |
156 |
- MODULE_P=${MY_P:-${P}} |
157 |
- |
158 |
- [[ -z "${SRC_URI}" && -z "${MODULE_A}" ]] && \ |
159 |
- MODULE_A="${MODULE_P}.${MODULE_A_EXT:-tar.gz}" |
160 |
- [[ -z "${SRC_URI}" && -n "${MODULE_AUTHOR}" ]] && \ |
161 |
- SRC_URI="mirror://cpan/authors/id/${MODULE_AUTHOR:0:1}/${MODULE_AUTHOR:0:2}/${MODULE_AUTHOR}/${MODULE_SECTION:+${MODULE_SECTION}/}${MODULE_A}" |
162 |
- [[ -z "${HOMEPAGE}" ]] && \ |
163 |
- HOMEPAGE="https://metacpan.org/release/${MODULE_NAME}" |
164 |
- |
165 |
- SRC_TEST="skip" |
166 |
-else |
167 |
- DIST_NAME=${DIST_NAME:-${PN}} |
168 |
- DIST_P=${DIST_NAME}-${DIST_VERSION:-${PV}} |
169 |
- S=${WORKDIR}/${DIST_P} |
170 |
- |
171 |
- [[ -z "${SRC_URI}" && -z "${DIST_A}" ]] && \ |
172 |
- DIST_A="${DIST_P}.${DIST_A_EXT:-tar.gz}" |
173 |
- [[ -z "${SRC_URI}" && -n "${DIST_AUTHOR}" ]] && \ |
174 |
- SRC_URI="mirror://cpan/authors/id/${DIST_AUTHOR:0:1}/${DIST_AUTHOR:0:2}/${DIST_AUTHOR}/${DIST_SECTION:+${DIST_SECTION}/}${DIST_A}" |
175 |
- [[ -z "${HOMEPAGE}" ]] && \ |
176 |
- HOMEPAGE="https://metacpan.org/release/${DIST_NAME}" |
177 |
- |
178 |
- [[ -z "${DIST_EXAMPLES}" ]] || IUSE+=" examples" |
179 |
-fi |
180 |
+[[ -z "${SRC_URI}" && -z "${DIST_A}" ]] && |
181 |
+ DIST_A="${DIST_P}.${DIST_A_EXT:-tar.gz}" |
182 |
+[[ -z "${SRC_URI}" && -n "${DIST_AUTHOR}" ]] && |
183 |
+ SRC_URI="mirror://cpan/authors/id/${DIST_AUTHOR:0:1}/${DIST_AUTHOR:0:2}/${DIST_AUTHOR}/${DIST_SECTION:+${DIST_SECTION}/}${DIST_A}" |
184 |
+[[ -z "${HOMEPAGE}" ]] && |
185 |
+ HOMEPAGE="https://metacpan.org/release/${DIST_NAME}" |
186 |
+ |
187 |
+[[ -z "${DIST_EXAMPLES}" ]] || IUSE+=" examples" |
188 |
|
189 |
SRC_PREP="no" |
190 |
PREFER_BUILDPL="yes" |
191 |
|
192 |
pm_echovar="" |
193 |
|
194 |
-# @FUNCTION: perl-module_src_unpack |
195 |
-# @DESCRIPTION: |
196 |
-# Unpack the ebuild tarball(s). |
197 |
-# This function is to be called during the ebuild src_unpack() phase. |
198 |
-perl-module_src_unpack() { |
199 |
- debug-print-function $FUNCNAME "$@" |
200 |
- [[ ${EAPI:-0} == 5 ]] || die "perl-module_src_unpack is banned in EAPI=6 or later" |
201 |
- unpacker_src_unpack |
202 |
-} |
203 |
- |
204 |
# @FUNCTION: perl-module_src_prepare |
205 |
# @DESCRIPTION: |
206 |
# Get the ebuild sources ready. |
207 |
@@ -287,13 +221,7 @@ perl-module_src_unpack() { |
208 |
perl-module_src_prepare() { |
209 |
debug-print-function $FUNCNAME "$@" |
210 |
|
211 |
- if [[ ${EAPI:-0} == 5 ]] ; then |
212 |
- [[ ${PATCHES[@]} ]] && epatch "${PATCHES[@]}" |
213 |
- debug-print "$FUNCNAME: applying user patches" |
214 |
- epatch_user |
215 |
- else |
216 |
- default |
217 |
- fi |
218 |
+ default |
219 |
|
220 |
if [[ ${PERL_RM_FILES[@]} ]]; then |
221 |
debug-print "$FUNCNAME: stripping unneeded files" |
222 |
@@ -309,9 +237,6 @@ perl-module_src_prepare() { |
223 |
perl-module_src_configure() { |
224 |
debug-print-function $FUNCNAME "$@" |
225 |
|
226 |
- if [[ ${EAPI:-0} == 5 && ${SRC_PREP} == yes ]]; then |
227 |
- return 0 |
228 |
- fi |
229 |
SRC_PREP="yes" |
230 |
|
231 |
perl_check_env |
232 |
@@ -329,8 +254,8 @@ perl-module_src_configure() { |
233 |
fi |
234 |
|
235 |
if [[ ( ${PREFER_BUILDPL} == yes || ! -f Makefile.PL ) && -f Build.PL ]] ; then |
236 |
- case ${EAPI:-0} in |
237 |
- 5|6) |
238 |
+ case ${EAPI} in |
239 |
+ 6) |
240 |
if grep -q '\(use\|require\)\s*Module::Build::Tiny' Build.PL ; then |
241 |
einfo "Using Module::Build::Tiny" |
242 |
if [[ ${DEPEND} != *dev-perl/Module-Build-Tiny* && ${PN} != Module-Build-Tiny ]]; then |
243 |
@@ -397,7 +322,7 @@ perl-module_src_compile() { |
244 |
perl_set_version |
245 |
|
246 |
case ${EAPI} in |
247 |
- 5|6|7) |
248 |
+ 6|7) |
249 |
if [[ $(declare -p mymake 2>&-) != "declare -a mymake="* ]]; then |
250 |
local mymake_local=(${mymake}) |
251 |
else |
252 |
@@ -426,11 +351,9 @@ perl-module_src_compile() { |
253 |
# @ECLASS_VARIABLE: DIST_TEST |
254 |
# @DEFAULT_UNSET |
255 |
# @DESCRIPTION: |
256 |
-# (EAPI=6 and later) Variable that controls if tests are run in the test phase |
257 |
+# Variable that controls if tests are run in the test phase |
258 |
# at all, and if yes under which conditions. If unset, defaults to "do parallel" |
259 |
# If neither "do" nor "parallel" is recognized, tests are skipped. |
260 |
-# (In EAPI=5 the variable is called SRC_TEST, defaults to "skip", and |
261 |
-# recognizes fewer options.) |
262 |
# The following space-separated keywords are recognized: |
263 |
# do : run tests |
264 |
# parallel : run tests in parallel |
265 |
@@ -441,7 +364,7 @@ perl-module_src_compile() { |
266 |
# @USER_VARIABLE |
267 |
# @DEFAULT_UNSET |
268 |
# @DESCRIPTION: |
269 |
-# (EAPI=6 and later) Variable that controls if tests are run in the test phase |
270 |
+# Variable that controls if tests are run in the test phase |
271 |
# at all, and if yes under which conditions. It is intended for use in |
272 |
# make.conf or the environment by ebuild authors during testing, and |
273 |
# accepts the same values as DIST_TEST. If set, it overrides DIST_TEST |
274 |
@@ -456,46 +379,32 @@ perl-module_src_test() { |
275 |
local my_test_control |
276 |
local my_test_verbose |
277 |
|
278 |
- if [[ ${EAPI} == 5 ]] ; then |
279 |
- my_test_control=${SRC_TEST} |
280 |
- my_test_verbose=${TEST_VERBOSE:-0} |
281 |
- if has 'do' ${my_test_control} || has 'parallel' ${my_test_control} ; then |
282 |
- if has "${my_test_verbose}" 0 && has 'parallel' ${my_test_control} ; then |
283 |
- export HARNESS_OPTIONS=j$(makeopts_jobs) |
284 |
- einfo "Test::Harness Jobs=$(makeopts_jobs)" |
285 |
- fi |
286 |
- else |
287 |
- einfo Skipping tests due to SRC_TEST=${SRC_TEST} |
288 |
- return 0 |
289 |
- fi |
290 |
- else |
291 |
- [[ -n "${DIST_TEST_OVERRIDE}" ]] && ewarn DIST_TEST_OVERRIDE is set to ${DIST_TEST_OVERRIDE} |
292 |
- my_test_control=${DIST_TEST_OVERRIDE:-${DIST_TEST:-do parallel}} |
293 |
+ [[ -n "${DIST_TEST_OVERRIDE}" ]] && ewarn "DIST_TEST_OVERRIDE is set to ${DIST_TEST_OVERRIDE}" |
294 |
+ my_test_control=${DIST_TEST_OVERRIDE:-${DIST_TEST:-do parallel}} |
295 |
|
296 |
- if ! has 'do' ${my_test_control} && ! has 'parallel' ${my_test_control} ; then |
297 |
- einfo Skipping tests due to DIST_TEST=${my_test_control} |
298 |
- return 0 |
299 |
- fi |
300 |
+ if ! has 'do' ${my_test_control} && ! has 'parallel' ${my_test_control} ; then |
301 |
+ einfo Skipping tests due to DIST_TEST=${my_test_control} |
302 |
+ return 0 |
303 |
+ fi |
304 |
|
305 |
- if has verbose ${my_test_control} ; then |
306 |
- my_test_verbose=1 |
307 |
- else |
308 |
- my_test_verbose=0 |
309 |
- fi |
310 |
+ if has verbose ${my_test_control} ; then |
311 |
+ my_test_verbose=1 |
312 |
+ else |
313 |
+ my_test_verbose=0 |
314 |
+ fi |
315 |
|
316 |
- if has parallel ${my_test_control} ; then |
317 |
- export HARNESS_OPTIONS=j$(makeopts_jobs) |
318 |
- einfo "Test::Harness Jobs=$(makeopts_jobs)" |
319 |
- fi |
320 |
+ if has parallel ${my_test_control} ; then |
321 |
+ export HARNESS_OPTIONS=j$(makeopts_jobs) |
322 |
+ einfo "Test::Harness Jobs=$(makeopts_jobs)" |
323 |
+ fi |
324 |
|
325 |
- # this might sometimes work... |
326 |
- if ! has network ${my_test_control} ; then |
327 |
- export NO_NETWORK_TESTING=1 |
328 |
- fi |
329 |
+ # this might sometimes work... |
330 |
+ if ! has network ${my_test_control} ; then |
331 |
+ export NO_NETWORK_TESTING=1 |
332 |
fi |
333 |
|
334 |
case ${EAPI} in |
335 |
- 5|6|7) |
336 |
+ 6|7) |
337 |
;; |
338 |
*) |
339 |
if has 'tests' ${DIST_WIKI} ; then |
340 |
@@ -546,7 +455,7 @@ perl-module_src_install() { |
341 |
fi |
342 |
|
343 |
case ${EAPI} in |
344 |
- 5|6|7) |
345 |
+ 6|7) |
346 |
;; |
347 |
*) |
348 |
perl_fix_permissions |
349 |
@@ -555,28 +464,22 @@ perl-module_src_install() { |
350 |
|
351 |
perl_delete_module_manpages |
352 |
perl_delete_localpod |
353 |
- if [[ ${EAPI} == 5 ]] ; then |
354 |
- perl_delete_packlist |
355 |
- else |
356 |
- perl_fix_packlist |
357 |
- perl_delete_emptybsdir |
358 |
- fi |
359 |
+ perl_fix_packlist |
360 |
+ perl_delete_emptybsdir |
361 |
perl_remove_temppath |
362 |
|
363 |
for f in Change* CHANGES README* TODO FAQ ${mydoc}; do |
364 |
[[ -s ${f} ]] && dodoc ${f} |
365 |
done |
366 |
|
367 |
- if [[ ${EAPI} != 5 ]] ; then |
368 |
- if in_iuse examples && use examples ; then |
369 |
- [[ ${#DIST_EXAMPLES[@]} -eq 0 ]] || perl_doexamples "${DIST_EXAMPLES[@]}" |
370 |
- fi |
371 |
+ if in_iuse examples && use examples ; then |
372 |
+ [[ ${#DIST_EXAMPLES[@]} -eq 0 ]] || perl_doexamples "${DIST_EXAMPLES[@]}" |
373 |
fi |
374 |
|
375 |
perl_link_duallife_scripts |
376 |
|
377 |
case ${EAPI} in |
378 |
- 5|6|7) |
379 |
+ 6|7) |
380 |
;; |
381 |
*) |
382 |
if has 'features' ${DIST_WIKI} ; then |
383 |
-- |
384 |
2.35.1 |