diff options
author | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2013-11-12 16:28:12 +0000 |
---|---|---|
committer | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2013-11-12 16:42:17 +0000 |
commit | 18b2aa6a0d8618a3be3fe009940a585eddae1e52 (patch) | |
tree | 9ca7475fd3035f8872f4d226ffd207f59c85ec30 /cpan/Module-Build | |
parent | 3a4b75f8383799032432373d6d0037d290ffbd8c (diff) | |
download | perl-18b2aa6a0d8618a3be3fe009940a585eddae1e52.tar.gz |
Update Module-Build to CPAN version 0.4200
[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
Diffstat (limited to 'cpan/Module-Build')
28 files changed, 266 insertions, 192 deletions
diff --git a/cpan/Module-Build/lib/Module/Build.pm b/cpan/Module-Build/lib/Module/Build.pm index ecc729e79c..aa0b093502 100644 --- a/cpan/Module-Build/lib/Module/Build.pm +++ b/cpan/Module-Build/lib/Module/Build.pm @@ -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 diff --git a/cpan/Module-Build/lib/Module/Build/Base.pm b/cpan/Module-Build/lib/Module/Build/Base.pm index 24fcbd0850..abd386fdbf 100644 --- a/cpan/Module-Build/lib/Module/Build/Base.pm +++ b/cpan/Module-Build/lib/Module/Build/Base.pm @@ -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; } diff --git a/cpan/Module-Build/lib/Module/Build/Compat.pm b/cpan/Module-Build/lib/Module/Build/Compat.pm index bb5f9ebd72..7843080f67 100644 --- a/cpan/Module-Build/lib/Module/Build/Compat.pm +++ b/cpan/Module-Build/lib/Module/Build/Compat.pm @@ -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; diff --git a/cpan/Module-Build/lib/Module/Build/Config.pm b/cpan/Module-Build/lib/Module/Build/Config.pm index 53742e8ee9..ce141f45e6 100644 --- a/cpan/Module-Build/lib/Module/Build/Config.pm +++ b/cpan/Module-Build/lib/Module/Build/Config.pm @@ -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; diff --git a/cpan/Module-Build/lib/Module/Build/ConfigData.pm b/cpan/Module-Build/lib/Module/Build/ConfigData.pm index d55745cb6d..a4b05fc030 100644 --- a/cpan/Module-Build/lib/Module/Build/ConfigData.pm +++ b/cpan/Module-Build/lib/Module/Build/ConfigData.pm @@ -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 diff --git a/cpan/Module-Build/lib/Module/Build/Cookbook.pm b/cpan/Module-Build/lib/Module/Build/Cookbook.pm index 24925bd3b8..bbc7b5f24f 100644 --- a/cpan/Module-Build/lib/Module/Build/Cookbook.pm +++ b/cpan/Module-Build/lib/Module/Build/Cookbook.pm @@ -1,7 +1,7 @@ package Module::Build::Cookbook; use strict; use vars qw($VERSION); -$VERSION = '0.4008'; +$VERSION = '0.4200'; =head1 NAME diff --git a/cpan/Module-Build/lib/Module/Build/Dumper.pm b/cpan/Module-Build/lib/Module/Build/Dumper.pm index 58f89f2330..20203c2e0c 100644 --- a/cpan/Module-Build/lib/Module/Build/Dumper.pm +++ b/cpan/Module-Build/lib/Module/Build/Dumper.pm @@ -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: diff --git a/cpan/Module-Build/lib/Module/Build/ModuleInfo.pm b/cpan/Module-Build/lib/Module/Build/ModuleInfo.pm index 118bd3014d..7b52cefc0e 100644 --- a/cpan/Module-Build/lib/Module/Build/ModuleInfo.pm +++ b/cpan/Module-Build/lib/Module/Build/ModuleInfo.pm @@ -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; diff --git a/cpan/Module-Build/lib/Module/Build/Notes.pm b/cpan/Module-Build/lib/Module/Build/Notes.pm index 11b65ceed7..def6b44db2 100644 --- a/cpan/Module-Build/lib/Module/Build/Notes.pm +++ b/cpan/Module-Build/lib/Module/Build/Notes.pm @@ -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; diff --git a/cpan/Module-Build/lib/Module/Build/PPMMaker.pm b/cpan/Module-Build/lib/Module/Build/PPMMaker.pm index f526ee7799..c698e9541e 100644 --- a/cpan/Module-Build/lib/Module/Build/PPMMaker.pm +++ b/cpan/Module-Build/lib/Module/Build/PPMMaker.pm @@ -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 diff --git a/cpan/Module-Build/lib/Module/Build/Platform/Default.pm b/cpan/Module-Build/lib/Module/Build/Platform/Default.pm index 9daf521982..0507600753 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/Default.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/Default.pm @@ -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; diff --git a/cpan/Module-Build/lib/Module/Build/Platform/MacOS.pm b/cpan/Module-Build/lib/Module/Build/Platform/MacOS.pm index 2f4eb0962d..4836626703 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/MacOS.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/MacOS.pm @@ -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); diff --git a/cpan/Module-Build/lib/Module/Build/Platform/Unix.pm b/cpan/Module-Build/lib/Module/Build/Platform/Unix.pm index 9e32cf466f..090db31760 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/Unix.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/Unix.pm @@ -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; diff --git a/cpan/Module-Build/lib/Module/Build/Platform/VMS.pm b/cpan/Module-Build/lib/Module/Build/Platform/VMS.pm index d96148f215..b707e0e028 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/VMS.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/VMS.pm @@ -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; diff --git a/cpan/Module-Build/lib/Module/Build/Platform/VOS.pm b/cpan/Module-Build/lib/Module/Build/Platform/VOS.pm index 2152fcdd64..962733675d 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/VOS.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/VOS.pm @@ -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; diff --git a/cpan/Module-Build/lib/Module/Build/Platform/Windows.pm b/cpan/Module-Build/lib/Module/Build/Platform/Windows.pm index d1ee9cda87..9645f19637 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/Windows.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/Windows.pm @@ -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; diff --git a/cpan/Module-Build/lib/Module/Build/Platform/aix.pm b/cpan/Module-Build/lib/Module/Build/Platform/aix.pm index be1f49df89..d39d2944b0 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/aix.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/aix.pm @@ -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; diff --git a/cpan/Module-Build/lib/Module/Build/Platform/cygwin.pm b/cpan/Module-Build/lib/Module/Build/Platform/cygwin.pm index a1e41b0483..6584c849ea 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/cygwin.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/cygwin.pm @@ -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; diff --git a/cpan/Module-Build/lib/Module/Build/Platform/darwin.pm b/cpan/Module-Build/lib/Module/Build/Platform/darwin.pm index 8b2965506c..afe24caf60 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/darwin.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/darwin.pm @@ -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; diff --git a/cpan/Module-Build/lib/Module/Build/Platform/os2.pm b/cpan/Module-Build/lib/Module/Build/Platform/os2.pm index bf7c339931..55b47e54b1 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/os2.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/os2.pm @@ -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; diff --git a/cpan/Module-Build/lib/Module/Build/PodParser.pm b/cpan/Module-Build/lib/Module/Build/PodParser.pm index f61286ea54..7c6777dae6 100644 --- a/cpan/Module-Build/lib/Module/Build/PodParser.pm +++ b/cpan/Module-Build/lib/Module/Build/PodParser.pm @@ -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); diff --git a/cpan/Module-Build/lib/inc/latest.pm b/cpan/Module-Build/lib/inc/latest.pm index e3546e4da7..28b1e4c54f 100644 --- a/cpan/Module-Build/lib/inc/latest.pm +++ b/cpan/Module-Build/lib/inc/latest.pm @@ -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; diff --git a/cpan/Module-Build/lib/inc/latest/private.pm b/cpan/Module-Build/lib/inc/latest/private.pm index 1659d29a2f..0a8953d33b 100644 --- a/cpan/Module-Build/lib/inc/latest/private.pm +++ b/cpan/Module-Build/lib/inc/latest/private.pm @@ -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; diff --git a/cpan/Module-Build/t/extend.t b/cpan/Module-Build/t/extend.t index 505a47360c..62830c24e7 100644 --- a/cpan/Module-Build/t/extend.t +++ b/cpan/Module-Build/t/extend.t @@ -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}; } { diff --git a/cpan/Module-Build/t/metadata.t b/cpan/Module-Build/t/metadata.t index ce6d208645..ae9a5af003 100644 --- a/cpan/Module-Build/t/metadata.t +++ b/cpan/Module-Build/t/metadata.t @@ -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; diff --git a/cpan/Module-Build/t/properties/license.t b/cpan/Module-Build/t/properties/license.t index db63b3951b..bb7247e2c5 100644 --- a/cpan/Module-Build/t/properties/license.t +++ b/cpan/Module-Build/t/properties/license.t @@ -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" ); diff --git a/cpan/Module-Build/t/properties/requires.t b/cpan/Module-Build/t/properties/requires.t index 72a2e6d9ab..6511e80169 100644 --- a/cpan/Module-Build/t/properties/requires.t +++ b/cpan/Module-Build/t/properties/requires.t @@ -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 index 0000000000..bd04f8679a --- /dev/null +++ b/cpan/Module-Build/t/test_reqs.t @@ -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"); +} + |