@@ -56,6 +56,26 @@ sub die_with_sample {
5656 ($release -> {version } =~ / (\d +)\. (\d +)\. (\d +)/ ),
5757 $config ;
5858
59+ mkdir $dir unless -d $dir ;
60+
61+ # glob switches behavior in scalar context, so force an intermediate
62+ # list context so we can get the count
63+ if (() = glob " $dir /*.patch" ) {
64+ $output =~ s # {{copy_patches}}# COPY *.patch /usr/src/perl/# ;
65+ $output =~ s # {{apply_patches}}# cat *.patch | patch -p1# ;
66+ } else {
67+ $output =~ s / {{copy_patches}}\n // mg ;
68+ $output =~ s / .*{{apply_patches}}.*\n // mg ;
69+ }
70+
71+ if (defined $release -> {test_parallel } && $release -> {test_parallel } eq " no" ) {
72+ $output =~ s / {{test}}/ make test_harness/ ;
73+ } elsif (!defined $release -> {test_parallel } || $release -> {test_parallel } eq " yes" ) {
74+ $output =~ s / {{test}}/ TEST_JOBS=\$ (nproc) make test_harness/ ;
75+ } else {
76+ die " test_parallel was provided for $release ->{version} but is invalid; should be 'yes' or 'no'\n " ;
77+ }
78+
5979 open my $dockerfile , " >$dir /Dockerfile" or die " Couldn't open $dir /Dockerfile for writing" ;
6080 print $dockerfile $output ;
6181 close $dockerfile ;
@@ -80,6 +100,10 @@ =head1 DESCRIPTION
80100
81101=over 4
82102
103+ =item REQUIRED
104+
105+ =over 4
106+
83107=item version
84108
85109The actual perl version, such as B<5.20.1 > .
@@ -92,11 +116,29 @@ =head1 DESCRIPTION
92116
93117The PAUSE (CPAN user) account that the release was uploaded to.
94118
95- =item (optionally) extra_args
119+ =back
120+
121+ =item OPTIONAL
122+
123+ =over 4
124+
125+ =item extra_args
96126
97127Additional text to pass to C<Configure > . At the moment, this is necessary for
981285.18.x so that it can get the C<-fwrapv > flag.
99129
130+ Default: C<"" >
131+
132+ =item test_parallel
133+
134+ This can be either 'no', 'yes', or unspecified (equivalent to 'yes').
135+ Added due to dist/IO/t/io_unix.t failing when TEST_JOBS > 1, but should
136+ only be used in case of a documented issue.
137+
138+ Default: C<yes >
139+
140+ =back
141+
100142=back
101143
102144=cut
@@ -110,15 +152,17 @@ =head1 DESCRIPTION
110152 && rm -fr /var/lib/apt/lists/*
111153
112154RUN mkdir /usr/src/perl
155+ {{copy_patches}}
113156WORKDIR /usr/src/perl
114157
115158RUN curl -SL https://cpan.metacpan.org/authors/id/{{pause}}/perl-{{version}}.tar.bz2 -o perl-{{version}}.tar.bz2 \
116159 && echo '{{sha1}} *perl-{{version}}.tar.bz2' | sha1sum -c - \
117160 && tar --strip-components=1 -xjf perl-{{version}}.tar.bz2 -C /usr/src/perl \
118161 && rm perl-{{version}}.tar.bz2 \
162+ && {{apply_patches}} \
119163 && ./Configure {{args}} {{extra_flags}} -des \
120164 && make -j$(nproc) \
121- && TEST_JOBS=$(nproc) make test_harness \
165+ && {{test}} \
122166 && make install \
123167 && cd /usr/src \
124168 && curl -LO https://raw.githubusercontent.com/miyagawa/cpanminus/master/cpanm \
0 commit comments