Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #45 from masaki/master

unused Module::Metadata
  • Loading branch information...
commit d9c90ee090e618d28bac30933a1b120a64c23a64 2 parents 65b4a6c + f21d7fb
@miyagawa miyagawa authored
Showing with 10 additions and 38 deletions.
  1. +0 −2  cpanfile
  2. +6 −35 lib/Carton.pm
  3. +4 −1 lib/Carton/CLI.pm
View
2  cpanfile
@@ -19,8 +19,6 @@ requires 'CPAN::Meta', 2.120921;
requires 'CPAN::Meta::Requirements', 2.121;
# bundle DarkPAN support
-requires 'File::chdir';
-requires 'Dist::Metadata';
requires 'IO::Compress::Gzip';
on 'develop' => sub {
View
41 lib/Carton.pm
@@ -10,7 +10,6 @@ use Config qw(%Config);
use Carton::Util;
use CPAN::Meta;
use File::Path ();
-use File::Basename ();
use File::Spec ();
use File::Temp ();
use Capture::Tiny 'capture';
@@ -104,6 +103,7 @@ sub download_conservative {
my $mirror = $self->{mirror} || $DefaultMirror;
local $self->{path} = File::Temp::tempdir(CLEANUP => 1); # ignore installed
+
$self->run_cpanm(
"--mirror", $mirror,
"--mirror", "http://backpan.perl.org/", # fallback
@@ -111,10 +111,14 @@ sub download_conservative {
( $mirror ne $DefaultMirror ? "--mirror-only" : () ),
( $cascade ? "--cascade-search" : () ),
"--scandeps",
- "--format", "dists",
"--save-dists", $dir,
@$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 {
@@ -208,28 +212,6 @@ sub build_index {
return $index;
}
-sub build_mirror_index {
- my($self, $local_mirror) = @_;
-
- require File::chdir;
- require Dist::Metadata;
-
- my $index = {};
-
- local $File::chdir::CWD = "$local_mirror/authors/id";
-
- for my $file (<*/*/*/*>) { # D/DU/DUMMY/Foo-Bar-0.01.tar.gz
- my $dist = Dist::Metadata->new(file => $file);
-
- my $provides = $dist->package_versions;
- while (my($package, $version) = each %$provides) {
- $index->{$package} = { version => $version, meta => { pathname => $file } };
- }
- };
-
- return $index;
-}
-
sub is_core {
my($self, $module, $want_ver, $perl_version) = @_;
$perl_version ||= $];
@@ -339,17 +321,6 @@ sub run_cpanm {
!system "cpanm", "--quiet", "-L", $self->{path}, "--notest", @args;
}
-sub update_mirror_index {
- my($self, $local_mirror) = @_;
-
- my $index = $self->build_mirror_index($local_mirror);
-
- my $file = "$local_mirror/modules/02packages.details.txt.gz";
- File::Path::mkpath(File::Basename::dirname($file));
- $self->build_mirror_file($index, $file)
- or die "Bundling modules failed\n";
-}
-
sub update_lock_file {
my($self, $file) = @_;
View
5 lib/Carton/CLI.pm
@@ -138,10 +138,13 @@ sub cmd_bundle {
my $local_mirror = $self->carton->local_mirror;
+ $self->carton->configure(
+ mirror_file => $self->mirror_file, # $lock object?
+ );
+
if (my $cpanfile = $self->has_cpanfile) {
$self->print("Bundling modules using $cpanfile\n");
$self->carton->download_from_cpanfile($cpanfile, $local_mirror);
- $self->carton->update_mirror_index($local_mirror);
} else {
$self->error("Can't locate build file\n");
}
Please sign in to comment.
Something went wrong with that request. Please try again.