Skip to content

Commit f40ef8d

Browse files
committed
fix broken carton update
1 parent 8be0b08 commit f40ef8d

File tree

6 files changed

+465
-36
lines changed

6 files changed

+465
-36
lines changed

author/carton/Dockerfile

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,8 @@ RUN curl --compressed -sSL https://raw.githubusercontent.com/tokuhirom/Perl-Buil
99
RUN apk del perl patch
1010

1111
ENV PATH=/opt/perl-5.8/bin:$PATH
12-
RUN curl --compressed -sSL https://cpanmin.us/ | perl - --notest Distribution::[email protected] App::FatPacker::[email protected] Carton ExtUtils::PL2Bat
12+
RUN curl --compressed -sSL https://cpanmin.us/ | \
13+
perl - --notest Carton ExtUtils::PL2Bat
1314

1415
RUN mkdir -p /tmp/carton
1516
WORKDIR /tmp/carton
16-
17-
COPY cpanfile .
18-
COPY build.pl .
19-
COPY cpanfile.snapshot .
20-
21-
RUN carton install --deployment

author/carton/Makefile

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,36 @@ all: carton
99

1010
.PHONY: image
1111
image: .image.exists ## build docker image of packing environment
12+
.DELETE_ON_ERROR: .image.exists
1213
.image.exists: Dockerfile cpanfile cpanfile.snapshot build.pl
14+
touch .image.exists
1315
-docker rmi $(IMAGE_NAME)
1416
docker build -t $(IMAGE_NAME) .
15-
touch .image.exists
1617

17-
.container.exists: .image.exists
18-
-docker rm $(IMAGE_NAME)-tmp
19-
docker run --name $(IMAGE_NAME)-tmp $(IMAGE_NAME) perl build.pl
20-
touch .container.exists
21-
22-
carton: .container.exists ## generate fat-packed carton
23-
docker cp $(IMAGE_NAME)-tmp:/tmp/carton/carton carton
18+
carton: .deps.exists build.pl ## generate fat-packed carton
19+
cat build.pl | docker run --rm -i --volumes-from $(IMAGE_NAME)-deps $(IMAGE_NAME) perl -
20+
docker cp $(IMAGE_NAME)-deps:/tmp/carton/carton carton
21+
22+
.PHONY: deps
23+
deps: .deps.exists ## install dependencies
24+
.DELETE_ON_ERROR: .deps.exists
25+
.deps.exists: .image.exists cpanfile.snapshot
26+
touch .deps.exists
27+
-docker rm $(IMAGE_NAME)-deps
28+
docker create -v /tmp/carton --name $(IMAGE_NAME)-deps $(IMAGE_NAME) /bin/true
29+
docker cp cpanfile $(IMAGE_NAME)-deps:/tmp/carton/cpanfile
30+
docker cp cpanfile.snapshot $(IMAGE_NAME)-deps:/tmp/carton/cpanfile.snapshot
31+
docker run --rm --volumes-from $(IMAGE_NAME)-deps $(IMAGE_NAME) carton install --deployment
32+
docker cp $(IMAGE_NAME)-deps:/tmp/carton/local .
2433

2534
.PHONY: update
2635
update: .image.exists ## download dependencies and update cpanfile.snapshot
2736
-docker rm $(IMAGE_NAME)-update
28-
docker run --name $(IMAGE_NAME)-update $(IMAGE_NAME) \
29-
sh -c "rm -f cpanfile.snapshot && rm -rf local && carton install"
37+
docker create -v /tmp/carton --name $(IMAGE_NAME)-update $(IMAGE_NAME) /bin/true
38+
docker cp cpanfile $(IMAGE_NAME)-update:/tmp/carton/cpanfile
39+
docker run --rm --volumes-from $(IMAGE_NAME)-update $(IMAGE_NAME) carton install
3040
docker cp $(IMAGE_NAME)-update:/tmp/carton/cpanfile.snapshot cpanfile.snapshot
41+
-docker rm $(IMAGE_NAME)-update
3142

3243
.PHONY: install
3344
install: all ## installs into the bin directory of this repository
@@ -36,7 +47,7 @@ install: all ## installs into the bin directory of this repository
3647
.PHONY: clean
3748
clean:
3849
rm -f carton carton.bat
39-
rm -f .image.exists .container.exists
50+
rm -f .image.exists .deps.exists
4051
-docker rm $(IMAGE_NAME)-tmp
4152
-docker rm $(IMAGE_NAME)-update
4253
-docker rmi $(IMAGE_NAME)

author/carton/build.pl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use strict;
44
use warnings;
55
use FindBin;
6+
use lib "$FindBin::Bin/local/lib/perl5";
67
use App::FatPacker::Simple;
78
use Carton::Snapshot;
89
use ExtUtils::PL2Bat qw/pl2bat/;
@@ -18,6 +19,14 @@ sub fatpack {
1819
',',
1920
# configure modules
2021
'Module::Build',
22+
# fat-packing
23+
'App::FatPacker', 'App::FatPacker::Simple',
24+
'Clone', 'Distribution::Metadata',
25+
'ExtUtils::CBuilder', 'ExtUtils::ParseXS',
26+
'IO::String', 'JSON', 'Module::Build::Tiny', 'PPI',
27+
'Params::Util', 'Cwd', 'List::Util',
28+
'Perl::Strip', 'Scalar::Util', 'Storable',
29+
'Task::Weaken', 'Perl::OSType', 'XSLoader', 'common::sense',
2130
# test modules
2231
'Test2','App::Prove','TAP::Harness',
2332
# core modules of perl 5

author/carton/cpanfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ requires 'perl', '5.006';
33
requires 'Carton';
44
requires 'Menlo::Legacy';
55
requires 'Menlo';
6+
requires 'CPAN::Meta::Requirements', '==2.140'; # 2.141 doesn't support perl 5.8.
7+
requires 'Distribution::Metadata', '==0.06';
8+
requires 'App::FatPacker::Simple', '==0.09';
9+
requires 'Module::Build::Tiny', '==0.047'; # 0.048 doesn't work on perl 5.8.
10+
611
requires 'Menlo::Index::Mirror';
712
requires 'ExtUtils::Manifest', '1.70';
813
requires 'ExtUtils::MakeMaker', '7.52';

0 commit comments

Comments
 (0)