This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Module-Build to CPAN version 0.4200
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>
Tue, 12 Nov 2013 16:28:12 +0000 (16:28 +0000)
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>
Tue, 12 Nov 2013 16:42:17 +0000 (16:42 +0000)
  [DELTA]

0.4200 - Tue Nov 12 12:39:25 CET 2013

  - Released 0.40_11 as 0.4200

0.40_11 - Wed Nov  6 12:46:59 CET 2013

  [BUG FIXES]

  - Do not set provides in metadata if no_index is set [Leon Timmermans]

0.40_10 - Tue Nov  5 12:11:37 CET 2013

  [BUG FIXES]

  - Lowercase license in fallback logic [Leon Timmermans]

0.40_09 - Tue Nov  5 00:13:11 CET 2013

  [ENHANCEMENTS]

  - Converted to using Meta 2.0

31 files changed:
MANIFEST
Porting/Maintainers.pl
cpan/Module-Build/lib/Module/Build.pm
cpan/Module-Build/lib/Module/Build/Base.pm
cpan/Module-Build/lib/Module/Build/Compat.pm
cpan/Module-Build/lib/Module/Build/Config.pm
cpan/Module-Build/lib/Module/Build/ConfigData.pm
cpan/Module-Build/lib/Module/Build/Cookbook.pm
cpan/Module-Build/lib/Module/Build/Dumper.pm
cpan/Module-Build/lib/Module/Build/ModuleInfo.pm
cpan/Module-Build/lib/Module/Build/Notes.pm
cpan/Module-Build/lib/Module/Build/PPMMaker.pm
cpan/Module-Build/lib/Module/Build/Platform/Default.pm
cpan/Module-Build/lib/Module/Build/Platform/MacOS.pm
cpan/Module-Build/lib/Module/Build/Platform/Unix.pm
cpan/Module-Build/lib/Module/Build/Platform/VMS.pm
cpan/Module-Build/lib/Module/Build/Platform/VOS.pm
cpan/Module-Build/lib/Module/Build/Platform/Windows.pm
cpan/Module-Build/lib/Module/Build/Platform/aix.pm
cpan/Module-Build/lib/Module/Build/Platform/cygwin.pm
cpan/Module-Build/lib/Module/Build/Platform/darwin.pm
cpan/Module-Build/lib/Module/Build/Platform/os2.pm
cpan/Module-Build/lib/Module/Build/PodParser.pm
cpan/Module-Build/lib/inc/latest.pm
cpan/Module-Build/lib/inc/latest/private.pm
cpan/Module-Build/t/extend.t
cpan/Module-Build/t/metadata.t
cpan/Module-Build/t/properties/license.t
cpan/Module-Build/t/properties/requires.t
cpan/Module-Build/t/test_reqs.t [new file with mode: 0644]
t/porting/customized.dat

index 3f0400a..74db548 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -1627,6 +1627,7 @@ cpan/Module-Build/t/runthrough.t
 cpan/Module-Build/t/sample.t
 cpan/Module-Build/t/script_dist.t
 cpan/Module-Build/t/test_file_exts.t
+cpan/Module-Build/t/test_reqs.t
 cpan/Module-Build/t/test_types.t
 cpan/Module-Build/t/test_type.t
 cpan/Module-Build/t/tilde.t
