Upgrade CPAN::Meta from 2.132661 to 2.132830
authorSteve Hay <steve.m.hay@googlemail.com>
Fri, 11 Oct 2013 08:16:54 +0000 (09:16 +0100)
committerSteve Hay <steve.m.hay@googlemail.com>
Fri, 11 Oct 2013 08:16:54 +0000 (09:16 +0100)
61 files changed:
MANIFEST
META.json
META.yml
Porting/Maintainers.pl
cpan/CPAN-Meta/Changes
cpan/CPAN-Meta/lib/CPAN/Meta.pm
cpan/CPAN-Meta/lib/CPAN/Meta/Converter.pm
cpan/CPAN-Meta/lib/CPAN/Meta/Feature.pm
cpan/CPAN-Meta/lib/CPAN/Meta/History.pm
cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm
cpan/CPAN-Meta/lib/CPAN/Meta/Spec.pm
cpan/CPAN-Meta/lib/CPAN/Meta/Validator.pm
cpan/CPAN-Meta/t/converter-bad.t
cpan/CPAN-Meta/t/converter-fail.t
cpan/CPAN-Meta/t/converter.t
cpan/CPAN-Meta/t/data-fixable/107650337-META.yml [moved from cpan/CPAN-Meta/t/data-bad/107650337-META.yml with 100% similarity]
cpan/CPAN-Meta/t/data-fixable/1598804075-META.yml [moved from cpan/CPAN-Meta/t/data-bad/1598804075-META.yml with 100% similarity]
cpan/CPAN-Meta/t/data-fixable/1927486199-META.yml [moved from cpan/CPAN-Meta/t/data-bad/1927486199-META.yml with 100% similarity]
cpan/CPAN-Meta/t/data-fixable/1985980974-META.yml [moved from cpan/CPAN-Meta/t/data-bad/1985980974-META.yml with 100% similarity]
cpan/CPAN-Meta/t/data-fixable/2031017050-META.yml [moved from cpan/CPAN-Meta/t/data-bad/2031017050-META.yml with 100% similarity]
cpan/CPAN-Meta/t/data-fixable/284247103-META.yml [moved from cpan/CPAN-Meta/t/data-bad/284247103-META.yml with 100% similarity]
cpan/CPAN-Meta/t/data-fixable/344981821-META.yml [moved from cpan/CPAN-Meta/t/data-bad/344981821-META.yml with 100% similarity]
cpan/CPAN-Meta/t/data-fixable/35478989-META.yml [moved from cpan/CPAN-Meta/t/data-bad/35478989-META.yml with 100% similarity]
cpan/CPAN-Meta/t/data-fixable/98042513-META.yml [moved from cpan/CPAN-Meta/t/data-bad/98042513-META.yml with 100% similarity]
cpan/CPAN-Meta/t/data-fixable/META-1_2.yml [moved from cpan/CPAN-Meta/t/data-bad/META-1_2.yml with 100% similarity]
cpan/CPAN-Meta/t/data-fixable/META-1_3.yml [moved from cpan/CPAN-Meta/t/data-bad/META-1_3.yml with 100% similarity]
cpan/CPAN-Meta/t/data-fixable/META-1_4.yml [moved from cpan/CPAN-Meta/t/data-bad/META-1_4.yml with 100% similarity]
cpan/CPAN-Meta/t/data-fixable/META-2.json [moved from cpan/CPAN-Meta/t/data-bad/META-2.json with 100% similarity]
cpan/CPAN-Meta/t/data-fixable/invalid-meta-spec-version.json [new file with mode: 0644]
cpan/CPAN-Meta/t/data-fixable/invalid-meta-spec-version.yml [new file with mode: 0644]
cpan/CPAN-Meta/t/data-fixable/meta-spec-version-trailing-zeros.json [new file with mode: 0644]
cpan/CPAN-Meta/t/data-fixable/meta-spec-version-trailing-zeros.yml [new file with mode: 0644]
cpan/CPAN-Meta/t/data-fixable/restrictive-2.json [moved from cpan/CPAN-Meta/t/data-bad/restrictive-2.json with 100% similarity]
cpan/CPAN-Meta/t/data-fixable/version-ranges-2.json [moved from cpan/CPAN-Meta/t/data-bad/version-ranges-2.json with 100% similarity]
cpan/CPAN-Meta/t/data-test/META-1_0.yml [moved from cpan/CPAN-Meta/t/data/META-1_0.yml with 100% similarity]
cpan/CPAN-Meta/t/data-test/META-1_1.yml [moved from cpan/CPAN-Meta/t/data/META-1_1.yml with 100% similarity]
cpan/CPAN-Meta/t/data-test/META-1_2.yml [moved from cpan/CPAN-Meta/t/data/META-1_2.yml with 100% similarity]
cpan/CPAN-Meta/t/data-test/META-1_3.yml [moved from cpan/CPAN-Meta/t/data/META-1_3.yml with 100% similarity]
cpan/CPAN-Meta/t/data-test/META-1_4.yml [moved from cpan/CPAN-Meta/t/data/META-1_4.yml with 100% similarity]
cpan/CPAN-Meta/t/data-test/META-2.json [moved from cpan/CPAN-Meta/t/data/META-2.json with 100% similarity]
cpan/CPAN-Meta/t/data-test/gpl-1_4.yml [moved from cpan/CPAN-Meta/t/data/gpl-1_4.yml with 100% similarity]
cpan/CPAN-Meta/t/data-test/provides-version-missing.json [moved from cpan/CPAN-Meta/t/data/provides-version-missing.json with 100% similarity]
cpan/CPAN-Meta/t/data-test/resources.yml [moved from cpan/CPAN-Meta/t/data/resources.yml with 100% similarity]
cpan/CPAN-Meta/t/data-test/restricted-2.json [moved from cpan/CPAN-Meta/t/data/restricted-2.json with 100% similarity]
cpan/CPAN-Meta/t/data-test/restrictive-1_4.yml [moved from cpan/CPAN-Meta/t/data/restrictive-1_4.yml with 100% similarity]
cpan/CPAN-Meta/t/data-test/unicode.yml [moved from cpan/CPAN-Meta/t/data/unicode.yml with 100% similarity]
cpan/CPAN-Meta/t/data-test/version-not-normal.json [moved from cpan/CPAN-Meta/t/data/version-not-normal.json with 100% similarity]
cpan/CPAN-Meta/t/data-test/version-ranges-1_4.yml [moved from cpan/CPAN-Meta/t/data/version-ranges-1_4.yml with 100% similarity]
cpan/CPAN-Meta/t/data-test/version-ranges-2.json [moved from cpan/CPAN-Meta/t/data/version-ranges-2.json with 100% similarity]
cpan/CPAN-Meta/t/data-valid/1122575719-META.yml [moved from cpan/CPAN-Meta/t/data-bad/1122575719-META.yml with 100% similarity]
cpan/CPAN-Meta/t/data-valid/1206545041-META.yml [moved from cpan/CPAN-Meta/t/data-bad/1206545041-META.yml with 100% similarity]
cpan/CPAN-Meta/t/data-valid/1985684504-META.yml [moved from cpan/CPAN-Meta/t/data-bad/1985684504-META.yml with 100% similarity]
cpan/CPAN-Meta/t/data-valid/476602558-META.yml [moved from cpan/CPAN-Meta/t/data-bad/476602558-META.yml with 100% similarity]
cpan/CPAN-Meta/t/data-valid/META-1_0.yml [moved from cpan/CPAN-Meta/t/data-bad/META-1_0.yml with 100% similarity]
cpan/CPAN-Meta/t/data-valid/META-1_1.yml [moved from cpan/CPAN-Meta/t/data-bad/META-1_1.yml with 100% similarity]
cpan/CPAN-Meta/t/data-valid/scalar-meta-spec.yml [new file with mode: 0644]
cpan/CPAN-Meta/t/load-bad.t
cpan/CPAN-Meta/t/prereqs.t
cpan/CPAN-Meta/t/save-load.t
cpan/CPAN-Meta/t/validator.t
pod/perldelta.pod

