This is an automated email from the git hooks/post-receive script. kanashiro-guest pushed a commit to branch master in repository carton.
commit a1b4a1c871443d863b53727c454ea58fb60dbda9 Author: Tatsuhiko Miyagawa <miyag...@bulknews.net> Date: Wed Jun 5 13:09:56 2013 +0900 Experimental: Make carton install save dists to local/cache, then carton bundle copy the tarballs to vendor. --- lib/Carton/Builder.pm | 28 ++++++++++++++++------------ lib/Carton/CLI.pm | 14 ++++++-------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/lib/Carton/Builder.pm b/lib/Carton/Builder.pm index 5f3a3f3..1edaf29 100644 --- a/lib/Carton/Builder.pm +++ b/lib/Carton/Builder.pm @@ -1,6 +1,8 @@ package Carton::Builder; use strict; -use File::Temp; +use File::Path (); +use File::Basename (); +use File::Copy (); use Moo; has mirror => (is => 'rw'); @@ -26,19 +28,20 @@ sub custom_mirror { } sub bundle { - my($self, $path) = @_; + my($self, $path, $cache_path, $lock) = @_; - my $temp = File::Temp::tempdir(CLEANUP => 1); # ignore installed + for my $dist ($lock->distributions) { + my $source = "$path/cache/authors/id/" . $dist->pathname; + my $target = "$cache_path/authors/id/" . $dist->pathname; - $self->run_cpanm( - "-L", $temp, - (map { ("--mirror", $_->url) } $self->effective_mirrors), - "--mirror-index", $self->index, - "--skip-satisfied", - "--save-dists", $path, - "--with-develop", - "--installdeps", ".", - ); + if (-f $source) { + warn "Copying ", $dist->pathname, "\n"; + File::Path::mkpath([ File::Basename::dirname($target) ], 0, 0777); + File::Copy::copy($source, $target) or warn "$target: $!"; + } else { + warn "Couldn't find @{[ $dist->pathname ]}\n"; + } + } } sub install { @@ -51,6 +54,7 @@ sub install { ( $self->index ? ("--mirror-index", $self->index) : () ), ( $self->cascade ? "--cascade-search" : () ), ( $self->custom_mirror ? "--mirror-only" : () ), + "--save-dists", "$path/cache", "--with-develop", "--installdeps", ".", ) or die "Installing modules failed\n"; diff --git a/lib/Carton/CLI.pm b/lib/Carton/CLI.pm index 7a65286..3205597 100644 --- a/lib/Carton/CLI.pm +++ b/lib/Carton/CLI.pm @@ -159,14 +159,10 @@ sub cmd_bundle { if ($lock) { $self->print("Bundling modules using $cpanfile\n"); - my $index = $self->index_file; - $lock->write_index($index); - my $builder = Carton::Builder->new( mirror => $self->mirror, - index => $index, ); - $builder->bundle($self->vendor_cache); + $builder->bundle($self->install_path, $self->vendor_cache, $lock); } else { $self->error("Can't locate carton.lock file. Run carton install first\n"); } @@ -187,6 +183,11 @@ sub cmd_install { ); my $lock = $self->find_lock; + + if ($deployment && !$lock) { + $self->error("--deployment requires carton.lock: Run `carton install` and make sure carton.lock is checked into your version control.\n"); + } + my $cpanfile = $self->find_cpanfile; my $builder = Carton::Builder->new( @@ -195,9 +196,6 @@ sub cmd_install { ); if ($deployment) { - unless ($lock) { - $self->error("--deployment requires carton.lock: Run `carton install` and make sure carton.lock is checked into your version control.\n"); # TODO test - } $self->print("Installing modules using $cpanfile (deployment mode)\n"); $builder->cascade(0); } else { -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/carton.git _______________________________________________ Pkg-perl-cvs-commits mailing list Pkg-perl-cvs-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits