Skip to content

Commit 808a689

Browse files
committed
Add patch support
This is not yet complete; what remains is the ability to generate the final patch, the one that patches patchlevel.h (and thus lists the locally applied patches in perl -V / Config.pm). This requires downloading the proper patchlevel.h for each version and generating a patch in generate.pl.
1 parent b86caa1 commit 808a689

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

generate.pl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ sub die_with_sample {
5858

5959
mkdir $dir unless -d $dir;
6060

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+
6171
open my $dockerfile, ">$dir/Dockerfile" or die "Couldn't open $dir/Dockerfile for writing";
6272
print $dockerfile $output;
6373
close $dockerfile;
@@ -112,12 +122,14 @@ =head1 DESCRIPTION
112122
&& rm -fr /var/lib/apt/lists/*
113123
114124
RUN mkdir /usr/src/perl
125+
{{copy_patches}}
115126
WORKDIR /usr/src/perl
116127
117128
RUN curl -SL https://cpan.metacpan.org/authors/id/{{pause}}/perl-{{version}}.tar.bz2 -o perl-{{version}}.tar.bz2 \
118129
&& echo '{{sha1}} *perl-{{version}}.tar.bz2' | sha1sum -c - \
119130
&& tar --strip-components=1 -xjf perl-{{version}}.tar.bz2 -C /usr/src/perl \
120131
&& rm perl-{{version}}.tar.bz2 \
132+
&& {{apply_patches}} \
121133
&& ./Configure {{args}} {{extra_flags}} -des \
122134
&& make -j$(nproc) \
123135
&& TEST_JOBS=$(nproc) make test_harness \

0 commit comments

Comments
 (0)