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

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

commit 3181646de25a4a494ebbd4ebf2e22269435a9f3e
Author: Tatsuhiko Miyagawa <miyag...@bulknews.net>
Date:   Sun Jun 26 15:24:21 2011 -0700

    Fix the first run without carton.lock
---
 lib/Carton.pm | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/lib/Carton.pm b/lib/Carton.pm
index 4adefd3..f3056f6 100644
--- a/lib/Carton.pm
+++ b/lib/Carton.pm
@@ -81,14 +81,16 @@ sub install_conservative {
 
     $modules = $self->dedupe_modules($modules);
 
-    my $index = $self->build_index($self->lock->{modules});
-    $self->build_mirror_file($index, $self->{mirror_file});
+    if ($self->lock) {
+        my $index = $self->build_index($self->lock->{modules});
+        $self->build_mirror_file($index, $self->{mirror_file});
+    }
 
     $self->run_cpanm(
         "--skip-satisfied",
         "--mirror", "http://cpan.cpantesters.org/";, # fastest
         "--mirror", "http://backpan.perl.org/";,     # fallback
-        "--mirror-index", $self->{mirror_file},
+        ( $self->lock ? ("--mirror-index", $self->{mirror_file}) : () ),
         ( $cascade ? "--cascade-search" : () ),
         @$modules,
     );
@@ -249,19 +251,25 @@ sub run_cpanm {
 sub update_lock_file {
     my($self, $file) = @_;
 
+    my $lock = $self->build_lock;
+
+    require JSON;
+    open my $fh, ">", "carton.lock" or die $!;
+    print $fh JSON->new->pretty->encode($lock);
+
+    return 1;
+}
+
+sub build_lock {
+    my $self = shift;
+
     my %locals = $self->find_locals;
 
-    my $spec = {
+    return {
         modules => \%locals,
         perl => $],
         generator => "carton $VERSION",
     };
-
-    require JSON;
-    open my $fh, ">", "carton.lock" or die $!;
-    print $fh JSON->new->pretty->encode($spec);
-
-    return 1;
 }
 
 sub find_locals {

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