[carton] 171/472: Do not build extra dependencies out of carton.lock. Fix #63

Lucas Kanashiro kanashiro-guest at moszumanska.debian.org
Fri Jul 24 00:38:44 UTC 2015


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

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

commit d5479fc1f3d2effd1bb2016942feed08efe738f4
Author: Tatsuhiko Miyagawa <miyagawa at bulknews.net>
Date:   Tue Feb 5 12:15:54 2013 -0800

    Do not build extra dependencies out of carton.lock. Fix #63
    
    Even in the deployment mode, do not build deps out of .lock. Just do
    so out of cpanfile, then using .lock to create 02packages mirror
    definition without cascading.
    
    This is a big behavior change, but this is more correct in terms of
    what carton should do in the deployment mode.
    
    There's still a tree building code for `carton tree` command which
    should be rewritten in the same way.
---
 lib/Carton.pm     | 22 +++-------------------
 lib/Carton/CLI.pm | 14 +++++++-------
 2 files changed, 10 insertions(+), 26 deletions(-)

diff --git a/lib/Carton.pm b/lib/Carton.pm
index 9b8adc9..06a28f4 100644
--- a/lib/Carton.pm
+++ b/lib/Carton.pm
@@ -45,16 +45,10 @@ sub download_from_cpanfile {
 }
 
 sub install_from_cpanfile {
-    my($self, $file) = @_;
+    my($self, $file, $cascade) = @_;
 
-    my @modules;
-    if ($self->lock) {
-        my $tree = $self->build_tree($self->lock->{modules});
-        push @modules, map $_->spec, $tree->children;
-    }
-
-    push @modules, $self->list_dependencies;
-    $self->install_conservative(\@modules, 1)
+    my @modules = $self->list_dependencies;
+    $self->install_conservative(\@modules, $cascade)
         or die "Installing modules failed\n";
 }
 
@@ -72,16 +66,6 @@ sub list_dependencies {
     return map "$_~$hash->{$_}", keys %$hash; # TODO refactor to not rely on string representation
 }
 
-sub install_from_lock {
-    my($self) = @_;
-
-    my $tree = $self->build_tree($self->lock->{modules});
-    my @root = map $_->spec, $tree->children;
-
-    $self->install_conservative(\@root, 0)
-        or die "Installing modules failed\n";
-}
-
 sub dedupe_modules {
     my($self, $modules) = @_;
 
diff --git a/lib/Carton/CLI.pm b/lib/Carton/CLI.pm
index 90a1b78..e90353c 100644
--- a/lib/Carton/CLI.pm
+++ b/lib/Carton/CLI.pm
@@ -173,15 +173,15 @@ sub cmd_install {
 
     my $cpanfile = $self->has_cpanfile;
 
-    if ($self->{deployment} or not $cpanfile) {
-        $self->print("Installing modules using carton.lock (deployment mode)\n");
-        $self->carton->install_from_lock;
-    } elsif ($cpanfile) {
-        $self->print("Installing modules using $cpanfile\n");
+    if (!$cpanfile) {
+        $self->error("Can't locate cpanfile.\n");
+    } elsif ($self->{deployment}) {
+        $self->print("Installing modules using $cpanfile (deployment mode)\n");
         $self->carton->install_from_cpanfile($cpanfile);
-        $self->carton->update_lock_file($self->lock_file);
     } else {
-        $self->error("Can't locate build file or carton.lock\n");
+        $self->print("Installing modules using $cpanfile\n");
+        $self->carton->install_from_cpanfile($cpanfile, 1);
+        $self->carton->update_lock_file($self->lock_file);
     }
 
     $self->printf("Complete! Modules were installed into %s\n", $self->carton->{path}, SUCCESS);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/carton.git



More information about the Pkg-perl-cvs-commits mailing list