Gentoo Archives: gentoo-commits

From: Kent Fredric <kentnl@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/perl/files/, dev-lang/perl/
Date: Fri, 07 Aug 2020 21:05:09
Message-Id: 1596834266.5986e6616f0f43983f003792cb4a6c043ff6d37d.kentnl@gentoo
1 commit: 5986e6616f0f43983f003792cb4a6c043ff6d37d
2 Author: Kent Fredric <kentnl <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jun 26 08:00:52 2020 +0000
4 Commit: Kent Fredric <kentnl <AT> gentoo <DOT> org>
5 CommitDate: Fri Aug 7 21:04:26 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5986e661
7
8 dev-lang/perl: 5.30.3-r2 rework patching bundle logic
9
10 This change reworks the patching logic entirely to avoid the use of a
11 sequence file, instead, relying on directory sort order and numerically
12 prefixed filenames.
13
14 In addition to this change, work is done on the patchset authoring side
15 to pre-extract important fields like "bugs" and "description" for the
16 patches and puts them in easy to read files, in order to more clearly
17 generate patchlevel_gentoo.h ( seen in Perl -V )
18
19 Perl -V now includes more verbose details, including fully qualified bug
20 URLs.
21
22 Additionally, its more straight forward to add records to the patch
23 bundle within the ebuild, using the new "add_patch" helper, so that even
24 files applied from ${FILESDIR} can be shown in `perl -V`
25
26 Patches are fully re-rolled as git patches against perl v5.30.3
27
28 Sourcing from "mirror://gentoo" is now implicit, as this syntax is
29 discouraged.
30
31 Patch for Net::SNMP removed from bundle as it just now introduces
32 redundant documentation.
33
34 Patch for gentoo-libdirs now bundled, and properly rehashed to avoid
35 failing in various porting tests.
36
37 Package-Manager: Portage-2.3.100, Repoman-2.3.22
38 Signed-off-by: Kent Fredric <kentnl <AT> gentoo.org>
39
40 dev-lang/perl/Manifest | 1 +
41 .../perl/files/perl-5.30.3-gentoo-libdirs.patch | 135 --------------
42 dev-lang/perl/perl-5.30.3-r2.ebuild | 195 ++++++++++++++-------
43 3 files changed, 131 insertions(+), 200 deletions(-)
44
45 diff --git a/dev-lang/perl/Manifest b/dev-lang/perl/Manifest
46 index 0168a19f9ce..863119a0edd 100644
47 --- a/dev-lang/perl/Manifest
48 +++ b/dev-lang/perl/Manifest
49 @@ -1,4 +1,5 @@
50 DIST perl-5.30.0-patches-1.tar.xz 17352 BLAKE2B 67eb1c4ce6ada27e05962d06fa9c5675ca1d22623b5fd172ce8ceaa17f2e51d61f9451955f9f6acf6d97ea7d71c72b583be1378ccbf9174c88580baec2049a48 SHA512 4fe1f2de5e72e56890858148d20b772df63dce34cb3977ec47d8ed5323c4843929130f660f1558c282c97e65efa1c6d2fdacf9e2dcc0ef1d487a0b69dbb5bbb4
51 +DIST perl-5.30.3-patches-1.tar.xz 20292 BLAKE2B 34ca8dbdf08650deaaa59bba634c3a40c6da7d91b282365eec217cc421b17678837b1ae02de5d6b0b632858a0251b796ce28ddbdd7a86aca6697f18a527fcb62 SHA512 ba9aafcaff405c931b61ffc917be8ef71e538fd5277a3bcfafbaffc965b53f9c1811670558a0bc75c538586a30f11aba3ce59bd2214982eaad3b5afa64e67999
52 DIST perl-5.30.3.tar.xz 12375128 BLAKE2B ff0668c896e46ea35a1b8bd4a7d800c8668d6995185cd8c43fca332da2fa63965bb5276b2d5cf9738c0b7fb735140f6e33f1b4582899017903f86753065f417b SHA512 0ea62cf17532ee99217a218c39aa530472857c7a1982494f3a01693683062b4cdebe383a79f7b64452c713337b554ed5e0fd6eda018ea29e83c3538a13c24f3c
53 DIST perl-5.32.0.tar.xz 12717336 BLAKE2B 4abad9f1ddabaad5f2bbfe8ab6d061aeb8c558e458d4bf1bcf737a8ecc1cf20f7dffaddd0bc867578b457787ec284fa81be3fae1edd7f72d58aeec7b5cd744e5 SHA512 1540247415893bbd94dfeede7b4fba6052688dc0bf27ced817f448246fcdc6e9a6486abc34577dec5b00bf02ed607b2d24ccd4977c3b3c51e8e6edfc0b81c760
54 DIST perl-cross-1.3.2.tar.gz 108350 BLAKE2B ddb352fdbec66a04de62425f5cae1aaa3bc7251b9d6f4837b66a0bd79c53c60212fad3997dad4c38055774a2769d45b5b83927bf48b0fb00a130fee429eba702 SHA512 d61d25066a8d87c34aeacc5b9bd86fab964b33c4c65e84a89e4077fe1d8011c0bdf810a304631af44fae32edcffd6c99fc17b0c584ea83d1ce5ce492aaedfea5
55
56 diff --git a/dev-lang/perl/files/perl-5.30.3-gentoo-libdirs.patch b/dev-lang/perl/files/perl-5.30.3-gentoo-libdirs.patch
57 deleted file mode 100644
58 index b9e36223a94..00000000000
59 --- a/dev-lang/perl/files/perl-5.30.3-gentoo-libdirs.patch
60 +++ /dev/null
61 @@ -1,135 +0,0 @@
62 -From 7572be1afb16621a537e9da02f96cf04cb10b655 Mon Sep 17 00:00:00 2001
63 -From: Kent Fredric <kentnl@g.o>
64 -Date: Sat, 20 Jun 2020 22:14:22 +1200
65 -Subject: Add support for -Dgentoolibdirs
66 -
67 -Which just adds the libdirs verbatim in the right place without
68 -having perl molest it in the process.
69 ----
70 - Configure | 26 ++++++++++++++++++++++++++
71 - config_h.SH | 5 +++++
72 - perl.c | 1 +
73 - perl_inc_macro.h | 8 ++++++++
74 - uconfig.sh | 1 +
75 - 5 files changed, 41 insertions(+)
76 -
77 -diff --git a/Configure b/Configure
78 -index cef8c3c078..77258e8f43 100755
79 ---- a/Configure
80 -+++ b/Configure
81 -@@ -1181,6 +1181,8 @@ orderlib=''
82 - ranlib=''
83 - d_perl_otherlibdirs=''
84 - otherlibdirs=''
85 -+gentoolibdirs=''
86 -+d_gentoolibdirs=''
87 - package=''
88 - spackage=''
89 - pager=''
90 -@@ -8101,6 +8103,28 @@ esac
91 - set d_perl_otherlibdirs
92 - eval $setvar
93 -
94 -+case "$gentoolibdirs" in
95 -+''|' ') dflt='none' ;;
96 -+*) dflt="$gentoolibdirs" ;;
97 -+esac
98 -+$cat <<EOM
99 -+Enter a colon-seperated list of explicit gentoo paths to stuff in @INC
100 -+unmolested, or enter 'none' for no extra paths
101 -+
102 -+EOM
103 -+rp='Colon-seperated list of gentoo-specific perl library search dirs?'
104 -+. ./myread
105 -+case "$ans" in
106 -+' '|''|none) gentoolibdirs=' ';;
107 -+*) gentoolibdirs="$ans" ;;
108 -+esac
109 -+case "$gentoolibdirs" in
110 -+' ') val=$undef ;;
111 -+*) val=$define ;;
112 -+esac
113 -+set d_gentoolibdirs
114 -+eval $setvar
115 -+
116 - : DTrace support
117 - dflt_dtrace='/usr/sbin/dtrace'
118 - $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
119 -@@ -24402,6 +24426,7 @@ d_openat='$d_openat'
120 - d_pathconf='$d_pathconf'
121 - d_pause='$d_pause'
122 - d_perl_otherlibdirs='$d_perl_otherlibdirs'
123 -+d_gentoolibdirs='$d_gentoolibdirs'
124 - d_phostname='$d_phostname'
125 - d_pipe2='$d_pipe2'
126 - d_pipe='$d_pipe'
127 -@@ -24937,6 +24962,7 @@ orderlib='$orderlib'
128 - osname='$osname'
129 - osvers='$osvers'
130 - otherlibdirs='$otherlibdirs'
131 -+gentoolibdirs='$gentoolibdirs'
132 - package='$package'
133 - pager='$pager'
134 - passcat='$passcat'
135 -diff --git a/config_h.SH b/config_h.SH
136 -index 08c5923ef8..5563082969 100755
137 ---- a/config_h.SH
138 -+++ b/config_h.SH
139 -@@ -1308,6 +1308,11 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un
140 - */
141 - #$d_perl_otherlibdirs PERL_OTHERLIBDIRS "$otherlibdirs" /**/
142 -
143 -+/* GENTOO_LIBDIRS:
144 -+ * Like PERL_OTHERLIBDIRS, but doesn't stuff ARCH dirs in when not wanted
145 -+ */
146 -+#$d_gentoolibdirs GENTOO_LIBDIRS "$gentoolibdirs" /**/
147 -+
148 - /* PRIVLIB:
149 - * This symbol contains the name of the private library for this package.
150 - * The library is private in the sense that it needn't be in anyone's
151 -diff --git a/perl.c b/perl.c
152 -index 2013a76026..62e67cfaa2 100644
153 ---- a/perl.c
154 -+++ b/perl.c
155 -@@ -4750,6 +4750,7 @@ S_init_perllib(pTHX)
156 - INCPUSH_ARCHLIB_EXP
157 - INCPUSH_PRIVLIB_EXP
158 - INCPUSH_PERL_OTHERLIBDIRS
159 -+ INCPUSH_GENTOO_LIBDIRS
160 - INCPUSH_PERL5LIB
161 - INCPUSH_APPLLIB_OLD_EXP
162 - INCPUSH_SITELIB_STEM
163 -diff --git a/perl_inc_macro.h b/perl_inc_macro.h
164 -index 5a2f20dfae..4b69b39199 100644
165 ---- a/perl_inc_macro.h
166 -+++ b/perl_inc_macro.h
167 -@@ -143,6 +143,14 @@
168 - INCPUSH_ADD_OLD_VERS|INCPUSH_CAN_RELOCATE);
169 - #endif
170 -
171 -+#ifdef GENTOO_LIBDIRS
172 -+# define INCPUSH_GENTOO_LIBDIRS S_incpush_use_sep(aTHX_ STR_WITH_LEN(GENTOO_LIBDIRS), \
173 -+ INCPUSH_ADD_OLD_VERS|INCPUSH_CAN_RELOCATE);
174 -+#endif
175 -+#ifndef INCPUSH_GENTOO_LIBDIRS
176 -+# define INCPUSH_GENTOO_LIBDIRS
177 -+#endif
178 -+
179 - #ifdef PERL_OTHERLIBDIRS
180 - # define INCPUSH_PERL_OTHERLIBDIRS_ARCHONLY S_incpush_use_sep(aTHX_ STR_WITH_LEN(PERL_OTHERLIBDIRS), \
181 - INCPUSH_ADD_OLD_VERS|INCPUSH_ADD_ARCHONLY_SUB_DIRS|INCPUSH_CAN_RELOCATE);
182 -diff --git a/uconfig.sh b/uconfig.sh
183 -index 1d4a0f4a57..fba825acad 100644
184 ---- a/uconfig.sh
185 -+++ b/uconfig.sh
186 -@@ -185,6 +185,7 @@ d_futimes='undef'
187 - d_gai_strerror='undef'
188 - d_gdbm_ndbm_h_uses_prototypes='undef'
189 - d_gdbmndbm_h_uses_prototypes='undef'
190 -+d_gentoolibdirs='undef'
191 - d_getaddrinfo='undef'
192 - d_getcwd='undef'
193 - d_getespwnam='undef'
194 ---
195 -2.27.0
196 -
197
198 diff --git a/dev-lang/perl/perl-5.30.3-r2.ebuild b/dev-lang/perl/perl-5.30.3-r2.ebuild
199 index 18013a31588..1e58cc17ee5 100644
200 --- a/dev-lang/perl/perl-5.30.3-r2.ebuild
201 +++ b/dev-lang/perl/perl-5.30.3-r2.ebuild
202 @@ -7,8 +7,8 @@ inherit alternatives flag-o-matic toolchain-funcs multilib multiprocessing
203
204 PATCH_VER=1
205 CROSS_VER=1.3.4
206 -PATCH_BASE="perl-5.30.0-patches-${PATCH_VER}"
207 -PATCH_DEV=dilfridge
208 +PATCH_BASE="perl-5.30.3-patches-${PATCH_VER}"
209 +PATCH_DEV=kentnl
210
211 DIST_AUTHOR=XSAWYERX
212
213 @@ -41,7 +41,6 @@ SRC_URI="
214 mirror://cpan/src/5.0/${MY_P}.tar.xz
215 mirror://cpan/authors/id/${DIST_AUTHOR:0:1}/${DIST_AUTHOR:0:2}/${DIST_AUTHOR}/${MY_P}.tar.xz
216 https://github.com/gentoo-perl/perl-patchset/releases/download/${PATCH_BASE}/${PATCH_BASE}.tar.xz
217 - mirror://gentoo/${PATCH_BASE}.tar.xz
218 https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${PATCH_BASE}.tar.xz
219 https://github.com/arsv/perl-cross/releases/download/${CROSS_VER}/perl-cross-${CROSS_VER}.tar.gz
220 "
221 @@ -252,55 +251,6 @@ src_remove_dual() {
222 done
223 }
224
225 -src_prepare_update_patchlevel_h() {
226 - # Copied and modified from debian:
227 - # Copyright 2011 Niko Tyni
228 - # This program is free software; you can redistribute it and/or modify
229 - # it under the same terms as Perl itself.
230 - local patchdir="${WORKDIR}/patches"
231 - local prefix
232 - local patchoutput="patchlevel-gentoo.h"
233 -
234 - [[ -f ${patchdir}/series ]] || return 0
235 -
236 -while read patch
237 -do
238 - patchname=$(echo $patch | sed 's/\.diff$//')
239 - < $patchdir/$patch sed -e '/^Subject:/ { N; s/\n / / }' | sed -n -e '
240 -
241 - # massage the patch headers
242 - s|^Bug: .*https\?://rt\.perl\.org/.*id=\(.*\).*|[perl #\1]|; tprepend;
243 - s|^Bug: .*https\?://rt\.cpan\.org/.*id=\(.*\).*|[rt.cpan.org #\1]|; tprepend;
244 - s|^Bug-Gentoo: ||; tprepend;
245 - s/^\(Subject\|Description\): //; tappend;
246 - s|^Origin: .*http://perl5\.git\.perl\.org/perl\.git/commit\(diff\)\?/\(.......\).*|[\2]|; tprepend;
247 -
248 - # post-process at the end of input
249 - $ { x;
250 - # include the version number in the patchlevel.h description (if available)
251 - s/List packaged patches/&'" for ${PF}(#${PATCH_VER})"'/;
252 -
253 - # escape any backslashes and double quotes
254 - s|\\|\\\\|g; s|"|\\"|g;
255 -
256 - # add a prefix
257 - s|^|\t,"'"$prefix$patchname"' - |;
258 - # newlines away
259 - s/\n/ /g; s/ */ /g;
260 - # add a suffix
261 - s/ *$/"/; p
262 - };
263 - # stop all processing
264 - d;
265 - # label: append to the hold space
266 - :append H; d;
267 - # label: prepend to the hold space
268 - :prepend x; H; d;
269 - '
270 -done < "${WORKDIR}"/patches/series > "${S}/${patchoutput}"
271 -echo "${patchoutput}" >> "${S}/MANIFEST"
272 -}
273 -
274 src_prepare_perlcross() {
275 cp -a ../perl-cross-${CROSS_VER}/* . || die
276
277 @@ -313,28 +263,143 @@ src_prepare_dynamic() {
278 ln -s ${LIBPERL} libperl$(get_libname ) || die
279 }
280
281 +# Copy a patch into the patch series
282 +# add_patch SRC_PATH DEST_NAME ['description'] ['bug'] ['bug']
283 +# - description is optional, but recommended
284 +# - all arguments after descriptions are bug URLs
285 +add_patch() {
286 + local patchdir="${WORKDIR}/patches"
287 + local infodir="${WORKDIR}/patch-info"
288 + local src_name dest_name desc
289 + src_name="$1"
290 + dest_name="$2"
291 + desc="$3"
292 + shift; shift; shift;
293 + einfo "Adding ${dest_name} to patch bundle"
294 + cp "${src_name}" "${patchdir}/${dest_name}" || die "Couldn't copy ${src_name} to ${dest_name}"
295 + if [[ -n "${desc}" ]]; then
296 + printf "%s" "${desc}" > "${infodir}/${dest_name}.desc" || die "Couldn't write ${dest_name}.desc"
297 + fi
298 + if [[ $# -gt 0 ]]; then
299 + # Note: when $@ is more than one element, this emits a
300 + # line for each element
301 + printf "%s\n" "$@" > "${infodir}/${dest_name}.bugs" || die "Couldn't write ${dest_name}.bugs"
302 + fi
303 +}
304 +# Remove a patch using a glob expr
305 +# eg:
306 +# rm_patch *-darin-Use-CC*
307 +#
308 +rm_patch() {
309 + local patchdir="${WORKDIR}/patches"
310 + local expr="$1"
311 + local patch="$( cd "${patchdir}"; echo $expr )"
312 + einfo "Removing $patch ($expr) from patch bundle"
313 + if [[ -e "${patchdir}/${patch}" ]]; then
314 + rm -f "${patchdir}/${patch}" || die "Can't remove ${patch} ( $expr )"
315 + else
316 + ewarn "No ${expr} found in ${patchdir} to remove"
317 + fi
318 +}
319 +# Yes, this is a reasonable amount of code for something seemingly simple
320 +# but this is far easier to debug when things go wrong, and things went wrong
321 +# multiple times while I was getting the exact number of slashes right, which
322 +# requires circumnavigating both bash and sed escape mechanisms.
323 +c_escape_string() {
324 + local slash dquote
325 + slash='\'
326 + dquote='"'
327 + re_slash="${slash}${slash}"
328 + re_dquote="${slash}${dquote}"
329 +
330 + # Convert \ to \\,
331 + # " to \"
332 + echo "$1" |\
333 + sed "s|${re_slash}|${re_slash}${re_slash}|g" |\
334 + sed "s|${re_dquote}|${re_slash}${re_dquote}|g"
335 +}
336 +c_escape_file() {
337 + c_escape_string "$(cat "$1")"
338 +}
339 +
340 +apply_patchdir() {
341 + local patchdir="${WORKDIR}/patches"
342 + local infodir="${WORKDIR}/patch-info"
343 + local patchoutput="patchlevel-gentoo.h"
344 +
345 + # Inject Patch-Level info into description for patchlevel.h patch
346 + # to show in -V
347 + local patch_expr="*List-packaged-patches*"
348 + local patch="$( cd "${patchdir}"; echo $patch_expr )";
349 + einfo "Injecting patch-level info into ${patch}.desc ( $patch_expr )"
350 +
351 + if [[ -e "${patchdir}/${patch}" ]]; then
352 + printf "List packaged patches for %s(%s) in patchlevel.h" "${PF}" "${PATCH_BASE}"\
353 + >"${infodir}/${patch}.desc" || die "Can't rewrite ${patch}.desc"
354 + else
355 + eerror "No $patch_expr found in ${patchdir}"
356 + fi
357 +
358 + # Compute patch list to apply
359 + # different name other than PATCHES to stop default
360 + # reapplying it
361 + # Single depth is currently only supported, as artifacts can reside
362 + # from the old layout being multiple-directories, as well as it grossly
363 + # simplifying the patchlevel_gentoo.h generation.
364 + local PERL_PATCHES=($(
365 + find "${patchdir}" -maxdepth 1 -mindepth 1 -type f -printf "%f\n" |\
366 + grep -E '[.](diff|patch)$' |\
367 + sort -n
368 + ))
369 +
370 + for patch in "${PERL_PATCHES[@]}"; do
371 + eapply "${WORKDIR}"/patches/${patch}
372 + done
373 +
374 + einfo "Generating $patchoutput"
375 +
376 + # This code creates a header file, each iteration
377 + # creates one-or-more-lines for each entry found in PERL_PATCHES
378 + # and STDOUT is redirected to the .h file
379 + for patch in "${PERL_PATCHES[@]}"; do
380 + local desc_f="${infodir}/${patch}.desc"
381 + local bugs_f="${infodir}/${patch}.bugs"
382 +
383 + printf ',"%s"\n' "${patch}"
384 + if [[ ! -e "${desc_f}" ]]; then
385 + ewarn "No description provided for ${patch} (expected: ${desc_f} )"
386 + else
387 + local desc="$(c_escape_file "${desc_f}")"
388 + printf ',"- %s"\n' "${desc}"
389 + fi
390 + if [[ -e "${bugs_f}" ]]; then
391 + while read -d $'\n' -r line; do
392 + local esc_line="$(c_escape_string "${line}")"
393 + printf ',"- Bug: %s"\n' "${esc_line}"
394 + done <"${bugs_f}"
395 + fi
396 + done > "${S}/${patchoutput}"
397 + printf "%s\n" "${patchoutput}" >> "${S}/MANIFEST"
398 +
399 +}
400 src_prepare() {
401 - local patch
402 + local patchdir="${WORKDIR}/patches"
403
404 + # Prepare Patch dir with additional patches / remove unwanted patches
405 + # Inject bug/desc entries for perl -V
406 if use hppa ; then
407 - eapply "${FILESDIR}/${PN}-5.26.2-hppa.patch" # bug 634162
408 + # bug 634162
409 + add_patch "${FILESDIR}/${PN}-5.26.2-hppa.patch" "100-5.26.2-hppa.patch"\
410 + "Fix broken miniperl on hppa"\
411 + "https://bugs.debian.org/869122" "https://bugs.gentoo.org/634162"
412 fi
413 -
414 if [[ ${CHOST} == *-solaris* ]] ; then
415 # do NOT mess with nsl, on Solaris this is always necessary,
416 # when -lsocket is used e.g. to get h_errno
417 - sed -i '/gentoo\/no-nsl-cl\.patch/d' "${WORKDIR}/patches/series" || die
418 + rm_patch "*-nsl-and-cl*"
419 fi
420
421 - einfo "[ Applying patches from ${PATCH_BASE} ]"
422 - while read patch ; do
423 - eapply "${WORKDIR}"/patches/${patch}
424 - done < "${WORKDIR}"/patches/series
425 - einfo "[ Done with ${PATCH_BASE} ]"
426 -
427 - eapply "${FILESDIR}/${PN}-5.30.3-gentoo-libdirs.patch"
428 -
429 - src_prepare_update_patchlevel_h
430 + apply_patchdir
431
432 tc-is-cross-compiler && src_prepare_perlcross