index 8931487..f9c7e2a 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -320,48 +320,53 @@ cpan/CPAN-Meta-Requirements/t/merge.t
 cpan/CPAN-Meta/t/converter-bad.t
 cpan/CPAN-Meta/t/converter-fail.t
 cpan/CPAN-Meta/t/converter.t
-cpan/CPAN-Meta/t/data-bad/107650337-META.yml
-cpan/CPAN-Meta/t/data-bad/1122575719-META.yml
-cpan/CPAN-Meta/t/data-bad/1206545041-META.yml
-cpan/CPAN-Meta/t/data-bad/1598804075-META.yml
-cpan/CPAN-Meta/t/data-bad/1927486199-META.yml
-cpan/CPAN-Meta/t/data-bad/1985684504-META.yml
-cpan/CPAN-Meta/t/data-bad/1985980974-META.yml
-cpan/CPAN-Meta/t/data-bad/2031017050-META.yml
-cpan/CPAN-Meta/t/data-bad/284247103-META.yml
-cpan/CPAN-Meta/t/data-bad/344981821-META.yml
-cpan/CPAN-Meta/t/data-bad/35478989-META.yml
-cpan/CPAN-Meta/t/data-bad/476602558-META.yml
-cpan/CPAN-Meta/t/data-bad/98042513-META.yml
-cpan/CPAN-Meta/t/data-bad/META-1_0.yml
-cpan/CPAN-Meta/t/data-bad/META-1_1.yml
-cpan/CPAN-Meta/t/data-bad/META-1_2.yml
-cpan/CPAN-Meta/t/data-bad/META-1_3.yml
-cpan/CPAN-Meta/t/data-bad/META-1_4.yml
-cpan/CPAN-Meta/t/data-bad/META-2.json
-cpan/CPAN-Meta/t/data-bad/restrictive-2.json
-cpan/CPAN-Meta/t/data-bad/version-ranges-2.json
 cpan/CPAN-Meta/t/data-fail/META-1_0.yml
 cpan/CPAN-Meta/t/data-fail/META-1_1.yml
 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
-cpan/CPAN-Meta/t/data/META-1_3.yml
-cpan/CPAN-Meta/t/data/META-1_4.yml
-cpan/CPAN-Meta/t/data/META-2.json
-cpan/CPAN-Meta/t/data/provides-version-missing.json
-cpan/CPAN-Meta/t/data/resources.yml
-cpan/CPAN-Meta/t/data/restricted-2.json
-cpan/CPAN-Meta/t/data/restrictive-1_4.yml
-cpan/CPAN-Meta/t/data/unicode.yml
-cpan/CPAN-Meta/t/data/version-not-normal.json
-cpan/CPAN-Meta/t/data/version-ranges-1_4.yml
-cpan/CPAN-Meta/t/data/version-ranges-2.json
+cpan/CPAN-Meta/t/data-fixable/107650337-META.yml
+cpan/CPAN-Meta/t/data-fixable/1598804075-META.yml
+cpan/CPAN-Meta/t/data-fixable/1927486199-META.yml
+cpan/CPAN-Meta/t/data-fixable/1985980974-META.yml
+cpan/CPAN-Meta/t/data-fixable/2031017050-META.yml
+cpan/CPAN-Meta/t/data-fixable/284247103-META.yml
+cpan/CPAN-Meta/t/data-fixable/344981821-META.yml
+cpan/CPAN-Meta/t/data-fixable/35478989-META.yml
+cpan/CPAN-Meta/t/data-fixable/98042513-META.yml
+cpan/CPAN-Meta/t/data-fixable/META-1_2.yml
+cpan/CPAN-Meta/t/data-fixable/META-1_3.yml
+cpan/CPAN-Meta/t/data-fixable/META-1_4.yml
+cpan/CPAN-Meta/t/data-fixable/META-2.json
+cpan/CPAN-Meta/t/data-fixable/invalid-meta-spec-version.json
+cpan/CPAN-Meta/t/data-fixable/invalid-meta-spec-version.yml
+cpan/CPAN-Meta/t/data-fixable/meta-spec-version-trailing-zeros.json
+cpan/CPAN-Meta/t/data-fixable/meta-spec-version-trailing-zeros.yml
+cpan/CPAN-Meta/t/data-fixable/restrictive-2.json
+cpan/CPAN-Meta/t/data-fixable/version-ranges-2.json
+cpan/CPAN-Meta/t/data-test/gpl-1_4.yml
+cpan/CPAN-Meta/t/data-test/META-1_0.yml
+cpan/CPAN-Meta/t/data-test/META-1_1.yml
+cpan/CPAN-Meta/t/data-test/META-1_2.yml
+cpan/CPAN-Meta/t/data-test/META-1_3.yml
+cpan/CPAN-Meta/t/data-test/META-1_4.yml
+cpan/CPAN-Meta/t/data-test/META-2.json
+cpan/CPAN-Meta/t/data-test/provides-version-missing.json
+cpan/CPAN-Meta/t/data-test/resources.yml
+cpan/CPAN-Meta/t/data-test/restricted-2.json
+cpan/CPAN-Meta/t/data-test/restrictive-1_4.yml
+cpan/CPAN-Meta/t/data-test/unicode.yml
+cpan/CPAN-Meta/t/data-test/version-not-normal.json
+cpan/CPAN-Meta/t/data-test/version-ranges-1_4.yml
+cpan/CPAN-Meta/t/data-test/version-ranges-2.json
+cpan/CPAN-Meta/t/data-valid/1122575719-META.yml
+cpan/CPAN-Meta/t/data-valid/1206545041-META.yml
+cpan/CPAN-Meta/t/data-valid/1985684504-META.yml
+cpan/CPAN-Meta/t/data-valid/476602558-META.yml
+cpan/CPAN-Meta/t/data-valid/META-1_0.yml
+cpan/CPAN-Meta/t/data-valid/META-1_1.yml
+cpan/CPAN-Meta/t/data-valid/scalar-meta-spec.yml
 cpan/CPAN-Meta/t/load-bad.t
 cpan/CPAN-Meta/t/meta-obj.t
 cpan/CPAN-Meta/t/no-index.t
