Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

modulelist option now works

  • Loading branch information...
commit 6d70643c5feff604079d4003f8d24eb36c01906d 1 parent f78a138
Dann authored
4  conf/modules.list
... ...
@@ -1,2 +1,2 @@
1  
-Mouse
2  
-HTTP::Engine
  1
+Linux::Smaps
  2
+FindBin::libs
21  lib/CPAN/Packager.pm
@@ -106,7 +106,9 @@ sub make {
106 106
     die 'module must be passed' unless $module;
107 107
     INFO("### Building packages for $module ...");
108 108
     my $config = $self->config_loader->load( $self->conf );
109  
-    $config->{modules} = $built_modules if $built_modules;
  109
+    if($built_modules) {
  110
+        $config = $self->merge_config( $built_modules, $config );
  111
+    }
110 112
     $config->{global}->{verbose} = $self->verbose;
111 113
 
112 114
     INFO("### Analyzing dependencies for $module ...");
@@ -199,10 +201,19 @@ sub build_modules {
199 201
             die("$module->{module} failed");
200 202
         }
201 203
     }
202  
-    my %modules
203  
-        = map { exists $_->{module} ? { $_->{module} => $_ } : $_ => $_; }
204  
-        @{$modules};
205  
-    return \%modules;
  204
+
  205
+    my $built_modules = {};
  206
+    foreach my $module (@{$modules}) {
  207
+        if(exists $module->{module}) {
  208
+            $built_modules->{$module->{module}} = $module; 
  209
+        } elsif (exists $module->{original_module}) {
  210
+            $built_modules->{$module->{original_module}} = $module; 
  211
+        } else {
  212
+            $built_modules->{$module} = $module;
  213
+        }
  214
+    }
  215
+
  216
+    return $built_modules; 
206 217
 }
207 218
 
208 219
 sub analyze_module_dependencies {
22  lib/CPAN/Packager/FileUtil.pm
@@ -5,7 +5,7 @@ use base qw(Exporter);
5 5
 use File::Spec;
6 6
 use IO::File ();
7 7
 
8  
-our @EXPORT = qw(file dir openw);
  8
+our @EXPORT = qw(file dir openw slurp openr);
9 9
 
10 10
 sub file {
11 11
     File::Spec->catfile(@_);
@@ -22,6 +22,26 @@ sub openw {
22 22
     return $io;
23 23
 }
24 24
 
  25
+sub openr {
  26
+    my $file = shift;
  27
+    my $io = IO::File->new;
  28
+    $io->open($file, 'r') or die "Can't read $file: $!";
  29
+    return $io;
  30
+}
  31
+
  32
+
  33
+sub slurp {
  34
+  my ($file, $args) = @_;
  35
+  my $fh = openr($file);
  36
+    if ($args->{chomp}) {
  37
+    chomp( my @data = <$fh> );
  38
+    return wantarray ? @data : join '', @data;
  39
+  }
  40
+
  41
+  local $/ unless wantarray;
  42
+  return <$fh>;
  43
+}
  44
+
25 45
 1;
26 46
 __END__
27 47
 
5  lib/CPAN/Packager/Script.pm
... ...
@@ -1,7 +1,7 @@
1 1
 package CPAN::Packager::Script;
2 2
 use Mouse;
3 3
 use CPAN::Packager;
4  
-use CPAN::Packager::FileUtil qw(dir file);
  4
+use CPAN::Packager::FileUtil qw(dir file slurp);
5 5
 
6 6
 with 'MouseX::Getopt';
7 7
 
@@ -68,7 +68,8 @@ sub run {
68 68
     );
69 69
 
70 70
     if ( $self->modulelist ) {
71  
-        my @modules = file( $self->modulelist )->slurp( chomp => 1 );
  71
+        my $module_list = file( $self->modulelist );
  72
+        my @modules = slurp($module_list, {chomp=>1});
72 73
         @modules = grep { $_ !~ /^#/ } @modules;
73 74
         my $built_modules;
74 75
         foreach my $module (@modules) {

0 notes on commit 6d70643

Please sign in to comment.
Something went wrong with that request. Please try again.