[carton] 53/472: Fix the first run without carton.lock
Lucas Kanashiro
kanashiro-guest at moszumanska.debian.org
Fri Jul 24 00:38:32 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 3181646de25a4a494ebbd4ebf2e22269435a9f3e
Author: Tatsuhiko Miyagawa <miyagawa at 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
More information about the Pkg-perl-cvs-commits
mailing list