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.
This commit is contained in:
Peter Martini 2015-04-11 14:19:33 -07:00
parent b86caa1346
commit 808a689179

View file

@ -58,6 +58,16 @@ for my $release (@{$yaml->{releases}}) {
mkdir $dir unless -d $dir; mkdir $dir unless -d $dir;
# glob switches behavior in scalar context, so force an intermediate
# list context so we can get the count
if (() = glob "$dir/*.patch") {
$output =~ s#{{copy_patches}}#COPY *.patch /usr/src/perl/#;
$output =~ s#{{apply_patches}}#cat *.patch | patch -p1#;
} else {
$output =~ s/{{copy_patches}}\n//mg;
$output =~ s/.*{{apply_patches}}.*\n//mg;
}
open my $dockerfile, ">$dir/Dockerfile" or die "Couldn't open $dir/Dockerfile for writing"; open my $dockerfile, ">$dir/Dockerfile" or die "Couldn't open $dir/Dockerfile for writing";
print $dockerfile $output; print $dockerfile $output;
close $dockerfile; close $dockerfile;
@ -112,12 +122,14 @@ RUN apt-get update \
&& rm -fr /var/lib/apt/lists/* && rm -fr /var/lib/apt/lists/*
RUN mkdir /usr/src/perl RUN mkdir /usr/src/perl
{{copy_patches}}
WORKDIR /usr/src/perl WORKDIR /usr/src/perl
RUN curl -SL https://cpan.metacpan.org/authors/id/{{pause}}/perl-{{version}}.tar.bz2 -o perl-{{version}}.tar.bz2 \ RUN curl -SL https://cpan.metacpan.org/authors/id/{{pause}}/perl-{{version}}.tar.bz2 -o perl-{{version}}.tar.bz2 \
&& echo '{{sha1}} *perl-{{version}}.tar.bz2' | sha1sum -c - \ && echo '{{sha1}} *perl-{{version}}.tar.bz2' | sha1sum -c - \
&& tar --strip-components=1 -xjf perl-{{version}}.tar.bz2 -C /usr/src/perl \ && tar --strip-components=1 -xjf perl-{{version}}.tar.bz2 -C /usr/src/perl \
&& rm perl-{{version}}.tar.bz2 \ && rm perl-{{version}}.tar.bz2 \
&& {{apply_patches}} \
&& ./Configure {{args}} {{extra_flags}} -des \ && ./Configure {{args}} {{extra_flags}} -des \
&& make -j$(nproc) \ && make -j$(nproc) \
&& TEST_JOBS=$(nproc) make test_harness \ && TEST_JOBS=$(nproc) make test_harness \