diff options
author | Steve Hay <steve.m.hay@googlemail.com> | 2013-10-11 09:16:54 +0100 |
---|---|---|
committer | Steve Hay <steve.m.hay@googlemail.com> | 2013-10-11 09:16:54 +0100 |
commit | 229563a996ec4be3e8a3ebe712dd616ed61fb591 (patch) | |
tree | 129d2fddcfc7fe05c050ace636165e53b21f66dd /cpan | |
parent | 3d5f905f4872cf6bc3c5088afefb21f32f368e74 (diff) | |
download | perl-229563a996ec4be3e8a3ebe712dd616ed61fb591.tar.gz |
Upgrade CPAN::Meta from 2.132661 to 2.132830
Diffstat (limited to 'cpan')
-rw-r--r-- | cpan/CPAN-Meta/Changes | 14 | ||||
-rw-r--r-- | cpan/CPAN-Meta/lib/CPAN/Meta.pm | 12 | ||||
-rw-r--r-- | cpan/CPAN-Meta/lib/CPAN/Meta/Converter.pm | 35 | ||||
-rw-r--r-- | cpan/CPAN-Meta/lib/CPAN/Meta/Feature.pm | 4 | ||||
-rw-r--r-- | cpan/CPAN-Meta/lib/CPAN/Meta/History.pm | 4 | ||||
-rw-r--r-- | cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm | 46 | ||||
-rw-r--r-- | cpan/CPAN-Meta/lib/CPAN/Meta/Spec.pm | 4 | ||||
-rw-r--r-- | cpan/CPAN-Meta/lib/CPAN/Meta/Validator.pm | 6 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/converter-bad.t | 19 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/converter-fail.t | 10 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/converter.t | 26 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/107650337-META.yml (renamed from cpan/CPAN-Meta/t/data-bad/107650337-META.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/1598804075-META.yml (renamed from cpan/CPAN-Meta/t/data-bad/1598804075-META.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/1927486199-META.yml (renamed from cpan/CPAN-Meta/t/data-bad/1927486199-META.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/1985980974-META.yml (renamed from cpan/CPAN-Meta/t/data-bad/1985980974-META.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/2031017050-META.yml (renamed from cpan/CPAN-Meta/t/data-bad/2031017050-META.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/284247103-META.yml (renamed from cpan/CPAN-Meta/t/data-bad/284247103-META.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/344981821-META.yml (renamed from cpan/CPAN-Meta/t/data-bad/344981821-META.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/35478989-META.yml (renamed from cpan/CPAN-Meta/t/data-bad/35478989-META.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/98042513-META.yml (renamed from cpan/CPAN-Meta/t/data-bad/98042513-META.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/META-1_2.yml (renamed from cpan/CPAN-Meta/t/data-bad/META-1_2.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/META-1_3.yml (renamed from cpan/CPAN-Meta/t/data-bad/META-1_3.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/META-1_4.yml (renamed from cpan/CPAN-Meta/t/data-bad/META-1_4.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/META-2.json (renamed from cpan/CPAN-Meta/t/data-bad/META-2.json) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/invalid-meta-spec-version.json | 89 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/invalid-meta-spec-version.yml | 132 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/meta-spec-version-trailing-zeros.json | 89 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/meta-spec-version-trailing-zeros.yml | 132 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/restrictive-2.json (renamed from cpan/CPAN-Meta/t/data-bad/restrictive-2.json) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-fixable/version-ranges-2.json (renamed from cpan/CPAN-Meta/t/data-bad/version-ranges-2.json) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-test/META-1_0.yml (renamed from cpan/CPAN-Meta/t/data/META-1_0.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-test/META-1_1.yml (renamed from cpan/CPAN-Meta/t/data/META-1_1.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-test/META-1_2.yml (renamed from cpan/CPAN-Meta/t/data/META-1_2.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-test/META-1_3.yml (renamed from cpan/CPAN-Meta/t/data/META-1_3.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-test/META-1_4.yml (renamed from cpan/CPAN-Meta/t/data/META-1_4.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-test/META-2.json (renamed from cpan/CPAN-Meta/t/data/META-2.json) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-test/gpl-1_4.yml (renamed from cpan/CPAN-Meta/t/data/gpl-1_4.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-test/provides-version-missing.json (renamed from cpan/CPAN-Meta/t/data/provides-version-missing.json) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-test/resources.yml (renamed from cpan/CPAN-Meta/t/data/resources.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-test/restricted-2.json (renamed from cpan/CPAN-Meta/t/data/restricted-2.json) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-test/restrictive-1_4.yml (renamed from cpan/CPAN-Meta/t/data/restrictive-1_4.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-test/unicode.yml (renamed from cpan/CPAN-Meta/t/data/unicode.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-test/version-not-normal.json (renamed from cpan/CPAN-Meta/t/data/version-not-normal.json) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-test/version-ranges-1_4.yml (renamed from cpan/CPAN-Meta/t/data/version-ranges-1_4.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-test/version-ranges-2.json (renamed from cpan/CPAN-Meta/t/data/version-ranges-2.json) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-valid/1122575719-META.yml (renamed from cpan/CPAN-Meta/t/data-bad/1122575719-META.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-valid/1206545041-META.yml (renamed from cpan/CPAN-Meta/t/data-bad/1206545041-META.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-valid/1985684504-META.yml (renamed from cpan/CPAN-Meta/t/data-bad/1985684504-META.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-valid/476602558-META.yml (renamed from cpan/CPAN-Meta/t/data-bad/476602558-META.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-valid/META-1_0.yml (renamed from cpan/CPAN-Meta/t/data-bad/META-1_0.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-valid/META-1_1.yml (renamed from cpan/CPAN-Meta/t/data-bad/META-1_1.yml) | 0 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/data-valid/scalar-meta-spec.yml | 25 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/load-bad.t | 6 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/prereqs.t | 42 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/save-load.t | 2 | ||||
-rw-r--r-- | cpan/CPAN-Meta/t/validator.t | 20 |
56 files changed, 657 insertions, 60 deletions
diff --git a/cpan/CPAN-Meta/Changes b/cpan/CPAN-Meta/Changes index 62406e92e4..a96d888056 100644 --- a/cpan/CPAN-Meta/Changes +++ b/cpan/CPAN-Meta/Changes @@ -1,5 +1,19 @@ Revision history for CPAN-Meta +2.132830 2013-10-10 16:04:30 America/New_York + + [ADDED] + + - CPAN::Meta::Prereqs now has a 'merged_requirements' method for + combining requirements across multiple phases and types + + [FIXED] + + - Invalid 'meta-spec' is no longer a fatal error: instead, it will + usually be treated as spec version "1.0" (prior to formalization of the + meta-spec field). Conversion has some heuristics for guessing a + version depending on other fields if 'meta-spec' is missing or invalid. + 2.132661 2013-09-23 13:27:46 America/New_York [FIXED] diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta.pm b/cpan/CPAN-Meta/lib/CPAN/Meta.pm index 9825f4ad4b..25a4d1aa08 100644 --- a/cpan/CPAN-Meta/lib/CPAN/Meta.pm +++ b/cpan/CPAN-Meta/lib/CPAN/Meta.pm @@ -2,7 +2,7 @@ use 5.006; use strict; use warnings; package CPAN::Meta; -our $VERSION = '2.132661'; # VERSION +our $VERSION = '2.132830'; # VERSION use Carp qw(carp croak); @@ -348,7 +348,7 @@ CPAN::Meta - the distribution metadata for a CPAN dist =head1 VERSION -version 2.132661 +version 2.132830 =head1 SYNOPSIS @@ -546,7 +546,7 @@ of options. If the hashref contains a C<version> argument, the copied metadata will be converted to the version of the specification and returned. For example: - my $string = $meta->as_struct( {version => "1.4"} ); + my $string = $meta->as_string( {version => "1.4"} ); For C<version> greater than or equal to 2, the string will be serialized as JSON. For C<version> less than 2, the string will be serialized as YAML. In @@ -735,6 +735,10 @@ Christopher J. Madsen <cjm@cpan.org> =item * +Chuck Adams <cja987@gmail.com> + +=item * + Cory G Watson <gphat@cpan.org> =item * @@ -783,7 +787,7 @@ Olaf Alders <olaf@wundersolutions.com> =item * -Olivier Mengué <dolmen@cpan.org> +Olivier Mengue <dolmen@cpan.org> =item * diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/Converter.pm b/cpan/CPAN-Meta/lib/CPAN/Meta/Converter.pm index 828991dd75..2825eb2254 100644 --- a/cpan/CPAN-Meta/lib/CPAN/Meta/Converter.pm +++ b/cpan/CPAN-Meta/lib/CPAN/Meta/Converter.pm @@ -2,7 +2,7 @@ use 5.006; use strict; use warnings; package CPAN::Meta::Converter; -our $VERSION = '2.132661'; # VERSION +our $VERSION = '2.132830'; # VERSION use CPAN::Meta::Validator; @@ -60,7 +60,7 @@ sub _generated_by { my $sig = __PACKAGE__ . " version " . (__PACKAGE__->VERSION || "<dev>"); return $sig unless defined $gen and length $gen; - return $gen if $gen =~ /(, )\Q$sig/; + return $gen if $gen =~ /\Q$sig/; return "$gen, $sig"; } @@ -88,9 +88,10 @@ sub _no_prefix_ucfirst_custom { sub _change_meta_spec { my ($element, undef, undef, $version) = @_; - $element->{version} = $version; - $element->{url} = $known_specs{$version}; - return $element; + return { + version => $version, + url => $known_specs{$version}, + }; } my @valid_licenses_1 = ( @@ -1206,13 +1207,33 @@ sub new { # create an attributes hash my $self = { 'data' => $data, - 'spec' => $data->{'meta-spec'}{'version'} || "1.0", + 'spec' => _extract_spec_version($data), }; # create the object return bless $self, $class; } +sub _extract_spec_version { + my ($data) = @_; + my $spec = $data->{'meta-spec'}; + + # is meta-spec there and valid? + return "1.0" unless defined $spec && ref $spec eq 'HASH'; # before meta-spec? + + # does the version key look like a valid version? + my $v = $spec->{version}; + if ( defined $v && $v =~ /^\d+(?:\.\d+)?$/ ) { + return $v if defined $v && grep { $v eq $_ } keys %known_specs; # known spec + return $v+0 if defined $v && grep { $v == $_ } keys %known_specs; # 2.0 => 2 + } + + # otherwise, use heuristics: look for 1.x vs 2.0 fields + return "2" if exists $data->{prereqs}; + return "1.4" if exists $data->{configure_requires}; + return "1.2"; # when meta-spec was first defined +} + sub convert { my ($self, %args) = @_; @@ -1280,7 +1301,7 @@ CPAN::Meta::Converter - Convert CPAN distribution metadata structures =head1 VERSION -version 2.132661 +version 2.132830 =head1 SYNOPSIS diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/Feature.pm b/cpan/CPAN-Meta/lib/CPAN/Meta/Feature.pm index f54078acd3..978aa3d8ac 100644 --- a/cpan/CPAN-Meta/lib/CPAN/Meta/Feature.pm +++ b/cpan/CPAN-Meta/lib/CPAN/Meta/Feature.pm @@ -2,7 +2,7 @@ use 5.006; use strict; use warnings; package CPAN::Meta::Feature; -our $VERSION = '2.132661'; # VERSION +our $VERSION = '2.132830'; # VERSION use CPAN::Meta::Prereqs; @@ -44,7 +44,7 @@ CPAN::Meta::Feature - an optional feature provided by a CPAN distribution =head1 VERSION -version 2.132661 +version 2.132830 =head1 DESCRIPTION diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/History.pm b/cpan/CPAN-Meta/lib/CPAN/Meta/History.pm index dce6104e84..d52e8c7dda 100644 --- a/cpan/CPAN-Meta/lib/CPAN/Meta/History.pm +++ b/cpan/CPAN-Meta/lib/CPAN/Meta/History.pm @@ -3,7 +3,7 @@ use 5.006; use strict; use warnings; package CPAN::Meta::History; -our $VERSION = '2.132661'; # VERSION +our $VERSION = '2.132830'; # VERSION 1; @@ -21,7 +21,7 @@ CPAN::Meta::History - history of CPAN Meta Spec changes =head1 VERSION -version 2.132661 +version 2.132830 =head1 DESCRIPTION diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm b/cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm index b68c5008d6..169b28eb21 100644 --- a/cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm +++ b/cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm @@ -2,7 +2,7 @@ use 5.006; use strict; use warnings; package CPAN::Meta::Prereqs; -our $VERSION = '2.132661'; # VERSION +our $VERSION = '2.132830'; # VERSION use Carp qw(confess); @@ -97,6 +97,37 @@ sub with_merged_prereqs { } +sub merged_requirements { + my ($self, $phases, $types) = @_; + $phases = [qw/runtime build test/] unless defined $phases; + $types = [qw/requires recommends/] unless defined $types; + + confess "merged_requirements phases argument must be an arrayref" + unless ref $phases eq 'ARRAY'; + confess "merged_requirements types argument must be an arrayref" + unless ref $types eq 'ARRAY'; + + my $req = CPAN::Meta::Requirements->new; + + for my $phase ( @$phases ) { + unless ($phase =~ /\Ax_/i or grep { $phase eq $_ } $self->__legal_phases) { + confess "requested requirements for unknown phase: $phase"; + } + for my $type ( @$types ) { + unless ($type =~ /\Ax_/i or grep { $type eq $_ } $self->__legal_types) { + confess "requested requirements for unknown type: $type"; + } + $req->add_requirements( $self->requirements_for($phase, $type) ); + } + } + + $req->finalize if $self->is_finalized; + + return $req; +} + + + sub as_string_hash { my ($self) = @_; @@ -151,7 +182,7 @@ CPAN::Meta::Prereqs - a set of distribution prerequisites by phase and type =head1 VERSION -version 2.132661 +version 2.132830 =head1 DESCRIPTION @@ -213,6 +244,17 @@ its optional features. The new prereqs object has no ties to the originals, and altering it further will not alter them. +=head2 merged_requirements + + my $new_reqs = $prereqs->merged_requirements( \@phases, \@types ); + my $new_reqs = $prereqs->merged_requirements( \@phases ); + my $new_reqs = $preerqs->merged_requirements(); + +This method joins together all requirements across a number of phases +and types into a new L<CPAN::Meta::Requirements> object. If arguments +are omitted, it defaults to "runtime", "build" and "test" for phases +and "requires" and "recommends" for types. + =head2 as_string_hash This method returns a hashref containing structures suitable for dumping into a diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/Spec.pm b/cpan/CPAN-Meta/lib/CPAN/Meta/Spec.pm index ebfda83255..cbc0ff910b 100644 --- a/cpan/CPAN-Meta/lib/CPAN/Meta/Spec.pm +++ b/cpan/CPAN-Meta/lib/CPAN/Meta/Spec.pm @@ -7,7 +7,7 @@ use 5.006; use strict; use warnings; package CPAN::Meta::Spec; -our $VERSION = '2.132661'; # VERSION +our $VERSION = '2.132830'; # VERSION 1; @@ -28,7 +28,7 @@ CPAN::Meta::Spec - specification for CPAN distribution metadata =head1 VERSION -version 2.132661 +version 2.132830 =head1 SYNOPSIS diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/Validator.pm b/cpan/CPAN-Meta/lib/CPAN/Meta/Validator.pm index 8df51d70b4..8fabd4be1b 100644 --- a/cpan/CPAN-Meta/lib/CPAN/Meta/Validator.pm +++ b/cpan/CPAN-Meta/lib/CPAN/Meta/Validator.pm @@ -2,7 +2,7 @@ use 5.006; use strict; use warnings; package CPAN::Meta::Validator; -our $VERSION = '2.132661'; # VERSION +our $VERSION = '2.132830'; # VERSION #--------------------------------------------------------------------------# @@ -426,7 +426,7 @@ sub new { # create an attributes hash my $self = { 'data' => $data, - 'spec' => $data->{'meta-spec'}{'version'} || "1.0", + 'spec' => eval { $data->{'meta-spec'}{'version'} } || "1.0", 'errors' => undef, }; @@ -823,7 +823,7 @@ CPAN::Meta::Validator - validate CPAN distribution metadata structures =head1 VERSION -version 2.132661 +version 2.132830 =head1 SYNOPSIS diff --git a/cpan/CPAN-Meta/t/converter-bad.t b/cpan/CPAN-Meta/t/converter-bad.t index fdfea25f9e..f9e7d59caf 100644 --- a/cpan/CPAN-Meta/t/converter-bad.t +++ b/cpan/CPAN-Meta/t/converter-bad.t @@ -11,20 +11,23 @@ use Parse::CPAN::Meta 1.4400; delete $ENV{$_} for qw/PERL_JSON_BACKEND PERL_YAML_BACKEND/; # use defaults -my $data_dir = IO::Dir->new( 't/data-bad' ); -my @files = sort grep { /^\w/ } $data_dir->read; +my @data_dirs = qw( t/data-valid t/data-fixable ); +my @files = sort map { + my $d = $_; + map { "$d/$_" } grep { substr($_,0,1) ne '.' } IO::Dir->new($d)->read +} @data_dirs; -sub _spec_version { return $_[0]->{'meta-spec'}{version} || "1.0" } +*_spec_version = \&CPAN::Meta::Converter::_extract_spec_version; #use Data::Dumper; for my $f ( reverse sort @files ) { - my $path = File::Spec->catfile('t','data-bad',$f); + my $path = File::Spec->catfile($f); my $original = Parse::CPAN::Meta->load_file( $path ); ok( $original, "loaded $f" ); my $original_v = _spec_version($original); # UPCONVERSION - if ( _spec_version( $original ) lt '2' ) { + if ( $original_v lt '2' ) { my $cmc = CPAN::Meta::Converter->new( $original ); my $converted = $cmc->convert( version => 2 ); is ( _spec_version($converted), 2, "up converted spec version $original_v to spec version 2"); @@ -35,7 +38,7 @@ for my $f ( reverse sort @files ) { ); } # UPCONVERSION - partial - if ( _spec_version( $original ) lt '1.4' ) { + if ( $original_v lt '1.4' ) { my $cmc = CPAN::Meta::Converter->new( $original ); my $converted = $cmc->convert( version => '1.4' ); is ( _spec_version($converted), 1.4, "up converted spec version $original_v to spec version 1.4"); @@ -46,7 +49,7 @@ for my $f ( reverse sort @files ) { ); } # DOWNCONVERSION - partial - if ( _spec_version( $original ) gt '1.2' ) { + if ( $original_v gt '1.2' ) { my $cmc = CPAN::Meta::Converter->new( $original ); my $converted = $cmc->convert( version => '1.2' ); is ( _spec_version($converted), '1.2', "down converted spec version $original_v to spec version 1.2"); @@ -57,7 +60,7 @@ for my $f ( reverse sort @files ) { ); } # DOWNCONVERSION - if ( _spec_version( $original ) gt '1.0' ) { + if ( $original_v gt '1.0' ) { my $cmc = CPAN::Meta::Converter->new( $original ); my $converted = $cmc->convert( version => '1.0' ); is ( _spec_version($converted), '1.0', "down converted spec version $original_v to spec version 1.0"); diff --git a/cpan/CPAN-Meta/t/converter-fail.t b/cpan/CPAN-Meta/t/converter-fail.t index 065b3d7080..b9cfedd1fe 100644 --- a/cpan/CPAN-Meta/t/converter-fail.t +++ b/cpan/CPAN-Meta/t/converter-fail.t @@ -14,7 +14,7 @@ delete $ENV{$_} for qw/PERL_JSON_BACKEND PERL_YAML_BACKEND/; # use defaults my $data_dir = IO::Dir->new( 't/data-fail' ); my @files = sort grep { /^\w/ } $data_dir->read; -sub _spec_version { return $_[0]->{'meta-spec'}{version} || "1.0" } +*_spec_version = \&CPAN::Meta::Converter::_extract_spec_version; use Data::Dumper; @@ -24,15 +24,15 @@ for my $f ( reverse sort @files ) { ok( $original, "loaded invalid $f" ); my $original_v = _spec_version($original); # UPCONVERSION - if ( _spec_version( $original ) lt '2' ) { + if ( $original_v lt '2' ) { my $cmc = CPAN::Meta::Converter->new( $original ); - eval { $cmc->convert( version => 2 ) }; + my $fixed = eval { $cmc->convert( version => 2 ) }; ok ( $@, "error thrown up converting" ); } # DOWNCONVERSION - if ( _spec_version( $original ) gt '1.0' ) { + if ( $original_v gt '1.0' ) { my $cmc = CPAN::Meta::Converter->new( $original ); - eval { $cmc->convert( version => '1.0' ) }; + my $fixed = eval { $cmc->convert( version => '1.0' ) }; ok ( $@, "error thrown down converting" ); } } diff --git a/cpan/CPAN-Meta/t/converter.t b/cpan/CPAN-Meta/t/converter.t index a5a55a23f7..e9631685fe 100644 --- a/cpan/CPAN-Meta/t/converter.t +++ b/cpan/CPAN-Meta/t/converter.t @@ -27,15 +27,15 @@ sub new { package main; -my $data_dir = IO::Dir->new( 't/data' ); +my $data_dir = IO::Dir->new( 't/data-test' ); my @files = sort grep { /^\w/ } $data_dir->read; -sub _spec_version { return $_[0]->{'meta-spec'}{version} || "1.0" } +*_spec_version = \&CPAN::Meta::Converter::_extract_spec_version; #use Data::Dumper; for my $f ( reverse sort @files ) { - my $path = File::Spec->catfile('t','data',$f); + my $path = File::Spec->catfile('t','data-test',$f); my $original = Parse::CPAN::Meta->load_file( $path ); ok( $original, "loaded $f" ); my $original_v = _spec_version($original); @@ -106,7 +106,7 @@ for my $f ( reverse sort @files ) { # specific test for custom key handling { - my $path = File::Spec->catfile('t','data','META-1_4.yml'); + my $path = File::Spec->catfile('t','data-test','META-1_4.yml'); my $original = Parse::CPAN::Meta->load_file( $path ); ok( $original, "loaded META-1_4.yml" ); my $cmc = CPAN::Meta::Converter->new( $original ); @@ -124,7 +124,7 @@ for my $f ( reverse sort @files ) { # specific test for custom key handling { - my $path = File::Spec->catfile('t','data','META-2.json'); + my $path = File::Spec->catfile('t','data-test','META-2.json'); my $original = Parse::CPAN::Meta->load_file( $path ); ok( $original, "loaded META-2.json" ); my $cmc = CPAN::Meta::Converter->new( $original ); @@ -136,7 +136,7 @@ for my $f ( reverse sort @files ) { # specific test for generalization of unclear licenses { - my $path = File::Spec->catfile('t','data','gpl-1_4.yml'); + my $path = File::Spec->catfile('t','data-test','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 ); @@ -149,7 +149,7 @@ for my $f ( reverse sort @files ) { # specific test for upconverting resources { - my $path = File::Spec->catfile('t','data','resources.yml'); + my $path = File::Spec->catfile('t','data-test','resources.yml'); my $original = Parse::CPAN::Meta->load_file( $path ); ok( $original, "loaded resources.yml" ); my $cmc = CPAN::Meta::Converter->new( $original ); @@ -168,7 +168,7 @@ for my $f ( reverse sort @files ) { # specific test for round-tripping resources { - my $path = File::Spec->catfile('t','data','resources.yml'); + my $path = File::Spec->catfile('t','data-test','resources.yml'); my $original = Parse::CPAN::Meta->load_file( $path ); ok( $original, "loaded resources.yml" ); my $cmc1 = CPAN::Meta::Converter->new( $original ); @@ -184,7 +184,7 @@ for my $f ( reverse sort @files ) { # specific test for object conversion { - my $path = File::Spec->catfile('t','data','resources.yml'); + my $path = File::Spec->catfile('t','data-test','resources.yml'); my $original = Parse::CPAN::Meta->load_file( $path ); ok( $original, "loaded resources.yml" ); $original->{version} = version->new("1.64"); @@ -196,7 +196,7 @@ for my $f ( reverse sort @files ) { # specific test for UTF-8 handling { - my $path = File::Spec->catfile('t','data','unicode.yml'); + my $path = File::Spec->catfile('t','data-test','unicode.yml'); my $original = CPAN::Meta->load_file( $path ) or die "Couldn't load $path"; ok( $original, "unicode.yml" ); @@ -214,7 +214,7 @@ for my $f ( reverse sort @files ) { my $suffix = $case eq 2 ? "$case.json" : "$case.yml"; my $version = $case; $version =~ tr[_][.]; - my $path = File::Spec->catfile('t','data','version-ranges-' . $suffix); + my $path = File::Spec->catfile('t','data-test','version-ranges-' . $suffix); my $original = Parse::CPAN::Meta->load_file( $path ); ok( $original, "loaded " . basename $path ); my $cmc = CPAN::Meta::Converter->new( $original ); @@ -232,7 +232,7 @@ for my $f ( reverse sort @files ) { # specific test for version numbers { - my $path = File::Spec->catfile('t','data','version-not-normal.json'); + my $path = File::Spec->catfile('t','data-test','version-not-normal.json'); my $original = Parse::CPAN::Meta->load_file( $path ); ok( $original, "loaded " . basename $path ); my $cmc = CPAN::Meta::Converter->new( $original ); @@ -243,7 +243,7 @@ for my $f ( reverse sort @files ) { # specific test for missing provides version { - my $path = File::Spec->catfile('t','data','provides-version-missing.json'); + my $path = File::Spec->catfile('t','data-test','provides-version-missing.json'); my $original = Parse::CPAN::Meta->load_file( $path ); ok( $original, "loaded " . basename $path ); my $cmc = CPAN::Meta::Converter->new( $original ); diff --git a/cpan/CPAN-Meta/t/data-bad/107650337-META.yml b/cpan/CPAN-Meta/t/data-fixable/107650337-META.yml index 84080ef657..84080ef657 100644 --- a/cpan/CPAN-Meta/t/data-bad/107650337-META.yml +++ b/cpan/CPAN-Meta/t/data-fixable/107650337-META.yml diff --git a/cpan/CPAN-Meta/t/data-bad/1598804075-META.yml b/cpan/CPAN-Meta/t/data-fixable/1598804075-META.yml index 868c8cd587..868c8cd587 100644 --- a/cpan/CPAN-Meta/t/data-bad/1598804075-META.yml +++ b/cpan/CPAN-Meta/t/data-fixable/1598804075-META.yml diff --git a/cpan/CPAN-Meta/t/data-bad/1927486199-META.yml b/cpan/CPAN-Meta/t/data-fixable/1927486199-META.yml index 9b5d8bd3b1..9b5d8bd3b1 100644 --- a/cpan/CPAN-Meta/t/data-bad/1927486199-META.yml +++ b/cpan/CPAN-Meta/t/data-fixable/1927486199-META.yml diff --git a/cpan/CPAN-Meta/t/data-bad/1985980974-META.yml b/cpan/CPAN-Meta/t/data-fixable/1985980974-META.yml index 7814f05ce3..7814f05ce3 100644 --- a/cpan/CPAN-Meta/t/data-bad/1985980974-META.yml +++ b/cpan/CPAN-Meta/t/data-fixable/1985980974-META.yml diff --git a/cpan/CPAN-Meta/t/data-bad/2031017050-META.yml b/cpan/CPAN-Meta/t/data-fixable/2031017050-META.yml index c7b3930720..c7b3930720 100644 --- a/cpan/CPAN-Meta/t/data-bad/2031017050-META.yml +++ b/cpan/CPAN-Meta/t/data-fixable/2031017050-META.yml diff --git a/cpan/CPAN-Meta/t/data-bad/284247103-META.yml b/cpan/CPAN-Meta/t/data-fixable/284247103-META.yml index e7390a2bff..e7390a2bff 100644 --- a/cpan/CPAN-Meta/t/data-bad/284247103-META.yml +++ b/cpan/CPAN-Meta/t/data-fixable/284247103-META.yml diff --git a/cpan/CPAN-Meta/t/data-bad/344981821-META.yml b/cpan/CPAN-Meta/t/data-fixable/344981821-META.yml index 7a51e87ebc..7a51e87ebc 100644 --- a/cpan/CPAN-Meta/t/data-bad/344981821-META.yml +++ b/cpan/CPAN-Meta/t/data-fixable/344981821-META.yml diff --git a/cpan/CPAN-Meta/t/data-bad/35478989-META.yml b/cpan/CPAN-Meta/t/data-fixable/35478989-META.yml index 42e0c1081a..42e0c1081a 100644 --- a/cpan/CPAN-Meta/t/data-bad/35478989-META.yml +++ b/cpan/CPAN-Meta/t/data-fixable/35478989-META.yml diff --git a/cpan/CPAN-Meta/t/data-bad/98042513-META.yml b/cpan/CPAN-Meta/t/data-fixable/98042513-META.yml index 9a1b25f5dd..9a1b25f5dd 100644 --- a/cpan/CPAN-Meta/t/data-bad/98042513-META.yml +++ b/cpan/CPAN-Meta/t/data-fixable/98042513-META.yml diff --git a/cpan/CPAN-Meta/t/data-bad/META-1_2.yml b/cpan/CPAN-Meta/t/data-fixable/META-1_2.yml index ef58965f9a..ef58965f9a 100644 --- a/cpan/CPAN-Meta/t/data-bad/META-1_2.yml +++ b/cpan/CPAN-Meta/t/data-fixable/META-1_2.yml diff --git a/cpan/CPAN-Meta/t/data-bad/META-1_3.yml b/cpan/CPAN-Meta/t/data-fixable/META-1_3.yml index ad215ad92c..ad215ad92c 100644 --- a/cpan/CPAN-Meta/t/data-bad/META-1_3.yml +++ b/cpan/CPAN-Meta/t/data-fixable/META-1_3.yml diff --git a/cpan/CPAN-Meta/t/data-bad/META-1_4.yml b/cpan/CPAN-Meta/t/data-fixable/META-1_4.yml index 1336f10a48..1336f10a48 100644 --- a/cpan/CPAN-Meta/t/data-bad/META-1_4.yml +++ b/cpan/CPAN-Meta/t/data-fixable/META-1_4.yml diff --git a/cpan/CPAN-Meta/t/data-bad/META-2.json b/cpan/CPAN-Meta/t/data-fixable/META-2.json index 6734399e22..6734399e22 100644 --- a/cpan/CPAN-Meta/t/data-bad/META-2.json +++ b/cpan/CPAN-Meta/t/data-fixable/META-2.json diff --git a/cpan/CPAN-Meta/t/data-fixable/invalid-meta-spec-version.json b/cpan/CPAN-Meta/t/data-fixable/invalid-meta-spec-version.json new file mode 100644 index 0000000000..183781b4ec --- /dev/null +++ b/cpan/CPAN-Meta/t/data-fixable/invalid-meta-spec-version.json @@ -0,0 +1,89 @@ +{ + "resources" : { + "license" : [ + "http://dev.perl.org/licenses/" + ], + "repository" : { + "url" : "svn://repo.example.com/foo-bar#fakeanchor", + "web" : "http://www.example.com" + } + }, + "generated_by" : "Module::Build version 0.36", + "meta-spec" : { + "version" : "99", + "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec" + }, + "version" : "0.36", + "name" : "Module-Build", + "dynamic_config" : 1, + "author" : [ + "Ken Williams <kwilliams@cpan.org>", + "Module-Build List <module-build@perl.org>" + ], + "release_status" : "stable", + "license" : [ + "perl_5" + ], + "description" : "Module::Build is a system for building, testing, and installing Perl modules. It is meant to be an alternative to ExtUtils::MakeMaker... blah blah blah", + "keywords" : [ + "toolchain", + "cpan", + "dual-life" + ], + "prereqs" : { + "runtime" : { + "requires" : { + "File::Copy" : "0", + "IO::File" : "0", + "Data::Dumper" : "0", + "File::Spec" : "0", + "Config" : "0", + "ExtUtils::Install" : "0", + "perl" : "5.006", + "File::Compare" : "0", + "File::Find" : "0", + "File::Path" : "0", + "File::Basename" : "0", + "Cwd" : "0" + }, + "recommends" : { + "YAML" : "0.35", + "ExtUtils::ParseXS" : "2.02", + "Pod::Text" : "0", + "ExtUtils::Install" : "0.3", + "Archive::Tar" : "1.00" + } + }, + "build" : { + "requires" : { + "Build::Requires": "1.1", + "Test::More" : "0" + } + }, + "test" : { + "requires" : { + "Test::More" : "0.88", + "Test::Requires" : "1.2" + } + } + }, + "optional_features" : { + "domination" : { + "prereqs" : { + "develop" : { + "requires" : { + "Genius::Evil" : "1.234" + } + }, + "runtime" : { + "requires" : { + "Machine::Weather" : "2.0" + } + } + }, + "description" : "Take over the world" + } + }, + "abstract" : "Build and install Perl modules", + "x_whatever" : "Custom key" +} diff --git a/cpan/CPAN-Meta/t/data-fixable/invalid-meta-spec-version.yml b/cpan/CPAN-Meta/t/data-fixable/invalid-meta-spec-version.yml new file mode 100644 index 0000000000..d74cde68ee --- /dev/null +++ b/cpan/CPAN-Meta/t/data-fixable/invalid-meta-spec-version.yml @@ -0,0 +1,132 @@ +--- +abstract: 'Build and install Perl modules' +author: + - 'Ken Williams <kwilliams@cpan.org>' + - "Development questions, bug reports, and patches should be sent to the\nModule-Build mailing list at <module-build@perl.org>." +build_requires: + File::Temp: 0.15 + Test::Harness: 3.16 + Test::More: 0.49 +generated_by: 'Module::Build version 0.3608' +license: perl +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: X +name: Module-Build +provides: + Module::Build: + file: lib/Module/Build.pm + version: 0.36_08 + Module::Build::Base: + file: lib/Module/Build/Base.pm + version: 0.36_08 + Module::Build::Compat: + file: lib/Module/Build/Compat.pm + version: 0.36_08 + Module::Build::Config: + file: lib/Module/Build/Config.pm + version: 0.36_08 + Module::Build::Cookbook: + file: lib/Module/Build/Cookbook.pm + version: 0.36_08 + Module::Build::Dumper: + file: lib/Module/Build/Dumper.pm + version: 0.36_08 + Module::Build::ModuleInfo: + file: lib/Module/Build/ModuleInfo.pm + version: 0.36_08 + Module::Build::Notes: + file: lib/Module/Build/Notes.pm + version: 0.36_08 + Module::Build::PPMMaker: + file: lib/Module/Build/PPMMaker.pm + version: 0.36_08 + Module::Build::Platform::Amiga: + file: lib/Module/Build/Platform/Amiga.pm + version: 0.36_08 + Module::Build::Platform::Default: + file: lib/Module/Build/Platform/Default.pm + version: 0.36_08 + Module::Build::Platform::EBCDIC: + file: lib/Module/Build/Platform/EBCDIC.pm + version: 0.36_08 + Module::Build::Platform::MPEiX: + file: lib/Module/Build/Platform/MPEiX.pm + version: 0.36_08 + Module::Build::Platform::MacOS: + file: lib/Module/Build/Platform/MacOS.pm + version: 0.36_08 + Module::Build::Platform::RiscOS: + file: lib/Module/Build/Platform/RiscOS.pm + version: 0.36_08 + Module::Build::Platform::Unix: + file: lib/Module/Build/Platform/Unix.pm + version: 0.36_08 + Module::Build::Platform::VMS: + file: lib/Module/Build/Platform/VMS.pm + version: 0.36_08 + Module::Build::Platform::VOS: + file: lib/Module/Build/Platform/VOS.pm + version: 0.36_08 + Module::Build::Platform::Windows: + file: lib/Module/Build/Platform/Windows.pm + version: 0.36_08 + Module::Build::Platform::aix: + file: lib/Module/Build/Platform/aix.pm + version: 0.36_08 + Module::Build::Platform::cygwin: + file: lib/Module/Build/Platform/cygwin.pm + version: 0.36_08 + Module::Build::Platform::darwin: + file: lib/Module/Build/Platform/darwin.pm + version: 0.36_08 + Module::Build::Platform::os2: + file: lib/Module/Build/Platform/os2.pm + version: 0.36_08 + Module::Build::PodParser: + file: lib/Module/Build/PodParser.pm + version: 0.36_08 + Module::Build::Version: + file: lib/Module/Build/Version.pm + version: 0.77 + Module::Build::YAML: + file: lib/Module/Build/YAML.pm + version: 1.40 + inc::latest: + file: lib/inc/latest.pm + version: 0.36_08 + inc::latest::private: + file: lib/inc/latest/private.pm + version: 0.36_08 +recommends: + ExtUtils::Install: 0.3 + ExtUtils::Manifest: 1.54 + version: 0.74 +requires: + Cwd: 0 + Data::Dumper: 0 + ExtUtils::CBuilder: 0.27 + ExtUtils::Install: 0 + ExtUtils::Manifest: 0 + ExtUtils::Mkbootstrap: 0 + ExtUtils::ParseXS: 2.21 + File::Basename: 0 + File::Compare: 0 + File::Copy: 0 + File::Find: 0 + File::Path: 0 + File::Spec: 0.82 + Getopt::Long: 0 + IO::File: 0 + Test::Harness: 0 + Text::Abbrev: 0 + Text::ParseWords: 0 + perl: 5.006001 +resources: + MailingList: mailto:module-build@perl.org + license: http://dev.perl.org/licenses/ + repository: http://github.com/dagolden/module-build/ +version: 0.36_08 +x-whatever: this is a custom field +x_whatelse: so is this +XWhatNow: and this diff --git a/cpan/CPAN-Meta/t/data-fixable/meta-spec-version-trailing-zeros.json b/cpan/CPAN-Meta/t/data-fixable/meta-spec-version-trailing-zeros.json new file mode 100644 index 0000000000..399019514c --- /dev/null +++ b/cpan/CPAN-Meta/t/data-fixable/meta-spec-version-trailing-zeros.json @@ -0,0 +1,89 @@ +{ + "resources" : { + "license" : [ + "http://dev.perl.org/licenses/" + ], + "repository" : { + "url" : "svn://repo.example.com/foo-bar#fakeanchor", + "web" : "http://www.example.com" + } + }, + "generated_by" : "Module::Build version 0.36", + "meta-spec" : { + "version" : "2.0", + "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec" + }, + "version" : "0.36", + "name" : "Module-Build", + "dynamic_config" : 1, + "author" : [ + "Ken Williams <kwilliams@cpan.org>", + "Module-Build List <module-build@perl.org>" + ], + "release_status" : "stable", + "license" : [ + "perl_5" + ], + "description" : "Module::Build is a system for building, testing, and installing Perl modules. It is meant to be an alternative to ExtUtils::MakeMaker... blah blah blah", + "keywords" : [ + "toolchain", + "cpan", + "dual-life" + ], + "prereqs" : { + "runtime" : { + "requires" : { + "File::Copy" : "0", + "IO::File" : "0", + "Data::Dumper" : "0", + "File::Spec" : "0", + "Config" : "0", + "ExtUtils::Install" : "0", + "perl" : "5.006", + "File::Compare" : "0", + "File::Find" : "0", + "File::Path" : "0", + "File::Basename" : "0", + "Cwd" : "0" + }, + "recommends" : { + "YAML" : "0.35", + "ExtUtils::ParseXS" : "2.02", + "Pod::Text" : "0", + "ExtUtils::Install" : "0.3", + "Archive::Tar" : "1.00" + } + }, + "build" : { + "requires" : { + "Build::Requires": "1.1", + "Test::More" : "0" + } + }, + "test" : { + "requires" : { + "Test::More" : "0.88", + "Test::Requires" : "1.2" + } + } + }, + "optional_features" : { + "domination" : { + "prereqs" : { + "develop" : { + "requires" : { + "Genius::Evil" : "1.234" + } + }, + "runtime" : { + "requires" : { + "Machine::Weather" : "2.0" + } + } + }, + "description" : "Take over the world" + } + }, + "abstract" : "Build and install Perl modules", + "x_whatever" : "Custom key" +} diff --git a/cpan/CPAN-Meta/t/data-fixable/meta-spec-version-trailing-zeros.yml b/cpan/CPAN-Meta/t/data-fixable/meta-spec-version-trailing-zeros.yml new file mode 100644 index 0000000000..92445cbada --- /dev/null +++ b/cpan/CPAN-Meta/t/data-fixable/meta-spec-version-trailing-zeros.yml @@ -0,0 +1,132 @@ +--- +abstract: 'Build and install Perl modules' +author: + - 'Ken Williams <kwilliams@cpan.org>' + - "Development questions, bug reports, and patches should be sent to the\nModule-Build mailing list at <module-build@perl.org>." +build_requires: + File::Temp: 0.15 + Test::Harness: 3.16 + Test::More: 0.49 +generated_by: 'Module::Build version 0.3608' +license: perl +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: 1.400 +name: Module-Build +provides: + Module::Build: + file: lib/Module/Build.pm + version: 0.36_08 + Module::Build::Base: + file: lib/Module/Build/Base.pm + version: 0.36_08 + Module::Build::Compat: + file: lib/Module/Build/Compat.pm + version: 0.36_08 + Module::Build::Config: + file: lib/Module/Build/Config.pm + version: 0.36_08 + Module::Build::Cookbook: + file: lib/Module/Build/Cookbook.pm + version: 0.36_08 + Module::Build::Dumper: + file: lib/Module/Build/Dumper.pm + version: 0.36_08 + Module::Build::ModuleInfo: + file: lib/Module/Build/ModuleInfo.pm + version: 0.36_08 + Module::Build::Notes: + file: lib/Module/Build/Notes.pm + version: 0.36_08 + Module::Build::PPMMaker: + file: lib/Module/Build/PPMMaker.pm + version: 0.36_08 + Module::Build::Platform::Amiga: + file: lib/Module/Build/Platform/Amiga.pm + version: 0.36_08 + Module::Build::Platform::Default: + file: lib/Module/Build/Platform/Default.pm + version: 0.36_08 + Module::Build::Platform::EBCDIC: + file: lib/Module/Build/Platform/EBCDIC.pm + version: 0.36_08 + Module::Build::Platform::MPEiX: + file: lib/Module/Build/Platform/MPEiX.pm + version: 0.36_08 + Module::Build::Platform::MacOS: + file: lib/Module/Build/Platform/MacOS.pm + version: 0.36_08 + Module::Build::Platform::RiscOS: + file: lib/Module/Build/Platform/RiscOS.pm + version: 0.36_08 + Module::Build::Platform::Unix: + file: lib/Module/Build/Platform/Unix.pm + version: 0.36_08 + Module::Build::Platform::VMS: + file: lib/Module/Build/Platform/VMS.pm + version: 0.36_08 + Module::Build::Platform::VOS: + file: lib/Module/Build/Platform/VOS.pm + version: 0.36_08 + Module::Build::Platform::Windows: + file: lib/Module/Build/Platform/Windows.pm + version: 0.36_08 + Module::Build::Platform::aix: + file: lib/Module/Build/Platform/aix.pm + version: 0.36_08 + Module::Build::Platform::cygwin: + file: lib/Module/Build/Platform/cygwin.pm + version: 0.36_08 + Module::Build::Platform::darwin: + file: lib/Module/Build/Platform/darwin.pm + version: 0.36_08 + Module::Build::Platform::os2: + file: lib/Module/Build/Platform/os2.pm + version: 0.36_08 + Module::Build::PodParser: + file: lib/Module/Build/PodParser.pm + version: 0.36_08 + Module::Build::Version: + file: lib/Module/Build/Version.pm + version: 0.77 + Module::Build::YAML: + file: lib/Module/Build/YAML.pm + version: 1.40 + inc::latest: + file: lib/inc/latest.pm + version: 0.36_08 + inc::latest::private: + file: lib/inc/latest/private.pm + version: 0.36_08 +recommends: + ExtUtils::Install: 0.3 + ExtUtils::Manifest: 1.54 + version: 0.74 +requires: + Cwd: 0 + Data::Dumper: 0 + ExtUtils::CBuilder: 0.27 + ExtUtils::Install: 0 + ExtUtils::Manifest: 0 + ExtUtils::Mkbootstrap: 0 + ExtUtils::ParseXS: 2.21 + File::Basename: 0 + File::Compare: 0 + File::Copy: 0 + File::Find: 0 + File::Path: 0 + File::Spec: 0.82 + Getopt::Long: 0 + IO::File: 0 + Test::Harness: 0 + Text::Abbrev: 0 + Text::ParseWords: 0 + perl: 5.006001 +resources: + MailingList: mailto:module-build@perl.org + license: http://dev.perl.org/licenses/ + repository: http://github.com/dagolden/module-build/ +version: 0.36_08 +x-whatever: this is a custom field +x_whatelse: so is this +XWhatNow: and this diff --git a/cpan/CPAN-Meta/t/data-bad/restrictive-2.json b/cpan/CPAN-Meta/t/data-fixable/restrictive-2.json index 2fdd9fb39a..2fdd9fb39a 100644 --- a/cpan/CPAN-Meta/t/data-bad/restrictive-2.json +++ b/cpan/CPAN-Meta/t/data-fixable/restrictive-2.json diff --git a/cpan/CPAN-Meta/t/data-bad/version-ranges-2.json b/cpan/CPAN-Meta/t/data-fixable/version-ranges-2.json index 8c13c75274..8c13c75274 100644 --- a/cpan/CPAN-Meta/t/data-bad/version-ranges-2.json +++ b/cpan/CPAN-Meta/t/data-fixable/version-ranges-2.json diff --git a/cpan/CPAN-Meta/t/data/META-1_0.yml b/cpan/CPAN-Meta/t/data-test/META-1_0.yml index e72d9ed944..e72d9ed944 100644 --- a/cpan/CPAN-Meta/t/data/META-1_0.yml +++ b/cpan/CPAN-Meta/t/data-test/META-1_0.yml diff --git a/cpan/CPAN-Meta/t/data/META-1_1.yml b/cpan/CPAN-Meta/t/data-test/META-1_1.yml index d77007737f..d77007737f 100644 --- a/cpan/CPAN-Meta/t/data/META-1_1.yml +++ b/cpan/CPAN-Meta/t/data-test/META-1_1.yml diff --git a/cpan/CPAN-Meta/t/data/META-1_2.yml b/cpan/CPAN-Meta/t/data-test/META-1_2.yml index 51c2a963bc..51c2a963bc 100644 --- a/cpan/CPAN-Meta/t/data/META-1_2.yml +++ b/cpan/CPAN-Meta/t/data-test/META-1_2.yml diff --git a/cpan/CPAN-Meta/t/data/META-1_3.yml b/cpan/CPAN-Meta/t/data-test/META-1_3.yml index c26a3e0b74..c26a3e0b74 100644 --- a/cpan/CPAN-Meta/t/data/META-1_3.yml +++ b/cpan/CPAN-Meta/t/data-test/META-1_3.yml diff --git a/cpan/CPAN-Meta/t/data/META-1_4.yml b/cpan/CPAN-Meta/t/data-test/META-1_4.yml index 801f5797c0..801f5797c0 100644 --- a/cpan/CPAN-Meta/t/data/META-1_4.yml +++ b/cpan/CPAN-Meta/t/data-test/META-1_4.yml diff --git a/cpan/CPAN-Meta/t/data/META-2.json b/cpan/CPAN-Meta/t/data-test/META-2.json index d737fef231..d737fef231 100644 --- a/cpan/CPAN-Meta/t/data/META-2.json +++ b/cpan/CPAN-Meta/t/data-test/META-2.json diff --git a/cpan/CPAN-Meta/t/data/gpl-1_4.yml b/cpan/CPAN-Meta/t/data-test/gpl-1_4.yml index 8437961eaa..8437961eaa 100644 --- a/cpan/CPAN-Meta/t/data/gpl-1_4.yml +++ b/cpan/CPAN-Meta/t/data-test/gpl-1_4.yml diff --git a/cpan/CPAN-Meta/t/data/provides-version-missing.json b/cpan/CPAN-Meta/t/data-test/provides-version-missing.json index 2264e92e6b..2264e92e6b 100644 --- a/cpan/CPAN-Meta/t/data/provides-version-missing.json +++ b/cpan/CPAN-Meta/t/data-test/provides-version-missing.json diff --git a/cpan/CPAN-Meta/t/data/resources.yml b/cpan/CPAN-Meta/t/data-test/resources.yml index 8013137784..8013137784 100644 --- a/cpan/CPAN-Meta/t/data/resources.yml +++ b/cpan/CPAN-Meta/t/data-test/resources.yml diff --git a/cpan/CPAN-Meta/t/data/restricted-2.json b/cpan/CPAN-Meta/t/data-test/restricted-2.json index 88886db9fc..88886db9fc 100644 --- a/cpan/CPAN-Meta/t/data/restricted-2.json +++ b/cpan/CPAN-Meta/t/data-test/restricted-2.json diff --git a/cpan/CPAN-Meta/t/data/restrictive-1_4.yml b/cpan/CPAN-Meta/t/data-test/restrictive-1_4.yml index b780016da2..b780016da2 100644 --- a/cpan/CPAN-Meta/t/data/restrictive-1_4.yml +++ b/cpan/CPAN-Meta/t/data-test/restrictive-1_4.yml diff --git a/cpan/CPAN-Meta/t/data/unicode.yml b/cpan/CPAN-Meta/t/data-test/unicode.yml index 8aa5bca742..8aa5bca742 100644 --- a/cpan/CPAN-Meta/t/data/unicode.yml +++ b/cpan/CPAN-Meta/t/data-test/unicode.yml diff --git a/cpan/CPAN-Meta/t/data/version-not-normal.json b/cpan/CPAN-Meta/t/data-test/version-not-normal.json index a275a86faa..a275a86faa 100644 --- a/cpan/CPAN-Meta/t/data/version-not-normal.json +++ b/cpan/CPAN-Meta/t/data-test/version-not-normal.json diff --git a/cpan/CPAN-Meta/t/data/version-ranges-1_4.yml b/cpan/CPAN-Meta/t/data-test/version-ranges-1_4.yml index 7fb3c65061..7fb3c65061 100644 --- a/cpan/CPAN-Meta/t/data/version-ranges-1_4.yml +++ b/cpan/CPAN-Meta/t/data-test/version-ranges-1_4.yml diff --git a/cpan/CPAN-Meta/t/data/version-ranges-2.json b/cpan/CPAN-Meta/t/data-test/version-ranges-2.json index 6d231700ca..6d231700ca 100644 --- a/cpan/CPAN-Meta/t/data/version-ranges-2.json +++ b/cpan/CPAN-Meta/t/data-test/version-ranges-2.json diff --git a/cpan/CPAN-Meta/t/data-bad/1122575719-META.yml b/cpan/CPAN-Meta/t/data-valid/1122575719-META.yml index f37cb284a7..f37cb284a7 100644 --- a/cpan/CPAN-Meta/t/data-bad/1122575719-META.yml +++ b/cpan/CPAN-Meta/t/data-valid/1122575719-META.yml diff --git a/cpan/CPAN-Meta/t/data-bad/1206545041-META.yml b/cpan/CPAN-Meta/t/data-valid/1206545041-META.yml index a8be520dd5..a8be520dd5 100644 --- a/cpan/CPAN-Meta/t/data-bad/1206545041-META.yml +++ b/cpan/CPAN-Meta/t/data-valid/1206545041-META.yml diff --git a/cpan/CPAN-Meta/t/data-bad/1985684504-META.yml b/cpan/CPAN-Meta/t/data-valid/1985684504-META.yml index 4d79f42be1..4d79f42be1 100644 --- a/cpan/CPAN-Meta/t/data-bad/1985684504-META.yml +++ b/cpan/CPAN-Meta/t/data-valid/1985684504-META.yml diff --git a/cpan/CPAN-Meta/t/data-bad/476602558-META.yml b/cpan/CPAN-Meta/t/data-valid/476602558-META.yml index ee78dc4085..ee78dc4085 100644 --- a/cpan/CPAN-Meta/t/data-bad/476602558-META.yml +++ b/cpan/CPAN-Meta/t/data-valid/476602558-META.yml diff --git a/cpan/CPAN-Meta/t/data-bad/META-1_0.yml b/cpan/CPAN-Meta/t/data-valid/META-1_0.yml index 9aaaa119c0..9aaaa119c0 100644 --- a/cpan/CPAN-Meta/t/data-bad/META-1_0.yml +++ b/cpan/CPAN-Meta/t/data-valid/META-1_0.yml diff --git a/cpan/CPAN-Meta/t/data-bad/META-1_1.yml b/cpan/CPAN-Meta/t/data-valid/META-1_1.yml index d90b133324..d90b133324 100644 --- a/cpan/CPAN-Meta/t/data-bad/META-1_1.yml +++ b/cpan/CPAN-Meta/t/data-valid/META-1_1.yml diff --git a/cpan/CPAN-Meta/t/data-valid/scalar-meta-spec.yml b/cpan/CPAN-Meta/t/data-valid/scalar-meta-spec.yml new file mode 100644 index 0000000000..679f281eea --- /dev/null +++ b/cpan/CPAN-Meta/t/data-valid/scalar-meta-spec.yml @@ -0,0 +1,25 @@ +# http://module-build.sourceforge.net/META-spec-new.html +#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# +meta-spec: 1.1 +name: XML-Writer +version: 0.600 +abstract: Easily generate well-formed, namespace-aware XML. +authored_by: + - David Megginson <david@megginson.com> + - Ed Avis <ed@membled.com> + - Joseph Walton <joe@kafsemo.org> +license: perl +distribution_type: module +installdirs: site + +build_requires: + perl: 5.006_000 +recommends: + perl: 5.008_001 + +no_index: + package: + - XML::Writer::Namespaces + +dynamic_config: 0 +generated_by: Hand diff --git a/cpan/CPAN-Meta/t/load-bad.t b/cpan/CPAN-Meta/t/load-bad.t index 22a651079e..c3df3ea99b 100644 --- a/cpan/CPAN-Meta/t/load-bad.t +++ b/cpan/CPAN-Meta/t/load-bad.t @@ -10,12 +10,12 @@ sub _slurp { do { local(@ARGV,$/)=shift(@_); <> } } delete $ENV{$_} for qw/PERL_JSON_BACKEND PERL_YAML_BACKEND/; # use defaults -my $data_dir = IO::Dir->new( 't/data-bad' ); +my $data_dir = IO::Dir->new( 't/data-fixable' ); my @files = sort grep { /^\w/ } $data_dir->read; for my $f ( sort @files ) { - my $path = File::Spec->catfile('t','data-bad',$f); - my $meta = eval { CPAN::Meta->load_file( $path, { fix_errors => 1 } ) }; + my $path = File::Spec->catfile('t','data-fixable',$f); + my $meta = eval { CPAN::Meta->load_file( $path ) }; ok( defined $meta, "load_file('$f')" ) or diag $@; my $string = _slurp($path); my $method = $path =~ /\.json/ ? "load_json_string" : "load_yaml_string"; diff --git a/cpan/CPAN-Meta/t/prereqs.t b/cpan/CPAN-Meta/t/prereqs.t index 6142d6386a..ad21caa9f0 100644 --- a/cpan/CPAN-Meta/t/prereqs.t +++ b/cpan/CPAN-Meta/t/prereqs.t @@ -113,11 +113,51 @@ is_deeply($prereq->as_string_hash, $prereq_struct, "round-trip okay"); ->requirements_for(qw(runtime requires)) ->add_minimum(Bar => '2.976'); + $new_prereq + ->requirements_for(qw(test requires)) + ->add_minimum(Baz => '3.1416'); + + $new_prereq + ->requirements_for(qw(build recommends)) + ->add_minimum(Bar => '3.000'); + + my $expect = { + runtime => { requires => { Foo => '1.000', Bar => '2.976' } }, + test => { requires => { Baz => '3.1416' } }, + build => { recommends => { Bar => '3.000' } }, + }; + is_deeply( $new_prereq->as_string_hash, - { runtime => { requires => { Foo => '1.000', Bar => '2.976' } } }, + $expect, 'we can accumulate new requirements on a prereq object', ); + + my $merged_requires = { + Foo => '1.000', + Bar => '2.976', + Baz => '3.1416', + }; + + my $merged_all = { + Foo => '1.000', + Bar => '3.000', + Baz => '3.1416', + }; + + is_deeply( + $new_prereq->merged_requirements( + [qw/runtime test build/], [qw/requires/] + )->as_string_hash, + $merged_requires, + "we can merge requirements for phases/types" + ); + + is_deeply( + $new_prereq->merged_requirements->as_string_hash, + $merged_all, + "default merging is runtime/build/test for requires/recommends" + ); } done_testing; diff --git a/cpan/CPAN-Meta/t/save-load.t b/cpan/CPAN-Meta/t/save-load.t index 79650b1d93..3c68f90d67 100644 --- a/cpan/CPAN-Meta/t/save-load.t +++ b/cpan/CPAN-Meta/t/save-load.t @@ -84,7 +84,7 @@ ok( my $loaded = Parse::CPAN::Meta->load_file($metafile), 'load saved file' ); is($loaded->{name}, 'Module-Build', 'name correct'); -ok( $loaded = Parse::CPAN::Meta->load_file('t/data/META-1_4.yml'), 'load META-1.4' ); +ok( $loaded = Parse::CPAN::Meta->load_file('t/data-test/META-1_4.yml'), 'load META-1.4' ); is($loaded->{name}, 'Module-Build', 'name correct'); # Test saving with conversion diff --git a/cpan/CPAN-Meta/t/validator.t b/cpan/CPAN-Meta/t/validator.t index 847f768ed5..4fce19256b 100644 --- a/cpan/CPAN-Meta/t/validator.t +++ b/cpan/CPAN-Meta/t/validator.t @@ -11,11 +11,14 @@ use Parse::CPAN::Meta 1.4400; delete $ENV{$_} for qw/PERL_JSON_BACKEND PERL_YAML_BACKEND/; # use defaults { - my $data_dir = IO::Dir->new( 't/data' ); - my @files = sort grep { /^\w/ } $data_dir->read; + my @data_dirs = qw( t/data-test t/data-valid ); + my @files = sort map { + my $d = $_; + map { "$d/$_" } grep { substr($_,0,1) ne '.' } IO::Dir->new($d)->read + } @data_dirs; for my $f ( @files ) { - my $meta = Parse::CPAN::Meta->load_file( File::Spec->catfile('t','data',$f) ); + my $meta = Parse::CPAN::Meta->load_file( File::Spec->catfile($f) ); my $cmv = CPAN::Meta::Validator->new({%$meta}); ok( $cmv->is_valid, "$f validates" ) or diag( "ERRORS:\n" . join( "\n", $cmv->errors ) ); @@ -23,13 +26,16 @@ delete $ENV{$_} for qw/PERL_JSON_BACKEND PERL_YAML_BACKEND/; # use defaults } { - my $data_dir = IO::Dir->new( 't/data-fail' ); - my @files = sort grep { /^\w/ } $data_dir->read; + my @data_dirs = qw( t/data-fail t/data-fixable ); + my @files = sort map { + my $d = $_; + map { "$d/$_" } grep { substr($_,0,1) ne '.' } IO::Dir->new($d)->read + } @data_dirs; for my $f ( @files ) { - my $meta = Parse::CPAN::Meta->load_file( File::Spec->catfile('t','data-fail',$f) ); + my $meta = Parse::CPAN::Meta->load_file( File::Spec->catfile($f) ); my $cmv = CPAN::Meta::Validator->new({%$meta}); - ok( ! $cmv->is_valid, "invalid $f doesn't validate" ); + ok( ! $cmv->is_valid, "$f shouldn't validate" ); } } |