index bb270bf..295f2ed 100755 (executable)
@@ -788,7 +788,7 @@ use File::Glob qw(:case);
     #
 
     'Module::Build' => {
-        'DISTRIBUTION' => 'LEONT/Module-Build-0.4008.tar.gz',
+        'DISTRIBUTION' => 'LEONT/Module-Build-0.4200.tar.gz',
         'FILES'        => q[cpan/Module-Build],
         'EXCLUDED'     => [
             qw( t/par.t
index ecc729e..aa0b093 100644 (file)
@@ -18,7 +18,7 @@ use Module::Build::Base;
 
 use vars qw($VERSION @ISA);
 @ISA = qw(Module::Build::Base);
-$VERSION = '0.4008';
+$VERSION = '0.4200';
 $VERSION = eval $VERSION;
 
 # Inserts the given module into the @ISA hierarchy between
index 24fcbd0..abd386f 100644 (file)
@@ -6,7 +6,7 @@ use strict;
 use vars qw($VERSION);
 use warnings;
 
-$VERSION = '0.4008';
+$VERSION = '0.4200';
 $VERSION = eval $VERSION;
 BEGIN { require 5.006001 }
 
@@ -1904,53 +1904,27 @@ sub create_mymeta {
   if ( $self->try_require("CPAN::Meta", "2.110420") ) {
     for my $file ( @metafiles ) {
       next unless -f $file;
-      $meta_obj = eval { CPAN::Meta->load_file($file) };
+      $meta_obj = eval { CPAN::Meta->load_file($file, { lazy_validation => 0 }) };
       last if $meta_obj;
     }
   }
 
   # maybe get a copy in spec v2 format (regardless of original source)
-  $mymeta = $meta_obj->as_struct
-    if $meta_obj;
 
+  my $mymeta_obj = $self->_get_meta_object(quiet => 0, dynamic => 0, fatal => 1, auto => 0);
   # if we have metadata, just update it
-  if ( defined $mymeta ) {
-    my $prereqs = $self->_normalize_prereqs;
-    # XXX refactor this mapping somewhere
-    $mymeta->{prereqs}{runtime}{requires} = $prereqs->{requires};
-    $mymeta->{prereqs}{build}{requires} = $prereqs->{build_requires};
-    $mymeta->{prereqs}{test}{requires} = $prereqs->{test_requires};
-    $mymeta->{prereqs}{runtime}{recommends} = $prereqs->{recommends};
-    $mymeta->{prereqs}{runtime}{conflicts} = $prereqs->{conflicts};
-    # delete empty entries
-    for my $phase ( keys %{$mymeta->{prereqs}} ) {
-      if ( ref $mymeta->{prereqs}{$phase} eq 'HASH' ) {
-        for my $type ( keys %{$mymeta->{prereqs}{$phase}} ) {
-          if ( ! defined $mymeta->{prereqs}{$phase}{$type}
-            || ! keys %{$mymeta->{prereqs}{$phase}{$type}}
-          ) {
-            delete $mymeta->{prereqs}{$phase}{$type};
-          }
-        }
-      }
-      if ( ! defined $mymeta->{prereqs}{$phase}
-        || ! keys %{$mymeta->{prereqs}{$phase}}
-      ) {
-        delete $mymeta->{prereqs}{$phase};
-      }
-    }
-    $mymeta->{dynamic_config} = 0;
-    $mymeta->{generated_by} = "Module::Build version $Module::Build::VERSION";
-    eval { $meta_obj = CPAN::Meta->new( $mymeta, { lazy_validation => 1 } ) }
-  }
-  # or generate from scratch, ignoring errors if META doesn't exist
-  else {
-    $meta_obj = $self->_get_meta_object(
-      quiet => 0, dynamic => 0, fatal => 0, auto => 0
+  if ($meta_obj && $mymeta_obj) {
+    my $prereqs = $mymeta_obj->effective_prereqs->with_merged_prereqs($meta_obj->effective_prereqs);
+    my %updated = (
+      %{ $meta_obj->as_struct({ version => 2.0 }) },
+      prereqs => $prereqs->as_string_hash,
+      dynamic_config => 0,
+      generated_by => "Module::Build version $Module::Build::VERSION",
     );
+    $mymeta_obj = CPAN::Meta->new( \%updated, { lazy_validation => 0 } );
   }
 
-  my @created = $self->_write_meta_files( $meta_obj, 'MYMETA' );
+  my @created = $self->_write_meta_files( $mymeta_obj, 'MYMETA' );
 
   $self->log_warn("Could not create MYMETA files\n")
     unless @created;
@@ -4567,7 +4541,7 @@ sub _get_meta_object {
       auto => $args{auto},
     );
     $data->{dynamic_config} = $args{dynamic} if defined $args{dynamic};
-    $meta = CPAN::Meta->create( $data );
+    $meta = CPAN::Meta->create($data);
   };
   if ($@ && ! $args{quiet}) {
     $self->log_warn(
@@ -4623,6 +4597,16 @@ sub normalize_version {
   return $version;
 }
 
+my %prereq_map = (
+  requires => [ qw/runtime requires/],
+  configure_requires => [qw/configure requires/],
+  build_requires => [ qw/build requires/ ],
+  test_requires => [ qw/test requires/ ],
+  test_recommends => [ qw/test recommends/ ],
+  recommends => [ qw/build recommends/ ],
+  conflicts => [ qw/build conflicts/ ],
+);
+
 sub _normalize_prereqs {
   my ($self) = @_;
   my $p = $self->{properties};
@@ -4630,46 +4614,97 @@ sub _normalize_prereqs {
   # copy prereq data structures so we can modify them before writing to META
   my %prereq_types;
   for my $type ( 'configure_requires', @{$self->prereq_action_types} ) {
-    if (exists $p->{$type}) {
+    if (exists $p->{$type} and keys %{ $p->{$type} }) {
+      my ($phase, $relation) = @{ $prereq_map{$type} };
       for my $mod ( keys %{ $p->{$type} } ) {
-        $prereq_types{$type}{$mod} =
-          $self->normalize_version($p->{$type}{$mod});
+        $prereq_types{$phase}{$relation}{$mod} = $self->normalize_version($p->{$type}{$mod});
       }
     }
   }
   return \%prereq_types;
 }
 
-# wrapper around old prepare_metadata API;
-sub get_metadata {
-  my ($self, %args) = @_;
-  my $metadata = {};
-  $self->prepare_metadata( $metadata, undef, \%args );
-  return $metadata;
+sub _get_license {
+  my $self = shift;
+
+  my $license = $self->license;
+  my ($meta_license, $meta_license_url);
+
+  my $valid_licenses = $self->valid_licenses();
+  if ( my $sl = $self->_software_license_object ) {
+    $meta_license = $sl->meta2_name;
+    $meta_license_url = $sl->url;
+  }
+  elsif ( exists $valid_licenses->{$license} ) {
+    $meta_license = $valid_licenses->{$license} ? lc $valid_licenses->{$license} : $license;
+    $meta_license_url = $self->_license_url( $license );
+  }
+  else {
+    $self->log_warn( "Can not determine license type for '" . $self->license
+      . "'\nSetting META license field to 'unknown'.\n");
+    $meta_license = 'unknown';
+  }
+  return ($meta_license, $meta_license_url);
 }
 
-# To preserve compatibility with old API, $node *must* be a hashref
-# passed in to prepare_metadata.  $keys is an arrayref holding a
-# list of keys -- it's use is optional and generally no longer needed
-# but kept for back compatibility.  $args is an optional parameter to
-# support the new 'fatal' toggle
+my %keep = map { $_ => 1 } qw/keywords dynamic_config provides no_index name version abstract/;
+my %ignore = map { $_ => 1 } qw/distribution_type/;
+my %reject = map { $_ => 1 } qw/private author license requires recommends build_requires configure_requires conflicts/;
 
-sub prepare_metadata {
-  my ($self, $node, $keys, $args) = @_;
-  unless ( ref $node eq 'HASH' ) {
-    croak "prepare_metadata() requires a hashref argument to hold output\n";
+sub _upconvert_resources {
+  my ($input) = @_;
+  my %output;
+  for my $key (keys %{$input}) {
+    my $out_key = $key =~ /^\p{Lu}/ ? "x_\l$key" : $key;
+    if ($key eq 'repository') {
+      my $name = $input->{$key} =~ m{ \A http s? :// .* (<! \.git ) \z }xms ? 'web' : 'url';
+      $output{$out_key} = { $name => $input->{$key} };
+    }
+    elsif ($key eq 'bugtracker') {
+      $output{$out_key} = { web => $input->{$key} }
+    }
+    else {
+      $output{$out_key} = $input->{$key};
+    }
   }
-  my $fatal = $args->{fatal} || 0;
-  my $p = $self->{properties};
+  return \%output
+}
+my %custom = (
+       resources => \&_upconvert_resources,
+);
 
-  $self->auto_config_requires if $args->{auto};
+sub _upconvert_metapiece {
+  my ($input, $type) = @_;
+  return $input if exists $input->{'meta-spec'} && $input->{'meta-spec'}{version} == 2;
 
-  # A little helper sub
-  my $add_node = sub {
-    my ($name, $val) = @_;
-    $node->{$name} = $val;
-    push @$keys, $name if $keys;
-  };
+  my %ret;
+  for my $key (keys %{$input}) {
+    if ($keep{$key}) {
+      $ret{$key} = $input->{$key};
+    }
+    elsif ($ignore{$key}) {
+      next;
+    }
+    elsif ($reject{$key}) {
+      croak "Can't $type $key, please use another mechanism";
+    }
+    elsif (my $converter = $custom{$key}) {
+      $ret{$key} = $converter->($input->{$key});
+    }
+    else {
+      warn "Unknown key $key\n" unless $key =~ / \A x_ /xi;
+    }
+  }
+  return \%ret;
+}
+
+sub get_metadata {
+  my ($self, %args) = @_;
+
+  my $fatal = $args{fatal} || 0;
+  my $p = $self->{properties};
+
+  $self->auto_config_requires if $args{auto};
 
   # validate required fields
   foreach my $f (qw(dist_name dist_version dist_author dist_abstract license)) {
@@ -4685,80 +4720,61 @@ sub prepare_metadata {
     }
   }
 
+  my %metadata = (
+    name => $self->dist_name,
+    version => $self->normalize_version($self->dist_version),
+    author => $self->dist_author,
+    abstract => $self->dist_abstract,
+    generated_by => "Module::Build version $Module::Build::VERSION",
+    'meta-spec' => {
+      version => '2',
+      url     => 'http://search.cpan.org/perldoc?CPAN::Meta::Spec',
+    },
+    dynamic_config => exists $p->{dynamic_config} ? $p->{dynamic_config} : 1,
+    release_status => $self->release_status,
+  );
 
-  # add dist_* fields
-  foreach my $f (qw(dist_name dist_version dist_author dist_abstract)) {
-    (my $name = $f) =~ s/^dist_//;
-    $add_node->($name, $self->$f());
-  }
-
-  # normalize version
-  $node->{version} = $self->normalize_version($node->{version});
-
-  # validate license information
-  my $license = $self->license;
-  my ($meta_license, $meta_license_url);
-
-  # XXX this is still meta spec version 1 stuff
-
-  # if Software::License::* exists, then we can use it to get normalized name
-  # for META files
-
-  if ( my $sl = $self->_software_license_object ) {
-    $meta_license = $sl->meta_name;
-    $meta_license_url = $sl->url;
-  }
-  elsif ( exists $self->valid_licenses()->{$license} ) {
-    $meta_license = $license;
-    $meta_license_url = $self->_license_url( $license );
-  }
-  else {
-  # if we didn't find a license from a Software::License class,
-  # then treat it as unknown
-    $self->log_warn( "Can not determine license type for '" . $self->license
-      . "'\nSetting META license field to 'unknown'.\n");
-    $meta_license = 'unknown';
-  }
-
-  $node->{license} = $meta_license;
-  $node->{resources}{license} = $meta_license_url if defined $meta_license_url;
+  my ($meta_license, $meta_license_url) = $self->_get_license;
+  $metadata{license} = [ $meta_license ];
+  $metadata{resources}{license} = [ $meta_license_url ] if defined $meta_license_url;
 
-  # add prerequisite data
-  my $prereqs = $self->_normalize_prereqs;
-  for my $t ( keys %$prereqs ) {
-      $add_node->($t, $prereqs->{$t});
-  }
+  $metadata{prereqs} = $self->_normalize_prereqs;
 
-  if (exists $p->{dynamic_config}) {
-    $add_node->('dynamic_config', $p->{dynamic_config});
-  }
-  my $pkgs = eval { $self->find_dist_packages };
-  if ($@) {
+  if (exists $p->{no_index}) {
+    $metadata{no_index} = $p->{no_index};
+  } elsif (my $pkgs = eval { $self->find_dist_packages }) {
+    $metadata{provides} = $pkgs if %$pkgs;
+  } else {
     $self->log_warn("$@\nWARNING: Possible missing or corrupt 'MANIFEST' file.\n" .
                     "Nothing to enter for 'provides' field in metafile.\n");
-  } else {
-    $node->{provides} = $pkgs if %$pkgs;
   }
-;
-  if (exists $p->{no_index}) {
-    $add_node->('no_index', $p->{no_index});
+
+  my $meta_add = _upconvert_metapiece($self->meta_add, 'add');
+  while (my($k, $v) = each %{$meta_add} ) {
+    $metadata{$k} = $v;
   }
 
-  $add_node->('generated_by', "Module::Build version $Module::Build::VERSION");
+  my $meta_merge = _upconvert_metapiece($self->meta_merge, 'merge');
+  while (my($k, $v) = each %{$meta_merge} ) {
+    $self->_hash_merge(\%metadata, $k, $v);
+  }
 
-  $add_node->('meta-spec',
-              {version => '1.4',
-               url     => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
-              });
+  return \%metadata;
+}
 
-  while (my($k, $v) = each %{$self->meta_add}) {
-    $add_node->($k, $v);
-  }
+# To preserve compatibility with old API, $node *must* be a hashref
+# passed in to prepare_metadata.  $keys is an arrayref holding a
+# list of keys -- it's use is optional and generally no longer needed
+# but kept for back compatibility.  $args is an optional parameter to
+# support the new 'fatal' toggle
 
-  while (my($k, $v) = each %{$self->meta_merge}) {
-    $self->_hash_merge($node, $k, $v);
+sub prepare_metadata {
+  my ($self, $node, $keys, $args) = @_;
+  unless ( ref $node eq 'HASH' ) {
+    croak "prepare_metadata() requires a hashref argument to hold output\n";
   }
-
+  croak 'Keys argument to prepare_metadata is no longer supported' if $keys;
+  %{$node} = %{ $self->get_meta(%{$args}) };
   return $node;
 }
 
index bb5f9eb..7843080 100644 (file)
@@ -2,7 +2,7 @@ package Module::Build::Compat;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.4008';
+$VERSION = '0.4200';
 
 use File::Basename ();
 use File::Spec;
index 53742e8..ce141f4 100644 (file)
@@ -2,7 +2,7 @@ package Module::Build::Config;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.4008';
+$VERSION = '0.4200';
 $VERSION = eval $VERSION;
 use Config;
 
index d55745c..a4b05fc 100644 (file)
@@ -167,12 +167,31 @@ do{ my $x = [
        {},
        {},
        {
+         'inc_bundling_support' => {
+                                     'description' => 'Bundle Module::Build in inc/',
+                                     'requires' => {
+                                                     'ExtUtils::Installed' => '1.999',
+                                                     'ExtUtils::Install' => '1.54'
+                                                   }
+                                   },
+         'license_creation' => {
+                                 'description' => 'Create licenses automatically in distributions',
+                                 'requires' => {
+                                                 'Software::License' => 0
+                                               }
+                               },
          'manpage_support' => {
+                                'description' => 'Create Unix man pages',
                                 'requires' => {
                                                 'Pod::Man' => 0
-                                              },
-                                'description' => 'Create Unix man pages'
+                                              }
                               },
+         'HTML_support' => {
+                             'description' => 'Create HTML documentation',
+                             'requires' => {
+                                             'Pod::Html' => 0
+                                           }
+                           },
          'dist_authoring' => {
                                'recommends' => {
                                                  'Module::Signature' => '0.21',
@@ -183,28 +202,9 @@ do{ my $x = [
                                                'Archive::Tar' => '1.09'
                                              }
                              },
-         'license_creation' => {
-                                 'requires' => {
-                                                 'Software::License' => 0
-                                               },
-                                 'description' => 'Create licenses automatically in distributions'
-                               },
          'PPM_support' => {
                             'description' => 'Generate PPM files for distributions'
-                          },
-         'inc_bundling_support' => {
-                                     'description' => 'Bundle Module::Build in inc/',
-                                     'requires' => {
-                                                     'ExtUtils::Installed' => '1.999',
-                                                     'ExtUtils::Install' => '1.54'
-                                                   }
-                                   },
-         'HTML_support' => {
-                             'requires' => {
-                                             'Pod::Html' => 0
-                                           },
-                             'description' => 'Create HTML documentation'
-                           }
+                          }
        }
      ];
 $x; }
\ No newline at end of file
index 24925bd..bbc7b5f 100644 (file)
@@ -1,7 +1,7 @@
 package Module::Build::Cookbook;
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.4008';
+$VERSION = '0.4200';
 
 
 =head1 NAME
index 58f89f2..20203c2 100644 (file)
@@ -1,7 +1,7 @@
 package Module::Build::Dumper;
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.4008';
+$VERSION = '0.4200';
 
 # This is just a split-out of a wrapper function to do Data::Dumper
 # stuff "the right way".  See:
index 118bd30..7b52cef 100644 (file)
@@ -4,7 +4,7 @@ package Module::Build::ModuleInfo;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.4008';
+$VERSION = '0.4200';
 $VERSION = eval $VERSION;
 
 require Module::Metadata;
index 11b65ce..def6b44 100644 (file)
@@ -4,7 +4,7 @@ package Module::Build::Notes;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.4008';
+$VERSION = '0.4200';
 $VERSION = eval $VERSION;
 use Data::Dumper;
 use Module::Build::Dumper;
index f526ee7..c698e95 100644 (file)
@@ -4,7 +4,7 @@ use strict;
 use Config;
 use vars qw($VERSION);
 
-$VERSION = '0.4008';
+$VERSION = '0.4200';
 $VERSION = eval $VERSION;
 
 # This code is mostly borrowed from ExtUtils::MM_Unix 6.10_03, with a
index 9daf521..0507600 100644 (file)
@@ -2,7 +2,7 @@ package Module::Build::Platform::Default;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.4008';
+$VERSION = '0.4200';
 $VERSION = eval $VERSION;
 use Module::Build::Base;
 
index 2f4eb09..4836626 100644 (file)
@@ -2,7 +2,7 @@ package Module::Build::Platform::MacOS;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.4008';
+$VERSION = '0.4200';
 $VERSION = eval $VERSION;
 use Module::Build::Base;
 use vars qw(@ISA);
index 9e32cf4..090db31 100644 (file)
@@ -2,7 +2,7 @@ package Module::Build::Platform::Unix;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.4008';
+$VERSION = '0.4200';
 $VERSION = eval $VERSION;
 use Module::Build::Base;
 
index d96148f..b707e0e 100644 (file)
@@ -2,7 +2,7 @@ package Module::Build::Platform::VMS;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.4008';
+$VERSION = '0.4200';
 $VERSION = eval $VERSION;
 use Module::Build::Base;
 use Config;
index 2152fcd..9627336 100644 (file)
@@ -2,7 +2,7 @@ package Module::Build::Platform::VOS;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.4008';
+$VERSION = '0.4200';
 $VERSION = eval $VERSION;
 use Module::Build::Base;
 
index d1ee9cd..9645f19 100644 (file)
@@ -2,7 +2,7 @@ package Module::Build::Platform::Windows;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.4008';
+$VERSION = '0.4200';
 $VERSION = eval $VERSION;
 
 use Config;
index be1f49d..d39d294 100644 (file)
@@ -2,7 +2,7 @@ package Module::Build::Platform::aix;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.4008';
+$VERSION = '0.4200';
 $VERSION = eval $VERSION;
 use Module::Build::Platform::Unix;
 
index a1e41b0..6584c84 100644 (file)
@@ -2,7 +2,7 @@ package Module::Build::Platform::cygwin;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.4008';
+$VERSION = '0.4200';
 $VERSION = eval $VERSION;
 use Module::Build::Platform::Unix;
 
index 8b29655..afe24ca 100644 (file)
@@ -2,7 +2,7 @@ package Module::Build::Platform::darwin;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.4008';
+$VERSION = '0.4200';
 $VERSION = eval $VERSION;
 use Module::Build::Platform::Unix;
 
index bf7c339..55b47e5 100644 (file)
@@ -2,7 +2,7 @@ package Module::Build::Platform::os2;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.4008';
+$VERSION = '0.4200';
 $VERSION = eval $VERSION;
 use Module::Build::Platform::Unix;
 
index f61286e..7c6777d 100644 (file)
@@ -2,7 +2,7 @@ package Module::Build::PodParser;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.4008';
+$VERSION = '0.4200';
 $VERSION = eval $VERSION;
 use vars qw(@ISA);
 
index e3546e4..28b1e4c 100644 (file)
@@ -4,7 +4,7 @@ use if $] >= 5.019, 'deprecate';
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.4008';
+$VERSION = '0.4200';
 $VERSION = eval $VERSION;
 
 use Carp;
index 1659d29..0a8953d 100644 (file)
@@ -4,7 +4,7 @@ use if $] >= 5.019, 'deprecate';
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.4008';
+$VERSION = '0.4200';
 $VERSION = eval $VERSION;
 
 use File::Spec;
index 505a473..62830c2 100644 (file)
@@ -2,7 +2,7 @@
 
 use strict;
 use lib 't/lib';
-use MBTest tests => 64;
+use MBTest tests => 63;
 
 blib_load('Module::Build');
 
@@ -183,23 +183,29 @@ print "Hello, World!\n";
   ok my $mb = Module::Build->new(
                                  module_name => $dist->name,
                                  license => 'perl',
-                                 meta_add => {foo => 'bar'},
+                                 meta_add => {abstract => 'bar'},
                                  conflicts => {'Foo::Barxx' => 0},
                                );
   my $data = $mb->get_metadata;
-  is $data->{foo}, 'bar';
+  is_deeply $data->{abstract}, 'bar';
 
-  $mb->meta_merge(foo => 'baz');
+  $mb->meta_merge(abstract => 'baz');
   $data = $mb->get_metadata;
-  is $data->{foo}, 'baz';
-
-  $mb->meta_merge(conflicts => {'Foo::Fooxx' => 0});
+  is_deeply $data->{abstract}, 'baz';
+
+  $mb->meta_merge(
+    'meta-spec' => { version => 2 },
+    prereqs => {
+      test => {
+        requirements => {
+          'Foo::Fooxx' => 0,
+        }
+      }
+    }
+  );
   $data = $mb->get_metadata;
-  is_deeply $data->{conflicts}, {'Foo::Barxx' => 0, 'Foo::Fooxx' => 0};
+  is_deeply $data->{prereqs}{test}{requirements}, { 'Foo::Fooxx' => 0 };
 
-  $mb->meta_add(conflicts => {'Foo::Bazxx' => 0});
-  $data = $mb->get_metadata;
-  is_deeply $data->{conflicts}, {'Foo::Bazxx' => 0, 'Foo::Fooxx' => 0};
 }
 
 {
index ce6d208..ae9a5af 100644 (file)
@@ -81,9 +81,9 @@ my $mb = Module::Build->new_from_context;
   is $node->{version}, $metadata{dist_version};
   is $node->{abstract}, $metadata{dist_abstract};
   is_deeply $node->{author}, $metadata{dist_author};
-  is $node->{license}, $metadata{license};
-  is_deeply $node->{configure_requires}, $mb_config_req, 'Add M::B to configure_requires';
-  is_deeply $node->{test_requires}, {
+  is_deeply $node->{license}, [ 'perl_5' ];
+  is_deeply $node->{prereqs}{configure}{requires}, $mb_config_req, 'Add M::B to configure_requires';
+  is_deeply $node->{prereqs}{test}{requires}, {
       'Test::More' => '0.49',
   }, 'Test::More was required by ->new';
   like $node->{generated_by}, qr{Module::Build};
@@ -102,7 +102,7 @@ my $mb = Module::Build->new_from_context;
 
 
   # exists() doesn't seem to work here
-  is_deeply $node->{configure_requires}, $mb_prereq, 'Add M::B to configure_requires';
+  is_deeply $node->{prereqs}{configure}{requires}, $mb_prereq, 'Add M::B to configure_requires';
 }
 
 $dist->clean;
index db63b39..bb7247e 100644 (file)
@@ -30,8 +30,8 @@ blib_load('Module::Build');
 
   my $meta = $mb->get_metadata( fatal => 0 );
   
-  is( $meta->{license} => 'perl', "META license will be 'perl'" );
-  is( $meta->{resources}{license}, "http://dev.perl.org/licenses/"
+  is_deeply( $meta->{license} => [ 'perl_5' ], "META license will be 'perl'" );
+  is_deeply( $meta->{resources}{license}, [ "http://dev.perl.org/licenses/" ]
     "META license URL is correct" 
   );
 
@@ -55,8 +55,8 @@ blib_load('Module::Build');
 
   my $meta = $mb->get_metadata( fatal => 0 );
   
-  is( $meta->{license} => 'unrestricted', "META license will be 'unrestricted'" );
-  is( $meta->{resources}{license}, "http://example.com/vaporware/"
+  is_deeply( $meta->{license} => [ 'unrestricted' ], "META license will be 'unrestricted'" );
+  is_deeply( $meta->{resources}{license}, [ "http://example.com/vaporware/" ]
     "META license URL is correct" 
   );
 
index 72a2e6d..6511e80 100644 (file)
@@ -31,7 +31,7 @@ $mb = $dist->new_from_context();
 isa_ok( $mb, "Module::Build" );
 
 $prereqs = $mb->_normalize_prereqs;
-is($prereqs->{requires}{'File::Basename'}, 0, "undef prereq converted to 0");
+is($prereqs->{runtime}{requires}{'File::Basename'}, 0, "undef prereq converted to 0");
 
 #--------------------------------------------------------------------------#
 # try empty string prereq version
@@ -48,7 +48,7 @@ $mb = $dist->new_from_context();
 isa_ok( $mb, "Module::Build" );
 
 $prereqs = $mb->_normalize_prereqs;
-is($prereqs->{requires}{'File::Basename'}, 0, "empty string prereq converted to 0");
+is($prereqs->{runtime}{requires}{'File::Basename'}, 0, "empty string prereq converted to 0");
 
 
 # vim:ts=2:sw=2:et:sta:sts=2
diff --git a/cpan/Module-Build/t/test_reqs.t b/cpan/Module-Build/t/test_reqs.t
new file mode 100644 (file)
index 0000000..bd04f86
--- /dev/null
@@ -0,0 +1,52 @@
+#!/usr/bin/perl -w
+
+use strict;
+use lib 't/lib';
+use MBTest;
+use CPAN::Meta 2.110420;
+use CPAN::Meta::YAML;
+use Parse::CPAN::Meta 1.4401;
+plan tests => 4;
+
+blib_load('Module::Build');
+
+my $tmp = MBTest->tmpdir;
+
+use DistGen;
+my $dist = DistGen->new( dir => $tmp );
+$dist->change_file('Build.PL', <<"---");
+use strict;
+use Module::Build;
+
+my \$builder = Module::Build->new(
+  module_name => '$dist->{name}',
+  license => 'perl',
+  requires => {
+    'File::Spec' => 0,
+  },
+  test_requires => {
+    'Test::More' => 0,
+  }
+);
+
+\$builder->create_build_script();
+---
+$dist->regen;
+$dist->chdir_in;
+$dist->run_build_pl;
+my $output = stdout_stderr_of sub { $dist->run_build('distmeta') };
+
+for my $file ( qw/MYMETA META/ ) {
+    my $meta = Parse::CPAN::Meta->load_file($file.".json");
+    is_deeply($meta->{prereqs}->{runtime},{
+        requires => {
+            'File::Spec' => '0',
+        }
+    }, "runtime prereqs in $file");
+    is_deeply($meta->{prereqs}->{test},{
+        requires => {
+            'Test::More' => '0',
+        }
+    }, "test prereqs in $file");
+}
+
index acd8039..73348c0 100644 (file)
@@ -1,5 +1,5 @@
 Digest::MD5 cpan/Digest-MD5/t/files.t bdbe05b705d9da305fedce7a9f4b6ba63250c7cf
-Module::Build cpan/Module-Build/lib/Module/Build/ConfigData.pm 59addfa9ac0720c45c70e53cb272ec8e66cc8b69
+Module::Build cpan/Module-Build/lib/Module/Build/ConfigData.pm 54bfd616386ac55206acd179ee80d29c8cef17d1
 PerlIO::via::QuotedPrint cpan/PerlIO-via-QuotedPrint/t/QuotedPrint.t ca39f0146e89de02c746e199c45dcb3e5edad691
 Text::Balanced cpan/Text-Balanced/t/01_compile.t 1598cf491a48fa546260a2ec41142abe84da533d
 Text::Balanced cpan/Text-Balanced/t/02_extbrk.t 6ba1b64a4604e822dc2260b8ffcea6b406339ee8