Skip to content

Commit 7720ae3

Browse files
committed
generate.pl: support perl dists of different compression types
Perl 5.28.0 seems to be distributed only in gzip and xz tarballs now, so adjust accordingly. This now requires a GNU tar with `-a/--auto-compress` option support (tar version >= 1.20) which buildpack-deps Docker image already includes; those wanting to use this script to regenerate, however, should match their tar version as well.
1 parent 1c201e9 commit 7720ae3

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

generate.pl

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ sub die_with_sample {
6565
die "Bad version: $release->{version}" unless $release->{version} =~ /\A5\.\d+\.\d+\Z/;
6666

6767
my $patch;
68-
my $file = "perl-$release->{version}.tar.bz2";
68+
$release->{type} ||= 'bz2';
69+
my $file = "perl-$release->{version}.tar.$release->{type}";
6970
my $url = "https://www.cpan.org/src/5.0/$file";
7071
if (-f "downloads/$file" &&
7172
`sha256sum downloads/$file` =~ /^\Q$release->{sha256}\E\s+\Qdownloads\/$file\E/) {
@@ -79,7 +80,7 @@ sub die_with_sample {
7980
qx{rm -fR $dir};
8081
mkdir $dir or die "Couldn't create $dir";
8182
qx{
82-
tar -C "downloads" -jxf $dir.tar.bz2 &&\
83+
tar -C "downloads" -axf $dir.tar.$release->{type} &&\
8384
cd $dir &&\
8485
find . -exec chmod u+w {} + &&\
8586
git init &&\
@@ -102,7 +103,7 @@ sub die_with_sample {
102103
for my $config (keys %builds) {
103104
my $output = $template;
104105
$output =~ s/\{\{$_\}\}/$release->{$_}/mg
105-
for (qw(version pause extra_flags sha256 url _tag cpanm_dist_name cpanm_dist_url cpanm_dist_sha256));
106+
for (qw(version pause extra_flags sha256 type url _tag cpanm_dist_name cpanm_dist_url cpanm_dist_sha256));
106107
$output =~ s/\{\{args\}\}/$builds{$config}/mg;
107108

108109
my $dir = sprintf "%i.%03i.%03i-%s",
@@ -200,10 +201,10 @@ =head1 DESCRIPTION
200201
COPY *.patch /usr/src/perl/
201202
WORKDIR /usr/src/perl
202203
203-
RUN curl -SL {{url}} -o perl-{{version}}.tar.bz2 \
204-
&& echo '{{sha256}} *perl-{{version}}.tar.bz2' | sha256sum -c - \
205-
&& tar --strip-components=1 -xjf perl-{{version}}.tar.bz2 -C /usr/src/perl \
206-
&& rm perl-{{version}}.tar.bz2 \
204+
RUN curl -SL {{url}} -o perl-{{version}}.tar.{{type}} \
205+
&& echo '{{sha256}} *perl-{{version}}.tar.{{type}}' | sha256sum -c - \
206+
&& tar --strip-components=1 -xaf perl-{{version}}.tar.{{type}} -C /usr/src/perl \
207+
&& rm perl-{{version}}.tar.{{type}} \
207208
&& cat *.patch | patch -p1 \
208209
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
209210
&& archBits="$(dpkg-architecture --query DEB_BUILD_ARCH_BITS)" \

0 commit comments

Comments
 (0)