From 5bc9579e19a19164d880cf1d66db5f908d4a64c7 Mon Sep 17 00:00:00 2001 From: Chris 'BinGOs' Williams Date: Wed, 18 May 2011 12:27:08 +0100 Subject: [PATCH] Update CPAN-Meta to CPAN version 2.110930 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit [DELTA] 2.110930 2011-04-02 23:31:24 America/New_York [BUGFIX] - Fixed a bug in the 'as_string' method that checked the module version instead of the meta-spec version when conversion was requested (RT #67188) 2.110910 2011-04-01 08:55:30 America/New_York [ENHANCEMENTS] - The 1.x spec "gpl" and "lgpl" and "mozilla" license values now up-convert to "open_source" because they indicate too non-specific a license. 2.110580 2011-02-27 07:58:06 EST5EDT [OTHER] - Add explicit dependencies on JSON::PP and CPAN::Meta::YAML instead of relying on Parse::CPAN::Meta to provide them (as some CPAN Testers have had P::C::M installed without them somehow) - Removed dependency on Storable as it was not a core module until Perl 5.8 2.110550 2011-02-24 07:17:57 EST5EDT [OTHER] - Added required field 'release_status' to the synopsis of CPAN::Meta::Spec (RT#66118) [Oliver Mengué] 2.110540 2011-02-23 15:21:16 EST5EDT [BUGFIX] - Had two different Parse::CPAN::Meta requirements, one in 'requires' and the other in 'build_requires'. This confused some installers, so we only inlude the 'requires' now. --- MANIFEST | 1 + Porting/Maintainers.pl | 2 +- cpan/CPAN-Meta/Changes | 41 +++++++++++++++++++++++++++++++ cpan/CPAN-Meta/lib/CPAN/Meta.pm | 28 ++++++++++++--------- cpan/CPAN-Meta/lib/CPAN/Meta/Converter.pm | 35 +++++++++++++++++--------- cpan/CPAN-Meta/lib/CPAN/Meta/Feature.pm | 4 +-- cpan/CPAN-Meta/lib/CPAN/Meta/History.pm | 4 +-- cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm | 4 +-- cpan/CPAN-Meta/lib/CPAN/Meta/Spec.pm | 5 ++-- cpan/CPAN-Meta/lib/CPAN/Meta/Validator.pm | 4 +-- cpan/CPAN-Meta/t/converter.t | 17 +++++++++++-- cpan/CPAN-Meta/t/data/gpl-1_4.yml | 20 +++++++++++++++ 12 files changed, 128 insertions(+), 37 deletions(-) create mode 100644 cpan/CPAN-Meta/t/data/gpl-1_4.yml diff --git a/MANIFEST b/MANIFEST index 90fb130..b89b5d4 100644 --- a/MANIFEST +++ b/MANIFEST @@ -345,6 +345,7 @@ cpan/CPAN-Meta/t/data-fail/META-1_2.yml cpan/CPAN-Meta/t/data-fail/META-1_3.yml cpan/CPAN-Meta/t/data-fail/META-1_4.yml cpan/CPAN-Meta/t/data-fail/META-2.json +cpan/CPAN-Meta/t/data/gpl-1_4.yml cpan/CPAN-Meta/t/data/META-1_0.yml cpan/CPAN-Meta/t/data/META-1_1.yml cpan/CPAN-Meta/t/data/META-1_2.yml diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index a6cd0cd..e6a19d9 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -488,7 +488,7 @@ use File::Glob qw(:case); 'CPAN::Meta' => { 'MAINTAINER' => 'dagolden', - 'DISTRIBUTION' => 'DAGOLDEN/CPAN-Meta-2.110440.tar.gz', + 'DISTRIBUTION' => 'DAGOLDEN/CPAN-Meta-2.110930.tar.gz', 'FILES' => q[cpan/CPAN-Meta], 'EXCLUDED' => [ qr/^xt/, diff --git a/cpan/CPAN-Meta/Changes b/cpan/CPAN-Meta/Changes index 7dabb94..e155cc3 100644 --- a/cpan/CPAN-Meta/Changes +++ b/cpan/CPAN-Meta/Changes @@ -1,5 +1,46 @@ Revision history for CPAN-Meta +2.110930 2011-04-02 23:31:24 America/New_York + + [BUGFIX] + + - Fixed a bug in the 'as_string' method that checked the module version + instead of the meta-spec version when conversion was requested + (RT #67188) + +2.110910 2011-04-01 08:55:30 America/New_York + + [ENHANCEMENTS] + + - The 1.x spec "gpl" and "lgpl" and "mozilla" license values now up-convert + to "open_source" because they indicate too non-specific a license. + +2.110580 2011-02-27 07:58:06 EST5EDT + + [OTHER] + + - Add explicit dependencies on JSON::PP and CPAN::Meta::YAML instead + of relying on Parse::CPAN::Meta to provide them (as some CPAN Testers + have had P::C::M installed without them somehow) + + - Removed dependency on Storable as it was not a core module + until Perl 5.8 + +2.110550 2011-02-24 07:17:57 EST5EDT + + [OTHER] + + - Added required field 'release_status' to the synopsis of + CPAN::Meta::Spec (RT#66118) [Oliver Mengué] + +2.110540 2011-02-23 15:21:16 EST5EDT + + [BUGFIX] + + - Had two different Parse::CPAN::Meta requirements, one in 'requires' and + the other in 'build_requires'. This confused some installers, so we + only inlude the 'requires' now. + 2.110440 2011-02-12 22:55:28 EST5EDT [BUGFIX] diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta.pm b/cpan/CPAN-Meta/lib/CPAN/Meta.pm index ef79855..138aee3 100644 --- a/cpan/CPAN-Meta/lib/CPAN/Meta.pm +++ b/cpan/CPAN-Meta/lib/CPAN/Meta.pm @@ -3,7 +3,7 @@ use strict; use warnings; package CPAN::Meta; BEGIN { - $CPAN::Meta::VERSION = '2.110440'; + $CPAN::Meta::VERSION = '2.110930'; } # ABSTRACT: the distribution metadata for a CPAN dist @@ -13,7 +13,15 @@ use CPAN::Meta::Feature; use CPAN::Meta::Prereqs; use CPAN::Meta::Converter; use CPAN::Meta::Validator; -use Parse::CPAN::Meta 1.44 (); +use Parse::CPAN::Meta 1.4400 (); + +sub _dclone { + my $ref = shift; + my $backend = Parse::CPAN::Meta->json_backend(); + return $backend->new->decode( + $backend->new->convert_blessed->encode($ref) + ); +} BEGIN { @@ -47,7 +55,7 @@ BEGIN { my $value = $_[0]{ $attr }; croak "$attr must be called in list context" unless wantarray; - return @{ Storable::dclone($value) } if ref $value; + return @{ _dclone($value) } if ref $value; return $value; }; } @@ -73,7 +81,7 @@ BEGIN { (my $subname = $attr) =~ s/-/_/; *$subname = sub { my $value = $_[0]{ $attr }; - return Storable::dclone($value) if $value; + return _dclone($value) if $value; return {}; }; } @@ -87,7 +95,7 @@ sub custom_keys { sub custom { my ($self, $attr) = @_; my $value = $self->{$attr}; - return Storable::dclone($value) if ref $value; + return _dclone($value) if ref $value; return $value; } @@ -215,7 +223,6 @@ sub save { } -# XXX Do we need this if we always upconvert? -- dagolden, 2010-04-14 sub meta_spec_version { my ($self) = @_; return $self->meta_spec->{version}; @@ -290,10 +297,7 @@ sub feature { sub as_struct { my ($self, $options) = @_; - my $backend = Parse::CPAN::Meta->json_backend(); - my $struct = $backend->new->decode( - $backend->new->convert_blessed->encode($self) - ); + my $struct = _dclone($self); if ( $options->{version} ) { my $cmc = CPAN::Meta::Converter->new( $struct ); $struct = $cmc->convert( version => $options->{version} ); @@ -308,7 +312,7 @@ sub as_string { my $version = $options->{version} || '2'; my $struct; - if ( $self->version ne $version ) { + if ( $self->meta_spec_version ne $version ) { my $cmc = CPAN::Meta::Converter->new( $self->as_struct ); $struct = $cmc->convert( version => $version ); } @@ -349,7 +353,7 @@ CPAN::Meta - the distribution metadata for a CPAN dist =head1 VERSION -version 2.110440 +version 2.110930 =head1 SYNOPSIS diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/Converter.pm b/cpan/CPAN-Meta/lib/CPAN/Meta/Converter.pm index 2c6ce85..311a93d 100644 --- a/cpan/CPAN-Meta/lib/CPAN/Meta/Converter.pm +++ b/cpan/CPAN-Meta/lib/CPAN/Meta/Converter.pm @@ -3,14 +3,22 @@ use strict; use warnings; package CPAN::Meta::Converter; BEGIN { - $CPAN::Meta::Converter::VERSION = '2.110440'; + $CPAN::Meta::Converter::VERSION = '2.110930'; } # ABSTRACT: Convert CPAN distribution metadata structures use CPAN::Meta::Validator; -use Storable qw/dclone/; use version 0.82 (); +use Parse::CPAN::Meta 1.4400 (); + +sub _dclone { + my $ref = shift; + my $backend = Parse::CPAN::Meta->json_backend(); + return $backend->new->decode( + $backend->new->convert_blessed->encode($ref) + ); +} my %known_specs = ( '2' => 'http://search.cpan.org/perldoc?CPAN::Meta::Spec', @@ -134,15 +142,18 @@ my @valid_licenses_2 = qw( unknown ); +# The "old" values were defined by Module::Build, and were often vague. I have +# made the decisions below based on reading Module::Build::API and how clearly +# it specifies the version of the license. my %license_map_2 = ( - ( map { $_ => $_ } @valid_licenses_2 ), - apache => 'apache_2_0', - artistic => 'artistic_1', - artistic2 => 'artistic_2', - gpl => 'gpl_1', - lgpl => 'lgpl_2_1', - mozilla => 'mozilla_1_0', - perl => 'perl_5', + (map { $_ => $_ } @valid_licenses_2), + apache => 'apache_2_0', # clearly stated as 2.0 + artistic => 'artistic_1', # clearly stated as 1 + artistic2 => 'artistic_2', # clearly stated as 2 + gpl => 'open_source', # we don't know which GPL; punt + lgpl => 'open_source', # we don't know which LGPL; punt + mozilla => 'open_source', # we don't know which MPL; punt + perl => 'perl_5', # clearly Perl 5 restrictive => 'restricted', ); @@ -1187,7 +1198,7 @@ sub convert { my $new_version = $args->{version} || $HIGHEST; my ($old_version) = $self->{spec}; - my $converted = dclone $self->{data}; + my $converted = _dclone($self->{data}); if ( $old_version == $new_version ) { $converted = _convert( $converted, $cleanup{$old_version}, $old_version ); @@ -1242,7 +1253,7 @@ CPAN::Meta::Converter - Convert CPAN distribution metadata structures =head1 VERSION -version 2.110440 +version 2.110930 =head1 SYNOPSIS diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/Feature.pm b/cpan/CPAN-Meta/lib/CPAN/Meta/Feature.pm index d3575e5..d8258dc 100644 --- a/cpan/CPAN-Meta/lib/CPAN/Meta/Feature.pm +++ b/cpan/CPAN-Meta/lib/CPAN/Meta/Feature.pm @@ -3,7 +3,7 @@ use strict; use warnings; package CPAN::Meta::Feature; BEGIN { - $CPAN::Meta::Feature::VERSION = '2.110440'; + $CPAN::Meta::Feature::VERSION = '2.110930'; } # ABSTRACT: an optional feature provided by a CPAN distribution @@ -43,7 +43,7 @@ CPAN::Meta::Feature - an optional feature provided by a CPAN distribution =head1 VERSION -version 2.110440 +version 2.110930 =head1 DESCRIPTION diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/History.pm b/cpan/CPAN-Meta/lib/CPAN/Meta/History.pm index ab03690..9ccbfd4 100644 --- a/cpan/CPAN-Meta/lib/CPAN/Meta/History.pm +++ b/cpan/CPAN-Meta/lib/CPAN/Meta/History.pm @@ -4,7 +4,7 @@ use strict; use warnings; package CPAN::Meta::History; BEGIN { - $CPAN::Meta::History::VERSION = '2.110440'; + $CPAN::Meta::History::VERSION = '2.110930'; } # ABSTRACT: history of CPAN Meta Spec changes 1; @@ -20,7 +20,7 @@ CPAN::Meta::History - history of CPAN Meta Spec changes =head1 VERSION -version 2.110440 +version 2.110930 =head1 DESCRIPTION diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm b/cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm index 4fc2093..29a2e5a 100644 --- a/cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm +++ b/cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm @@ -3,7 +3,7 @@ use strict; use warnings; package CPAN::Meta::Prereqs; BEGIN { - $CPAN::Meta::Prereqs::VERSION = '2.110440'; + $CPAN::Meta::Prereqs::VERSION = '2.110930'; } # ABSTRACT: a set of distribution prerequisites by phase and type @@ -150,7 +150,7 @@ CPAN::Meta::Prereqs - a set of distribution prerequisites by phase and type =head1 VERSION -version 2.110440 +version 2.110930 =head1 DESCRIPTION diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/Spec.pm b/cpan/CPAN-Meta/lib/CPAN/Meta/Spec.pm index 8f94c71..b32fdac 100644 --- a/cpan/CPAN-Meta/lib/CPAN/Meta/Spec.pm +++ b/cpan/CPAN-Meta/lib/CPAN/Meta/Spec.pm @@ -4,7 +4,7 @@ use strict; use warnings; package CPAN::Meta::Spec; BEGIN { - $CPAN::Meta::Spec::VERSION = '2.110440'; + $CPAN::Meta::Spec::VERSION = '2.110930'; } # ABSTRACT: specification for CPAN distribution metadata 1; @@ -20,7 +20,7 @@ CPAN::Meta::Spec - specification for CPAN distribution metadata =head1 VERSION -version 2.110440 +version 2.110930 =head1 SYNOPSIS @@ -31,6 +31,7 @@ version 2.110440 . "building, testing, and installing Perl modules. " . "It is meant to ... blah blah blah ...", version => '0.36', + release_status => 'stable', author => [ 'Ken Williams ', 'Module-Build List ', # additional contact diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/Validator.pm b/cpan/CPAN-Meta/lib/CPAN/Meta/Validator.pm index a203621..819011c 100644 --- a/cpan/CPAN-Meta/lib/CPAN/Meta/Validator.pm +++ b/cpan/CPAN-Meta/lib/CPAN/Meta/Validator.pm @@ -3,7 +3,7 @@ use strict; use warnings; package CPAN::Meta::Validator; BEGIN { - $CPAN::Meta::Validator::VERSION = '2.110440'; + $CPAN::Meta::Validator::VERSION = '2.110930'; } # ABSTRACT: validate CPAN distribution metadata structures @@ -839,7 +839,7 @@ CPAN::Meta::Validator - validate CPAN distribution metadata structures =head1 VERSION -version 2.110440 +version 2.110930 =head1 SYNOPSIS diff --git a/cpan/CPAN-Meta/t/converter.t b/cpan/CPAN-Meta/t/converter.t index 53ea5ee..5cd3e44 100644 --- a/cpan/CPAN-Meta/t/converter.t +++ b/cpan/CPAN-Meta/t/converter.t @@ -110,12 +110,25 @@ for my $f ( reverse sort @files ) { my $original = Parse::CPAN::Meta->load_file( $path ); ok( $original, "loaded META-2.json" ); my $cmc = CPAN::Meta::Converter->new( $original ); - my $up_converted = $cmc->convert( version => 1.4 ); - ok ( $up_converted->{x_whatever}, + my $down_converted = $cmc->convert( version => 1.4 ); + ok ( $down_converted->{x_whatever}, "down converted 'x_' as 'x_'" ); } +# specific test for generalization of unclear licenses +{ + my $path = File::Spec->catfile('t','data','gpl-1_4.yml'); + my $original = Parse::CPAN::Meta->load_file( $path ); + ok( $original, "loaded gpl-1_4.yml" ); + my $cmc = CPAN::Meta::Converter->new( $original ); + my $up_converted = $cmc->convert( version => 2 ); + is_deeply ( $up_converted->{license}, + [ "open_source" ], + "up converted 'gpl' to 'open_source'" + ); +} + # specific test for upconverting resources { my $path = File::Spec->catfile('t','data','resources.yml'); diff --git a/cpan/CPAN-Meta/t/data/gpl-1_4.yml b/cpan/CPAN-Meta/t/data/gpl-1_4.yml new file mode 100644 index 0000000..8437961 --- /dev/null +++ b/cpan/CPAN-Meta/t/data/gpl-1_4.yml @@ -0,0 +1,20 @@ +--- +abstract: 'Build and install Perl modules' +author: + - 'Ken Williams ' + - "Development questions, bug reports, and patches should be sent to the\nModule-Build mailing list at ." +build_requires: + File::Temp: 0.15 + Test::Harness: 3.16 + Test::More: 0.49 +generated_by: 'Module::Build version 0.3608' +license: gpl +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: 1.4 +name: Module-Build +resources: + MailingList: mailto:module-build@perl.org + license: http://dev.perl.org/licenses/ + repository: http://github.com/dagolden/module-build/ +version: 3 -- 2.7.4