index 7506812..3fd7a0d 100644 (file)
--- a/META.json
+++ b/META.json
@@ -4,7 +4,7 @@
       "perl5-porters@perl.org"
    ],
    "dynamic_config" : 1,
-   "generated_by" : "CPAN::Meta version 2.132661",
+   "generated_by" : "CPAN::Meta version 2.132830",
    "license" : [
       "perl_5"
    ],
index 4a3bcd4..73b0bd6 100644 (file)
--- a/META.yml
+++ b/META.yml
@@ -4,7 +4,7 @@ author:
   - perl5-porters@perl.org
 build_requires: {}
 dynamic_config: 1
-generated_by: 'CPAN::Meta version 2.132661, CPAN::Meta::Converter version 2.132661'
+generated_by: 'CPAN::Meta version 2.132830, CPAN::Meta::Converter version 2.132830'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
index b026ff8..4e392a7 100755 (executable)
@@ -375,11 +375,12 @@ use File::Glob qw(:case);
     # Note: When updating CPAN-Meta the META.* files will need to be regenerated
     # perl -Icpan/CPAN-Meta/lib Porting/makemeta
     'CPAN::Meta' => {
-        'DISTRIBUTION' => 'DAGOLDEN/CPAN-Meta-2.132661.tar.gz',
+        'DISTRIBUTION' => 'DAGOLDEN/CPAN-Meta-2.132830.tar.gz',
         'FILES'        => q[cpan/CPAN-Meta],
         'EXCLUDED'     => [
             qw(t/00-compile.t),
             qw[t/00-report-prereqs.t],
+            qr{t/README-data.txt},
             qr{^xt},
             qr{^history},
         ],
index 62406e9..a96d888 100644 (file)
@@ -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]
index 9825f4a..25a4d1a 100644 (file)
@@ -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 *
 
index 828991d..2825eb2 100644 (file)
@@ -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
 
index f54078a..978aa3d 100644 (file)
@@ -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
 
index dce6104..d52e8c7 100644 (file)
@@ -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
 
index b68c500..169b28e 100644 (file)
@@ -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
index ebfda83..cbc0ff9 100644 (file)
@@ -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
 
index 8df51d7..8fabd4b 100644 (file)
@@ -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
 
index fdfea25..f9e7d59 100644 (file)
@@ -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");
index 065b3d7..b9cfedd 100644 (file)
@@ -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" );
   }
 }
index a5a55a2..e963168 100644 (file)
@@ -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-fixable/invalid-meta-spec-version.json b/cpan/CPAN-Meta/t/data-fixable/invalid-meta-spec-version.json
new file mode 100644 (file)
index 0000000..183781b
--- /dev/null
@@ -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 (file)
index 0000000..d74cde6
--- /dev/null
@@ -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 (file)
index 0000000..3990195
--- /dev/null
@@ -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 (file)
index 0000000..92445cb
--- /dev/null
@@ -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-valid/scalar-meta-spec.yml b/cpan/CPAN-Meta/t/data-valid/scalar-meta-spec.yml
new file mode 100644 (file)
index 0000000..679f281
--- /dev/null
@@ -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
index 22a6510..c3df3ea 100644 (file)
@@ -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";
index 6142d63..ad21caa 100644 (file)
@@ -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;
index 79650b1..3c68f90 100644 (file)
@@ -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
index 847f768..4fce192 100644 (file)
@@ -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" );
   }
 }
 
index 8082177..ed0d8cb 100644 (file)
@@ -167,6 +167,14 @@ keep in sync with the latest CPAN release.
 
 =item *
 
+L<CPAN::Meta> has been upgraded from version 2.132661 to 2.132830.
+
+L<CPAN::Meta::Prereqs> now has a C<merged_requirements> method for combining
+requirements across multiple phases and types, and an invalid 'meta-spec' is no
+longer a fatal error.
+
+=item *
+
 L<File::Temp> has been upgraded from version 0.2302 to 0.2304.
 
 Required versions of other modules used are now listed more explicitly.