Skip to content

Commit

Permalink
fix broken cpm update
Browse files Browse the repository at this point in the history
  • Loading branch information
shogo82148 committed Jun 10, 2024
1 parent f40ef8d commit 4045371
Show file tree
Hide file tree
Showing 6 changed files with 285 additions and 35 deletions.
8 changes: 1 addition & 7 deletions author/cpm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@ RUN curl --compressed -sSL https://raw.githubusercontent.com/tokuhirom/Perl-Buil
RUN apk del perl patch

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

RUN mkdir -p /tmp/cpm
WORKDIR /tmp/cpm

COPY cpanfile .
COPY build.pl .
COPY cpanfile.snapshot .

RUN carton install --deployment
28 changes: 19 additions & 9 deletions author/cpm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,30 @@ image: .image.exists ## build docker image of packing environment
docker build -t $(IMAGE_NAME) .
touch .image.exists

.container.exists: .image.exists
-docker rm $(IMAGE_NAME)-tmp
docker run --name $(IMAGE_NAME)-tmp $(IMAGE_NAME) perl build.pl
touch .container.exists

cpm: .container.exists ## generate fat-packed cpm
docker cp $(IMAGE_NAME)-tmp:/tmp/cpm/cpm cpm
cpm: .deps.exists build.pl ## generate fat-packed cpm
cat build.pl | docker run --rm -i --volumes-from $(IMAGE_NAME)-deps $(IMAGE_NAME) perl -
docker cp $(IMAGE_NAME)-deps:/tmp/cpm/cpm cpm

.PHONY: deps
deps: .deps.exists ## install dependencies
.DELETE_ON_ERROR: .deps.exists
.deps.exists: .image.exists cpanfile.snapshot
touch .deps.exists
-docker rm $(IMAGE_NAME)-deps
docker create -v /tmp/cpm --name $(IMAGE_NAME)-deps $(IMAGE_NAME) /bin/true
docker cp cpanfile $(IMAGE_NAME)-deps:/tmp/cpm/cpanfile
docker cp cpanfile.snapshot $(IMAGE_NAME)-deps:/tmp/cpm/cpanfile.snapshot
docker run --rm --volumes-from $(IMAGE_NAME)-deps $(IMAGE_NAME) carton install --deployment
docker cp $(IMAGE_NAME)-deps:/tmp/cpm/local .

.PHONY: update
update: .image.exists ## download dependencies and update cpanfile.snapshot
-docker rm $(IMAGE_NAME)-update
docker run --name $(IMAGE_NAME)-update $(IMAGE_NAME) \
sh -c "rm -f cpanfile.snapshot && rm -rf local && carton install"
docker create -v /tmp/cpm --name $(IMAGE_NAME)-update $(IMAGE_NAME) /bin/true
docker cp cpanfile $(IMAGE_NAME)-update:/tmp/cpm/cpanfile
docker run --rm --volumes-from $(IMAGE_NAME)-update $(IMAGE_NAME) carton install
docker cp $(IMAGE_NAME)-update:/tmp/cpm/cpanfile.snapshot cpanfile.snapshot
-docker rm $(IMAGE_NAME)-update

.PHONY: install
install: all ## installs into the bin directory of this repository
Expand Down
9 changes: 9 additions & 0 deletions author/cpm/build.pl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/local/lib/perl5";
use App::FatPacker::Simple;
use Carton::Snapshot;
use ExtUtils::PL2Bat qw/pl2bat/;
Expand All @@ -20,6 +21,14 @@ sub fatpack {
'ExtUtils::CBuilder', 'ExtUtils::MakeMaker::CPANfile',
'Module::Build::Tiny', 'ExtUtils::ParseXS',
'Devel::GlobalDestruction::XS',
# fat-packing
'App::FatPacker', 'App::FatPacker::Simple',
'Clone', 'Distribution::Metadata',
'ExtUtils::CBuilder', 'ExtUtils::ParseXS',
'IO::String', 'JSON', 'Module::Build::Tiny', 'PPI',
'Params::Util', 'Cwd', 'List::Util',
'Perl::Strip', 'Scalar::Util', 'Storable',
'Task::Weaken', 'Perl::OSType', 'XSLoader', 'common::sense',
# test modules
'Test2', 'App::Prove','TAP::Harness', 'Perl::OSType',
# core modules of perl 5
Expand Down
3 changes: 3 additions & 0 deletions author/cpm/cpanfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ requires 'perl', '5.006';
requires "Devel::GlobalDestruction::XS";
requires "Module::Build::Tiny";
requires 'CPAN::Meta::Requirements', '==2.140'; # 2.141 doesn't support perl 5.8.
requires 'Distribution::Metadata', '==0.06';
requires 'App::FatPacker::Simple', '==0.09';
requires 'Module::Build::Tiny', '==0.047'; # 0.048 doesn't work on perl 5.8.

requires "App::cpm";
requires "Class::C3";
Expand Down
Loading

0 comments on commit 4045371

Please sign in to comment.