Gentoo Archives: gentoo-dev

From: dilfridge@g.o
To: gentoo-dev@l.g.o
Cc: "Andreas K. Hüttel" <dilfridge@g.o>
Subject: [gentoo-dev] [PATCH 3/3] perl-module.eclass: Add EAPI=8 support
Date: Sat, 19 Jun 2021 11:03:47
Message-Id: 20210619110152.54307-3-dilfridge@gentoo.org
In Reply to: [gentoo-dev] [PATCH 1/3] readme.gentoo-r1.eclass: works just fine with EAPI=8 by dilfridge@gentoo.org
1 From: Andreas K. Hüttel <dilfridge@g.o>
2
3 New features: DIST_WIKI and DIST_MAKE
4 File permissions are fixed on installation
5
6 Bug: https://bugs.gentoo.org/733020
7 Bug: https://bugs.gentoo.org/554346
8 Bug: https://bugs.gentoo.org/261375
9 Signed-off-by: Andreas K. Hüttel <dilfridge@g.o>
10 ---
11 eclass/perl-module.eclass | 89 +++++++++++++++++++++++++++++++++------
12 1 file changed, 76 insertions(+), 13 deletions(-)
13
14 diff --git a/eclass/perl-module.eclass b/eclass/perl-module.eclass
15 index 3f7e4100db07..6285e9363156 100644
16 --- a/eclass/perl-module.eclass
17 +++ b/eclass/perl-module.eclass
18 @@ -7,7 +7,7 @@
19 # @AUTHOR:
20 # Seemant Kulleen <seemant@g.o>
21 # Andreas K. Hüttel <dilfridge@g.o>
22 -# @SUPPORTED_EAPIS: 5 6 7
23 +# @SUPPORTED_EAPIS: 5 6 7 8
24 # @BLURB: eclass for installing Perl module distributions
25 # @DESCRIPTION:
26 # The perl-module eclass is designed to allow easier installation of Perl
27 @@ -27,6 +27,10 @@ case ${EAPI:-0} in
28 inherit multiprocessing perl-functions
29 PERL_EXPF="src_prepare src_configure src_compile src_test src_install"
30 ;;
31 + 8)
32 + inherit multiprocessing perl-functions readme.gentoo-r1
33 + PERL_EXPF="src_prepare src_configure src_compile src_test src_install"
34 + ;;
35 *)
36 die "EAPI=${EAPI} is not supported by perl-module.eclass"
37 ;;
38 @@ -99,7 +103,7 @@ case ${EAPI:-0} in
39
40 EXPORT_FUNCTIONS ${PERL_EXPF}
41 ;;
42 - 7)
43 + *)
44 [[ ${CATEGORY} == perl-core ]] && \
45 PERL_EXPF+=" pkg_postinst pkg_postrm"
46
47 @@ -126,9 +130,6 @@ case ${EAPI:-0} in
48
49 EXPORT_FUNCTIONS ${PERL_EXPF}
50 ;;
51 - *)
52 - die "EAPI=${EAPI:-0} is not supported by perl-module.eclass"
53 - ;;
54 esac
55
56 LICENSE="${LICENSE:-|| ( Artistic GPL-1+ )}"
57 @@ -180,6 +181,25 @@ LICENSE="${LICENSE:-|| ( Artistic GPL-1+ )}"
58 # a use-flag examples, if not you'll have to add the useflag in your ebuild.
59 # Examples are installed only if the useflag examples exists and is activated.
60
61 +# @ECLASS-VARIABLE: DIST_WIKI
62 +# @DEFAULT_UNSET
63 +# @DESCRIPTION:
64 +# (EAPI=8 and later) This variable can be set to contain space-separated keywords
65 +# corresponding to article sections in a maintenance notes wiki article. If a
66 +# keyword is set, an ebuild phase can output a message and a link to the wiki.
67 +# Current keywords as of EAPI=8 are:
68 +# * features: Notes about additional dependencies for optional features
69 +# * tests: Notes about additional dependencies and preparations needed for testing
70 +
71 +# @ECLASS-VARIABLE: DIST_MAKE
72 +# @DESCRIPTION:
73 +# (EAPI=8 and later) This Bash array contains parameters to the make call
74 +# from ExtUtils::MakeMaker. Replaces mymake in EAPI=7 and earlier.
75 +# Defaults to ( OPTIMIZE="${CFLAGS}" )
76 +if [[ $(declare -p DIST_MAKE 2>&-) != "declare -a DIST_MAKE="* ]]; then
77 + DIST_MAKE=( OPTIMIZE="${CFLAGS}" )
78 +fi
79 +
80
81 if [[ ${EAPI:-0} == 5 ]]; then
82 if [[ -n ${MY_PN} || -n ${MY_PV} || -n ${MODULE_VERSION} ]] ; then
83 @@ -343,11 +363,18 @@ perl-module_src_compile() {
84 debug-print-function $FUNCNAME "$@"
85 perl_set_version
86
87 - if [[ $(declare -p mymake 2>&-) != "declare -a mymake="* ]]; then
88 - local mymake_local=(${mymake})
89 - else
90 - local mymake_local=("${mymake[@]}")
91 - fi
92 + case ${EAPI} in
93 + 5|6|7)
94 + if [[ $(declare -p mymake 2>&-) != "declare -a mymake="* ]]; then
95 + local mymake_local=(${mymake})
96 + else
97 + local mymake_local=("${mymake[@]}")
98 + fi
99 + ;;
100 + *)
101 + local mymake_local=("${DIST_MAKE[@]}")
102 + ;;
103 + esac
104
105 if [[ -f Build ]] ; then
106 ./Build build \
107 @@ -396,7 +423,7 @@ perl-module_src_test() {
108 local my_test_control
109 local my_test_verbose
110
111 - if [[ ${EAPI:-0} == 5 ]] ; then
112 + if [[ ${EAPI} == 5 ]] ; then
113 my_test_control=${SRC_TEST}
114 my_test_verbose=${TEST_VERBOSE:-0}
115 if has 'do' ${my_test_control} || has 'parallel' ${my_test_control} ; then
116 @@ -434,6 +461,18 @@ perl-module_src_test() {
117 fi
118 fi
119
120 + case ${EAPI} in
121 + 5|6|7)
122 + ;;
123 + *)
124 + if has 'tests' ${DIST_WIKI} ; then
125 + ewarn "This package may require additional dependencies and/or preparation steps for"
126 + ewarn "comprehensive testing. For details, see:"
127 + ewarn "$(perl_get_wikiurl_tests)"
128 + fi
129 + ;;
130 + esac
131 +
132 perl_set_version
133 if [[ -f Build ]] ; then
134 ./Build test verbose=${my_test_verbose} || die "test failed"
135 @@ -473,9 +512,17 @@ perl-module_src_install() {
136 || die "emake ${myinst_local[@]} ${mytargets} failed"
137 fi
138
139 + case ${EAPI} in
140 + 5|6|7)
141 + ;;
142 + *)
143 + perl_fix_permissions
144 + ;;
145 + esac
146 +
147 perl_delete_module_manpages
148 perl_delete_localpod
149 - if [[ ${EAPI:-0} == 5 ]] ; then
150 + if [[ ${EAPI} == 5 ]] ; then
151 perl_delete_packlist
152 else
153 perl_fix_packlist
154 @@ -487,13 +534,29 @@ perl-module_src_install() {
155 [[ -s ${f} ]] && dodoc ${f}
156 done
157
158 - if [[ ${EAPI:-0} != 5 ]] ; then
159 + if [[ ${EAPI} != 5 ]] ; then
160 if in_iuse examples && use examples ; then
161 [[ ${#DIST_EXAMPLES[@]} -eq 0 ]] || perl_doexamples "${DIST_EXAMPLES[@]}"
162 fi
163 fi
164
165 perl_link_duallife_scripts
166 +
167 + case ${EAPI} in
168 + 5|6|7)
169 + ;;
170 + *)
171 + if has 'features' ${DIST_WIKI} ; then
172 + DISABLE_AUTOFORMATTING=yes
173 + DOC_CONTENTS="This package may require additional dependencies and/or preparation steps for\n"
174 + DOC_CONTENTS+="some optional features. For details, see\n"
175 + DOC_CONTENTS+="$(perl_get_wikiurl_features)"
176 + einfo
177 + readme.gentoo_create_doc
178 + readme.gentoo_print_elog
179 + fi
180 + ;;
181 + esac
182 }
183
184 # @FUNCTION: perl-module_pkg_postinst
185 --
186 2.31.1