This is an automated email from the git hooks/post-receive script.

kanashiro-guest pushed a commit to branch master
in repository carton.

commit 858b7deedc4c28e7cacbd1fc1adf9b1ff5a31a09
Author: Tatsuhiko Miyagawa <miyag...@bulknews.net>
Date:   Wed Feb 6 10:59:45 2013 -0800

    Fix bundle command, so that it will use .lock to build packages to 
determine versions
---
 lib/Carton.pm     | 29 +++++++++++------------------
 lib/Carton/CLI.pm | 10 +++++++---
 2 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/lib/Carton.pm b/lib/Carton.pm
index 61feb85..8ade44e 100644
--- a/lib/Carton.pm
+++ b/lib/Carton.pm
@@ -36,14 +36,6 @@ sub lock { $_[0]->{lock} }
 
 sub local_mirror { File::Spec->rel2abs("$_[0]->{path}/cache") }
 
-sub download_from_cpanfile {
-    my($self, $cpanfile, $local_mirror) = @_;
-
-    my @modules = $self->list_dependencies;
-    $self->download_conservative(\@modules, $local_mirror, 1)
-        or die "Bundling modules failed\n";
-}
-
 sub install_from_cpanfile {
     my($self, $file, $cascade) = @_;
 
@@ -80,30 +72,31 @@ sub dedupe_modules {
     return [ reverse @result ];
 }
 
-sub download_conservative {
-    my($self, $modules, $dir, $cascade) = @_;
 
-    $modules = $self->dedupe_modules($modules);
+sub download_from_cpanfile {
+    my($self, $cpanfile, $local_mirror) = @_;
+
+    my @modules = $self->list_dependencies;
+    my $modules = $self->dedupe_modules(\@modules);
+
+    my $index = $self->build_index($self->lock->{modules});
+    $self->build_mirror_file($index, $self->{mirror_file});
 
     my $mirror = $self->{mirror} || $DefaultMirror;
 
     local $self->{path} = File::Temp::tempdir(CLEANUP => 1); # ignore installed
 
     $self->run_cpanm(
+        "-v",
         "--mirror", $mirror,
         "--mirror", "http://backpan.perl.org/";, # fallback
+        "--mirror-index", $self->{mirror_file},
         "--no-skip-satisfied",
         ( $mirror ne $DefaultMirror ? "--mirror-only" : () ),
-        ( $cascade ? "--cascade-search" : () ),
         "--scandeps",
-        "--save-dists", $dir,
+        "--save-dists", $local_mirror,
         @$modules,
     );
-
-    # write 02packages using local installations
-    my %installs = $self->find_installs;
-    my $index = $self->build_index(\%installs);
-    $self->build_mirror_file($index, $self->{mirror_file});
 }
 
 sub install_conservative {
diff --git a/lib/Carton/CLI.pm b/lib/Carton/CLI.pm
index e90353c..5e0ea1b 100644
--- a/lib/Carton/CLI.pm
+++ b/lib/Carton/CLI.pm
@@ -136,17 +136,21 @@ sub cmd_bundle {
 
     $self->parse_options(\@args, "p|path=s" => sub { $self->carton->{path} = 
$_[1] });
 
+    my $lock = $self->find_lock;
     my $local_mirror = $self->carton->local_mirror;
 
     $self->carton->configure(
-        mirror_file => $self->mirror_file, # $lock object?
+        lock => $lock,
+        mirror_file => $self->mirror_file,
     );
 
-    if (my $cpanfile = $self->has_cpanfile) {
+    my $cpanfile = $self->has_cpanfile;
+
+    if ($cpanfile && $lock) {
         $self->print("Bundling modules using $cpanfile\n");
         $self->carton->download_from_cpanfile($cpanfile, $local_mirror);
     } else {
-        $self->error("Can't locate build file\n");
+        $self->error("Can't locate cpanfile and lock file. Run carton install 
first\n");
     }
 
     $self->printf("Complete! Modules were bundled into %s\n", $local_mirror, 
SUCCESS);

-- 
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

Reply via email to