Permalink
Browse files

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.
  • Loading branch information...
1 parent 8e3bf57 commit d5479fc1f3d2effd1bb2016942feed08efe738f4 @miyagawa miyagawa committed Feb 5, 2013
Showing with 10 additions and 26 deletions.
  1. +3 −19 lib/Carton.pm
  2. +7 −7 lib/Carton/CLI.pm
View
@@ -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) = @_;
View
@@ -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);

0 comments on commit d5479fc

Please sign in to comment.