summaryrefslogtreecommitdiff
path: root/cpan/CPAN-Meta
diff options
context:
space:
mode:
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>2015-06-11 16:28:11 +0100
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>2015-06-11 16:28:11 +0100
commit2b771c51706b5815f1928ec88c49b535095adea6 (patch)
tree575c0e4775e4b2a3a493cc5ce1cba3abe6b7a0ff /cpan/CPAN-Meta
parent89d84ff965b644c21c4c0633253e4cb21f72b62c (diff)
downloadperl-2b771c51706b5815f1928ec88c49b535095adea6.tar.gz
Update CPAN-Meta to CPAN release 2.150005
[DELTA] 2.150005 2015-06-09 19:08:44-06:00 America/Denver [TESTING] - Changed some test data from UTF-8 to ASCII 2.150004 2015-05-19 11:25:53-04:00 America/New_York (TRIAL RELEASE) [DOCUMENTED] - Noted explicitly that historical META spec files are licensed under the same terms as Perl [TESTING] - Added test for 'x_deprecated' field in "provides" [META] - declared extra developer prereq 2.150003 2015-04-21 19:41:15-04:00 America/New_York (TRIAL RELEASE) [CHANGED] - Serialized CPAN::Meta objects now include a x_serialization_backend entry 2.150002 2015-04-19 01:00:10+02:00 Europe/Berlin (TRIAL RELEASE) [CHANGED] - Metadata merging now does deep hash merging as long as keys don't conflict
Diffstat (limited to 'cpan/CPAN-Meta')
-rw-r--r--cpan/CPAN-Meta/lib/CPAN/Meta.pm35
-rw-r--r--cpan/CPAN-Meta/lib/CPAN/Meta/Converter.pm10
-rw-r--r--cpan/CPAN-Meta/lib/CPAN/Meta/Feature.pm11
-rw-r--r--cpan/CPAN-Meta/lib/CPAN/Meta/History.pm4
-rw-r--r--cpan/CPAN-Meta/lib/CPAN/Meta/History/Meta_1_0.pod3
-rw-r--r--cpan/CPAN-Meta/lib/CPAN/Meta/History/Meta_1_1.pod3
-rw-r--r--cpan/CPAN-Meta/lib/CPAN/Meta/History/Meta_1_2.pod3
-rw-r--r--cpan/CPAN-Meta/lib/CPAN/Meta/History/Meta_1_3.pod3
-rw-r--r--cpan/CPAN-Meta/lib/CPAN/Meta/History/Meta_1_4.pod3
-rw-r--r--cpan/CPAN-Meta/lib/CPAN/Meta/Merge.pm25
-rw-r--r--cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm15
-rw-r--r--cpan/CPAN-Meta/lib/CPAN/Meta/Spec.pm4
-rw-r--r--cpan/CPAN-Meta/lib/CPAN/Meta/Validator.pm11
-rw-r--r--cpan/CPAN-Meta/t/converter-bad.t2
-rw-r--r--cpan/CPAN-Meta/t/converter-fail.t2
-rw-r--r--cpan/CPAN-Meta/t/converter-fragments.t4
-rw-r--r--cpan/CPAN-Meta/t/converter.t12
-rw-r--r--cpan/CPAN-Meta/t/data-test/preserve-release-status.yml13
-rw-r--r--cpan/CPAN-Meta/t/load-bad.t8
-rw-r--r--cpan/CPAN-Meta/t/merge.t64
-rw-r--r--cpan/CPAN-Meta/t/meta-obj.t1
-rw-r--r--cpan/CPAN-Meta/t/no-index.t1
-rw-r--r--cpan/CPAN-Meta/t/optional_feature-merge.t8
-rw-r--r--cpan/CPAN-Meta/t/prereqs-finalize.t5
-rw-r--r--cpan/CPAN-Meta/t/prereqs-merge.t1
-rw-r--r--cpan/CPAN-Meta/t/prereqs.t2
-rw-r--r--cpan/CPAN-Meta/t/repository.t1
-rw-r--r--cpan/CPAN-Meta/t/save-load.t22
-rw-r--r--cpan/CPAN-Meta/t/validator.t3
29 files changed, 217 insertions, 62 deletions
diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta.pm b/cpan/CPAN-Meta/lib/CPAN/Meta.pm
index 2a78691906..afbb221855 100644
--- a/cpan/CPAN-Meta/lib/CPAN/Meta.pm
+++ b/cpan/CPAN-Meta/lib/CPAN/Meta.pm
@@ -3,7 +3,7 @@ use strict;
use warnings;
package CPAN::Meta;
-our $VERSION = '2.150001';
+our $VERSION = '2.150005';
#pod =head1 SYNOPSIS
#pod
@@ -591,6 +591,10 @@ sub as_struct {
#pod both cases, the same rules are followed as in the C<save()> method for choosing
#pod a serialization backend.
#pod
+#pod The serialized structure will include a C<x_serialization_backend> entry giving
+#pod the package and version used to serialize. Any existing key in the given
+#pod C<$meta> object will be clobbered.
+#pod
#pod =cut
sub as_string {
@@ -610,10 +614,14 @@ sub as_string {
my ($data, $backend);
if ( $version ge '2' ) {
$backend = Parse::CPAN::Meta->json_backend();
+ local $struct->{x_serialization_backend} = sprintf '%s version %s',
+ $backend, $backend->VERSION;
$data = $backend->new->pretty->canonical->encode($struct);
}
else {
$backend = Parse::CPAN::Meta->yaml_backend();
+ local $struct->{x_serialization_backend} = sprintf '%s version %s',
+ $backend, $backend->VERSION;
$data = eval { no strict 'refs'; &{"$backend\::Dump"}($struct) };
if ( $@ ) {
croak $backend->can('errstr') ? $backend->errstr : $@
@@ -632,8 +640,6 @@ sub TO_JSON {
# ABSTRACT: the distribution metadata for a CPAN dist
-__END__
-
=pod
=encoding UTF-8
@@ -644,7 +650,7 @@ CPAN::Meta - the distribution metadata for a CPAN dist
=head1 VERSION
-version 2.150001
+version 2.150005
=head1 SYNOPSIS
@@ -859,6 +865,10 @@ JSON. For C<version> less than 2, the string will be serialized as YAML. In
both cases, the same rules are followed as in the C<save()> method for choosing
a serialization backend.
+The serialized structure will include a C<x_serialization_backend> entry giving
+the package and version used to serialize. Any existing key in the given
+C<$meta> object will be clobbered.
+
=head1 STRING DATA
The following methods return a single value, which is the value for the
@@ -1025,7 +1035,7 @@ Ricardo Signes <rjbs@cpan.org>
=head1 CONTRIBUTORS
-=for stopwords Ansgar Burchardt Avar Arnfjord Bjarmason Christopher J. Madsen Chuck Adams Cory G Watson Damyan Ivanov Eric Wilhelm Graham Knop Gregor Hermann Karen Etheridge Kenichi Ishigaki Ken Williams Lars Dieckow Leon Timmermans majensen Mark Fowler Matt S Trout Michael G. Schwern mohawk2 moznion Olaf Alders Olivier Mengue Randy Sims
+=for stopwords Ansgar Burchardt Avar Arnfjord Bjarmason Christopher J. Madsen Chuck Adams Cory G Watson Damyan Ivanov Eric Wilhelm Graham Knop Gregor Hermann Karen Etheridge Kenichi Ishigaki Ken Williams Lars Dieckow Leon Timmermans majensen Mark Fowler Matt S Trout Michael G. Schwern mohawk2 moznion Niko Tyni Olaf Alders Olivier Mengué Randy Sims Tomohiro Hosaka
=over 4
@@ -1111,16 +1121,24 @@ moznion <moznion@gmail.com>
=item *
+Niko Tyni <ntyni@debian.org>
+
+=item *
+
Olaf Alders <olaf@wundersolutions.com>
=item *
-Olivier Mengue <dolmen@cpan.org>
+Olivier Mengué <dolmen@cpan.org>
=item *
Randy Sims <randys@thepierianspring.org>
+=item *
+
+Tomohiro Hosaka <bokutin@bokut.in>
+
=back
=head1 COPYRIGHT AND LICENSE
@@ -1131,3 +1149,8 @@ This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
+
+__END__
+
+
+# vim: ts=2 sts=2 sw=2 et :
diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/Converter.pm b/cpan/CPAN-Meta/lib/CPAN/Meta/Converter.pm
index 8b32b1360a..03806bc82b 100644
--- a/cpan/CPAN-Meta/lib/CPAN/Meta/Converter.pm
+++ b/cpan/CPAN-Meta/lib/CPAN/Meta/Converter.pm
@@ -3,7 +3,7 @@ use strict;
use warnings;
package CPAN::Meta::Converter;
-our $VERSION = '2.150001';
+our $VERSION = '2.150005';
#pod =head1 SYNOPSIS
#pod
@@ -388,6 +388,8 @@ sub _clean_version {
sub _bad_version_hook {
my ($v) = @_;
+ $v =~ s{^\s*}{};
+ $v =~ s{\s*$}{};
$v =~ s{[a-z]+$}{}; # strip trailing alphabetics
my $vobj = eval { version->new($v) };
return defined($vobj) ? $vobj : version->new(0); # or give up
@@ -803,7 +805,7 @@ my %up_convert = (
# CHANGED TO MANDATORY
'dynamic_config' => \&_keep_or_one,
# ADDED MANDATORY
- 'release_status' => \&_release_status_from_version,
+ 'release_status' => \&_release_status,
# PRIOR OPTIONAL
'keywords' => \&_keep,
'no_index' => \&_no_index_directory,
@@ -1497,7 +1499,7 @@ CPAN::Meta::Converter - Convert CPAN distribution metadata structures
=head1 VERSION
-version 2.150001
+version 2.150005
=head1 SYNOPSIS
@@ -1634,4 +1636,4 @@ the same terms as the Perl 5 programming language system itself.
__END__
-# vim: ts=2 sts=2 sw=2 et:
+# vim: ts=2 sts=2 sw=2 et :
diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/Feature.pm b/cpan/CPAN-Meta/lib/CPAN/Meta/Feature.pm
index 4bfbb19b4c..9dac4f4218 100644
--- a/cpan/CPAN-Meta/lib/CPAN/Meta/Feature.pm
+++ b/cpan/CPAN-Meta/lib/CPAN/Meta/Feature.pm
@@ -3,7 +3,7 @@ use strict;
use warnings;
package CPAN::Meta::Feature;
-our $VERSION = '2.150001';
+our $VERSION = '2.150005';
use CPAN::Meta::Prereqs;
@@ -67,8 +67,6 @@ sub prereqs { $_[0]{prereqs} }
# ABSTRACT: an optional feature provided by a CPAN distribution
-__END__
-
=pod
=encoding UTF-8
@@ -79,7 +77,7 @@ CPAN::Meta::Feature - an optional feature provided by a CPAN distribution
=head1 VERSION
-version 2.150001
+version 2.150005
=head1 DESCRIPTION
@@ -144,3 +142,8 @@ This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
+
+__END__
+
+
+# vim: ts=2 sts=2 sw=2 et :
diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/History.pm b/cpan/CPAN-Meta/lib/CPAN/Meta/History.pm
index 3d7e558519..f4cac5e59a 100644
--- a/cpan/CPAN-Meta/lib/CPAN/Meta/History.pm
+++ b/cpan/CPAN-Meta/lib/CPAN/Meta/History.pm
@@ -4,7 +4,7 @@ use strict;
use warnings;
package CPAN::Meta::History;
-our $VERSION = '2.150001';
+our $VERSION = '2.150005';
1;
@@ -22,7 +22,7 @@ CPAN::Meta::History - history of CPAN Meta Spec changes
=head1 VERSION
-version 2.150001
+version 2.150005
=head1 DESCRIPTION
diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/History/Meta_1_0.pod b/cpan/CPAN-Meta/lib/CPAN/Meta/History/Meta_1_0.pod
index 1052c3eb44..cd3bb9c3f6 100644
--- a/cpan/CPAN-Meta/lib/CPAN/Meta/History/Meta_1_0.pod
+++ b/cpan/CPAN-Meta/lib/CPAN/Meta/History/Meta_1_0.pod
@@ -7,7 +7,8 @@ CPAN::Meta::History::Meta_1_0 - Version 1.0 metadata specification for META.yml
=head1 PREFACE
This is a historical copy of the version 1.0 specification for F<META.yml>
-files, copyright by Ken Williams.
+files, copyright by Ken Williams and licensed under the same terms as Perl
+itself.
Modifications from the original:
diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/History/Meta_1_1.pod b/cpan/CPAN-Meta/lib/CPAN/Meta/History/Meta_1_1.pod
index 69f3411518..7b4b2f41ce 100644
--- a/cpan/CPAN-Meta/lib/CPAN/Meta/History/Meta_1_1.pod
+++ b/cpan/CPAN-Meta/lib/CPAN/Meta/History/Meta_1_1.pod
@@ -7,7 +7,8 @@ CPAN::Meta::History::Meta_1_1 - Version 1.1 metadata specification for META.yml
=head1 PREFACE
This is a historical copy of the version 1.1 specification for F<META.yml>
-files, copyright by Ken Williams.
+files, copyright by Ken Williams and licensed under the same terms as Perl
+itself.
Modifications from the original:
diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/History/Meta_1_2.pod b/cpan/CPAN-Meta/lib/CPAN/Meta/History/Meta_1_2.pod
index 69cd5bb586..48867b2b35 100644
--- a/cpan/CPAN-Meta/lib/CPAN/Meta/History/Meta_1_2.pod
+++ b/cpan/CPAN-Meta/lib/CPAN/Meta/History/Meta_1_2.pod
@@ -7,7 +7,8 @@ CPAN::Meta::History::Meta_1_2 - Version 1.2 metadata specification for META.yml
=head1 PREFACE
This is a historical copy of the version 1.2 specification for F<META.yml>
-files, copyright by Ken Williams.
+files, copyright by Ken Williams and licensed under the same terms as Perl
+itself.
Modifications from the original:
diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/History/Meta_1_3.pod b/cpan/CPAN-Meta/lib/CPAN/Meta/History/Meta_1_3.pod
index deff28dc82..b075adccde 100644
--- a/cpan/CPAN-Meta/lib/CPAN/Meta/History/Meta_1_3.pod
+++ b/cpan/CPAN-Meta/lib/CPAN/Meta/History/Meta_1_3.pod
@@ -7,7 +7,8 @@ CPAN::Meta::History::Meta_1_3 - Version 1.3 metadata specification for META.yml
=head1 PREFACE
This is a historical copy of the version 1.3 specification for F<META.yml>
-files, copyright by Ken Williams.
+files, copyright by Ken Williams and licensed under the same terms as Perl
+itself.
Modifications from the original:
diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/History/Meta_1_4.pod b/cpan/CPAN-Meta/lib/CPAN/Meta/History/Meta_1_4.pod
index a84fb3dd8a..471296ce29 100644
--- a/cpan/CPAN-Meta/lib/CPAN/Meta/History/Meta_1_4.pod
+++ b/cpan/CPAN-Meta/lib/CPAN/Meta/History/Meta_1_4.pod
@@ -7,7 +7,8 @@ CPAN::Meta::History::Meta_1_4 - Version 1.4 metadata specification for META.yml
=head1 PREFACE
This is a historical copy of the version 1.4 specification for F<META.yml>
-files, copyright by Ken Williams.
+files, copyright by Ken Williams and licensed under the same terms as Perl
+itself.
Modifications from the original:
diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/Merge.pm b/cpan/CPAN-Meta/lib/CPAN/Meta/Merge.pm
index f4c12869c4..05a18ea973 100644
--- a/cpan/CPAN-Meta/lib/CPAN/Meta/Merge.pm
+++ b/cpan/CPAN-Meta/lib/CPAN/Meta/Merge.pm
@@ -3,15 +3,24 @@ use warnings;
package CPAN::Meta::Merge;
-our $VERSION = '2.150001';
+our $VERSION = '2.150005';
use Carp qw/croak/;
use Scalar::Util qw/blessed/;
use CPAN::Meta::Converter 2.141170;
+sub _is_identical {
+ my ($left, $right) = @_;
+ return
+ (not defined $left and not defined $right)
+ # if either of these are references, we compare the serialized value
+ || (defined $left and defined $right and $left eq $right);
+}
+
sub _identical {
my ($left, $right, $path) = @_;
- croak sprintf "Can't merge attribute %s: '%s' does not equal '%s'", join('.', @{$path}), $left, $right unless $left eq $right;
+ croak sprintf "Can't merge attribute %s: '%s' does not equal '%s'", join('.', @{$path}), $left, $right
+ unless _is_identical($left, $right);
return $left;
}
@@ -50,6 +59,13 @@ sub _uniq_map {
if (not exists $left->{$key}) {
$left->{$key} = $right->{$key};
}
+ # identical strings or references are merged identically
+ elsif (_is_identical($left->{$key}, $right->{$key})) {
+ 1; # do nothing - keep left
+ }
+ elsif (ref $left->{$key} eq 'HASH' and ref $right->{$key} eq 'HASH') {
+ $left->{$key} = _uniq_map($left->{$key}, $right->{$key}, [ @{$path}, $key ]);
+ }
else {
croak 'Duplication of element ' . join '.', @{$path}, $key;
}
@@ -219,6 +235,9 @@ sub merge {
# ABSTRACT: Merging CPAN Meta fragments
+
+# vim: ts=2 sts=2 sw=2 et :
+
__END__
=pod
@@ -231,7 +250,7 @@ CPAN::Meta::Merge - Merging CPAN Meta fragments
=head1 VERSION
-version 2.150001
+version 2.150005
=head1 SYNOPSIS
diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm b/cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm
index 75035107f8..8a13eb13c8 100644
--- a/cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm
+++ b/cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm
@@ -3,7 +3,7 @@ use strict;
use warnings;
package CPAN::Meta::Prereqs;
-our $VERSION = '2.150001';
+our $VERSION = '2.150005';
#pod =head1 DESCRIPTION
#pod
@@ -163,7 +163,7 @@ sub with_merged_prereqs {
#pod
#pod my $new_reqs = $prereqs->merged_requirements( \@phases, \@types );
#pod my $new_reqs = $prereqs->merged_requirements( \@phases );
-#pod my $new_reqs = $preerqs->merged_requirements();
+#pod my $new_reqs = $prereqs->merged_requirements();
#pod
#pod This method joins together all requirements across a number of phases
#pod and types into a new L<CPAN::Meta::Requirements> object. If arguments
@@ -275,8 +275,6 @@ sub clone {
# ABSTRACT: a set of distribution prerequisites by phase and type
-__END__
-
=pod
=encoding UTF-8
@@ -287,7 +285,7 @@ CPAN::Meta::Prereqs - a set of distribution prerequisites by phase and type
=head1 VERSION
-version 2.150001
+version 2.150005
=head1 DESCRIPTION
@@ -353,7 +351,7 @@ will not alter them.
my $new_reqs = $prereqs->merged_requirements( \@phases, \@types );
my $new_reqs = $prereqs->merged_requirements( \@phases );
- my $new_reqs = $preerqs->merged_requirements();
+ my $new_reqs = $prereqs->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
@@ -417,3 +415,8 @@ This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
+
+__END__
+
+
+# vim: ts=2 sts=2 sw=2 et :
diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/Spec.pm b/cpan/CPAN-Meta/lib/CPAN/Meta/Spec.pm
index ec68f178ed..9056940b51 100644
--- a/cpan/CPAN-Meta/lib/CPAN/Meta/Spec.pm
+++ b/cpan/CPAN-Meta/lib/CPAN/Meta/Spec.pm
@@ -8,7 +8,7 @@ use strict;
use warnings;
package CPAN::Meta::Spec;
-our $VERSION = '2.150001';
+our $VERSION = '2.150005';
1;
@@ -29,7 +29,7 @@ CPAN::Meta::Spec - specification for CPAN distribution metadata
=head1 VERSION
-version 2.150001
+version 2.150005
=head1 SYNOPSIS
diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/Validator.pm b/cpan/CPAN-Meta/lib/CPAN/Meta/Validator.pm
index cc0409e6e4..eddaa10730 100644
--- a/cpan/CPAN-Meta/lib/CPAN/Meta/Validator.pm
+++ b/cpan/CPAN-Meta/lib/CPAN/Meta/Validator.pm
@@ -3,7 +3,7 @@ use strict;
use warnings;
package CPAN::Meta::Validator;
-our $VERSION = '2.150001';
+our $VERSION = '2.150005';
#pod =head1 SYNOPSIS
#pod
@@ -986,8 +986,6 @@ sub _error {
# ABSTRACT: validate CPAN distribution metadata structures
-__END__
-
=pod
=encoding UTF-8
@@ -998,7 +996,7 @@ CPAN::Meta::Validator - validate CPAN distribution metadata structures
=head1 VERSION
-version 2.150001
+version 2.150005
=head1 SYNOPSIS
@@ -1205,3 +1203,8 @@ This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
+
+__END__
+
+
+# vim: ts=2 sts=2 sw=2 et :
diff --git a/cpan/CPAN-Meta/t/converter-bad.t b/cpan/CPAN-Meta/t/converter-bad.t
index f9e7d59caf..7cce934fa2 100644
--- a/cpan/CPAN-Meta/t/converter-bad.t
+++ b/cpan/CPAN-Meta/t/converter-bad.t
@@ -73,4 +73,4 @@ for my $f ( reverse sort @files ) {
}
done_testing;
-
+# vim: ts=2 sts=2 sw=2 et :
diff --git a/cpan/CPAN-Meta/t/converter-fail.t b/cpan/CPAN-Meta/t/converter-fail.t
index b9cfedd1fe..dfda1ae46a 100644
--- a/cpan/CPAN-Meta/t/converter-fail.t
+++ b/cpan/CPAN-Meta/t/converter-fail.t
@@ -38,4 +38,4 @@ for my $f ( reverse sort @files ) {
}
done_testing;
-
+# vim: ts=2 sts=2 sw=2 et :
diff --git a/cpan/CPAN-Meta/t/converter-fragments.t b/cpan/CPAN-Meta/t/converter-fragments.t
index 18dad14999..a9b78def9e 100644
--- a/cpan/CPAN-Meta/t/converter-fragments.t
+++ b/cpan/CPAN-Meta/t/converter-fragments.t
@@ -151,8 +151,8 @@ for my $c (@cases) {
my $got = $cmc->upgrade_fragment;
my $exp = $c->{expect};
is_deeply( $got, $exp, $c->{label} )
- or diag "GOT:\n" . explain($got) . "\nEXPECTED:\n" . explain($exp);
+ or diag "GOT:\n", explain($got), "EXPECTED:\n", explain($exp);
}
done_testing;
-# vim: ts=4 sts=4 sw=4 et:
+# vim: ts=8 sts=4 sw=4 et :
diff --git a/cpan/CPAN-Meta/t/converter.t b/cpan/CPAN-Meta/t/converter.t
index 10c6a48b9c..87cdbd6985 100644
--- a/cpan/CPAN-Meta/t/converter.t
+++ b/cpan/CPAN-Meta/t/converter.t
@@ -34,6 +34,7 @@ my @files = sort grep { /^\w/ } $data_dir->read;
#use Data::Dumper;
for my $f ( reverse sort @files ) {
+ note '';
my $path = File::Spec->catfile('t','data-test',$f);
my $original = Parse::CPAN::Meta->load_file( $path );
ok( $original, "loaded $f" );
@@ -294,4 +295,15 @@ sub _normalize_reqs {
);
}
+# specific test for preserving release_status on upconversion
+{
+ my $path = File::Spec->catfile('t','data-test','preserve-release-status.yml');
+ my $original = Parse::CPAN::Meta->load_file( $path );
+ ok( $original, "loaded META-2.json" );
+ my $cmc = CPAN::Meta::Converter->new( $original );
+ my $cleaned_up = $cmc->convert( version => "2" );
+ is( $cleaned_up->{release_status}, 'unstable', "release_status preserved" );
+}
+
done_testing;
+# vim: ts=2 sts=2 sw=2 et:
diff --git a/cpan/CPAN-Meta/t/data-test/preserve-release-status.yml b/cpan/CPAN-Meta/t/data-test/preserve-release-status.yml
new file mode 100644
index 0000000000..9468b86a55
--- /dev/null
+++ b/cpan/CPAN-Meta/t/data-test/preserve-release-status.yml
@@ -0,0 +1,13 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
+name: Template-DBI
+version: 2.64
+version_from: lib/Template/Plugin/DBI.pm
+installdirs: site
+license: perl
+requires:
+ DBI: 1
+ Template: 2.15
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.17
+release_status: unstable
diff --git a/cpan/CPAN-Meta/t/load-bad.t b/cpan/CPAN-Meta/t/load-bad.t
index c3df3ea99b..7cae168807 100644
--- a/cpan/CPAN-Meta/t/load-bad.t
+++ b/cpan/CPAN-Meta/t/load-bad.t
@@ -15,13 +15,11 @@ my @files = sort grep { /^\w/ } $data_dir->read;
for my $f ( sort @files ) {
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 $@;
+ ok( eval { CPAN::Meta->load_file( $path ) }, "load_file('$f')" ) or diag $@;
my $string = _slurp($path);
my $method = $path =~ /\.json/ ? "load_json_string" : "load_yaml_string";
- my $meta2 = eval { CPAN::Meta->$method( $string, { fix_errors => 1 } ) };
- ok( defined $meta2, "$method(slurp('$f'))" ) or diag $@;
+ ok( eval { CPAN::Meta->$method( $string, { fix_errors => 1 } ) }, "$method(slurp('$f'))" ) or diag $@;
}
done_testing;
-
+# vim: ts=2 sts=2 sw=2 et:
diff --git a/cpan/CPAN-Meta/t/merge.t b/cpan/CPAN-Meta/t/merge.t
index f58e8c62df..39e8124550 100644
--- a/cpan/CPAN-Meta/t/merge.t
+++ b/cpan/CPAN-Meta/t/merge.t
@@ -1,5 +1,3 @@
-#! perl
-
use strict;
use warnings;
@@ -14,6 +12,7 @@ my %base = (
license => [ 'perl_5' ],
resources => {
license => [ 'http://dev.perl.org/licenses/' ],
+ bugtracker => { web => 'https://rt.cpan.org/Dist/Display.html?Foo-Bar' },
},
prereqs => {
runtime => {
@@ -70,6 +69,7 @@ my %first_expected = (
license => [ 'perl_5', 'bsd' ],
resources => {
license => [ 'http://dev.perl.org/licenses/', 'http://opensource.org/licenses/bsd-license.php' ],
+ bugtracker => { web => 'https://rt.cpan.org/Dist/Display.html?Foo-Bar' },
},
prereqs => {
runtime => {
@@ -100,6 +100,34 @@ my %first_expected = (
version => 2,
},
);
+my %provides_merge_expected = (
+ abstract => 'This is a test',
+ author => ['A.U. Thor'],
+ generated_by => 'Myself',
+ license => [ 'perl_5' ],
+ resources => {
+ license => [ 'http://dev.perl.org/licenses/' ],
+ bugtracker => { web => 'https://rt.cpan.org/Dist/Display.html?Foo-Bar' },
+ },
+ prereqs => {
+ runtime => {
+ requires => {
+ Foo => '0',
+ },
+ },
+ },
+ dynamic_config => 0,
+ provides => {
+ Baz => {
+ file => 'lib/Baz.pm',
+ version => '0.001', # same as %base, but for this extra key
+ },
+ },
+ 'meta-spec' => {
+ url => "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+ version => 2,
+ },
+);
my $merger = CPAN::Meta::Merge->new(default_version => '2');
@@ -108,13 +136,34 @@ my $first_result = $merger->merge(\%base, \%first);
is_deeply($first_result, \%first_expected, 'First result is as expected');
is_deeply($merger->merge(\%base, { abstract => 'This is a test' }), \%base, 'Can merge in identical abstract');
-my $failure = eval { $merger->merge(\%base, { abstract => 'And now for something else' }) };
-is($failure, undef, 'Trying to merge different author gives an exception');
+is(
+ eval { $merger->merge(\%base, { abstract => 'And now for something else' }) },
+ undef,
+ 'Trying to merge different author gives an exception',
+);
like $@, qr/^Can't merge attribute abstract/, 'Exception looks right';
-my $failure2 = eval { $merger->merge(\%base, { provides => { Baz => { file => 'Baz.pm' } } }) };
-is($failure2, undef, 'Trying to merge different author gives an exception');
-like $@, qr/^Duplication of element provides\.Baz /, 'Exception looks right';
+is(
+ eval { $merger->merge(\%base, { resources => { bugtracker => { web => 'http://foo.com' } } } ) },
+ undef,
+ 'Trying to merge a different bugtracker URL gives an exception',
+);
+like $@, qr/^Duplication of element resources\.bugtracker\.web /, 'Exception looks right';
+
+is(
+ eval { $merger->merge(\%base, { provides => { Baz => { file => 'Baz.pm' } } }) },
+ undef,
+ 'Trying to merge different provides.$module.file gives an exception',
+);
+like $@, qr/^Duplication of element provides\.Baz\.file /, 'Exception looks right';
+
+my $provides_result = $merger->merge(\%base, { provides => { Baz => { file => 'lib/Baz.pm', version => '0.001' } } });
+is_deeply(
+ $provides_result,
+ \%provides_merge_expected,
+ 'Trying to merge a new key for provides.$module is permitted; identical values are preserved',
+);
+
# issue 67
@base{qw/name version release_status/} = qw/Foo-Bar 0.01 testing/;
@@ -122,3 +171,4 @@ my $base_obj = CPAN::Meta->create(\%base);
ok my $first_result_obj = $merger->merge($base_obj, \%first), 'merging CPAN::Meta objects succeeds';
done_testing();
+# vim: ts=4 sts=4 sw=4 tw=78 noet :
diff --git a/cpan/CPAN-Meta/t/meta-obj.t b/cpan/CPAN-Meta/t/meta-obj.t
index bb39c46066..fa3c703a43 100644
--- a/cpan/CPAN-Meta/t/meta-obj.t
+++ b/cpan/CPAN-Meta/t/meta-obj.t
@@ -240,3 +240,4 @@ $chk_feature->($features[0]);
$chk_feature->( $meta->feature('domination') );
done_testing;
+# vim: ts=2 sts=2 sw=2 et :
diff --git a/cpan/CPAN-Meta/t/no-index.t b/cpan/CPAN-Meta/t/no-index.t
index 456633a5fd..554e9214b0 100644
--- a/cpan/CPAN-Meta/t/no-index.t
+++ b/cpan/CPAN-Meta/t/no-index.t
@@ -86,3 +86,4 @@ my %distmeta = (
}
done_testing;
+# vim: ts=2 sts=2 sw=2 et :
diff --git a/cpan/CPAN-Meta/t/optional_feature-merge.t b/cpan/CPAN-Meta/t/optional_feature-merge.t
index 15aa621cb6..76ea9640d5 100644
--- a/cpan/CPAN-Meta/t/optional_feature-merge.t
+++ b/cpan/CPAN-Meta/t/optional_feature-merge.t
@@ -1,6 +1,5 @@
use strict;
use warnings;
-# vim: set ts=4 sw=4 noet nolist :
use Test::More;
use CPAN::Meta;
@@ -92,8 +91,7 @@ my $fragment3 = {
}
};
-my $result = eval { $merger->merge($meta1, $fragment3) };
-is($result, undef, 'Trying to merge optional_features with same feature name and different descriptions gives an exception');
+is( eval { $merger->merge($meta1, $fragment3) }, undef, 'Trying to merge optional_features with same feature name and different descriptions gives an exception');
like $@, qr/^Cannot merge two optional_features named 'FeatureName' with different 'description' values/, 'Exception looks right';
my $fragment4 = {
@@ -106,8 +104,7 @@ my $fragment4 = {
}
};
-$result = eval { $merger->merge($meta1, $fragment4) };
-is($result, undef, 'Trying to merge optional_features with same feature name and differences in other keys gives an exception');
+is( eval { $merger->merge($meta1, $fragment4) }, undef, 'Trying to merge optional_features with same feature name and differences in other keys gives an exception');
like $@, qr/^Cannot merge two optional_features named 'FeatureName' with different 'x_default' values/, 'Exception looks right';
my $fragment5 = {
@@ -140,3 +137,4 @@ is_deeply(
);
done_testing;
+# vim: ts=4 sts=4 sw=4 noet :
diff --git a/cpan/CPAN-Meta/t/prereqs-finalize.t b/cpan/CPAN-Meta/t/prereqs-finalize.t
index e974f99a1a..ac4aea837e 100644
--- a/cpan/CPAN-Meta/t/prereqs-finalize.t
+++ b/cpan/CPAN-Meta/t/prereqs-finalize.t
@@ -9,9 +9,7 @@ delete $ENV{$_} for qw/PERL_JSON_BACKEND PERL_YAML_BACKEND/; # use defaults
sub dies_ok (&@) {
my ($code, $qr, $comment) = @_;
- my $lived = eval { $code->(); 1 };
-
- if ($lived) {
+ if (eval { $code->(); 1 }) {
fail("$comment: did not die");
} else {
like($@, $qr, $comment);
@@ -91,3 +89,4 @@ $clone->requirements_for(qw(develop suggests))->add_minimum(Foo => 1);
pass('...and we can add stuff to it');
done_testing;
+# vim: ts=2 sts=2 sw=2 et :
diff --git a/cpan/CPAN-Meta/t/prereqs-merge.t b/cpan/CPAN-Meta/t/prereqs-merge.t
index 37bca7dfa9..e15c9f2c25 100644
--- a/cpan/CPAN-Meta/t/prereqs-merge.t
+++ b/cpan/CPAN-Meta/t/prereqs-merge.t
@@ -104,3 +104,4 @@ is_deeply(
);
done_testing;
+# vim: ts=2 sts=2 sw=2 et :
diff --git a/cpan/CPAN-Meta/t/prereqs.t b/cpan/CPAN-Meta/t/prereqs.t
index ad21caa9f0..b4a3c957ae 100644
--- a/cpan/CPAN-Meta/t/prereqs.t
+++ b/cpan/CPAN-Meta/t/prereqs.t
@@ -161,4 +161,4 @@ is_deeply($prereq->as_string_hash, $prereq_struct, "round-trip okay");
}
done_testing;
-
+# vim: ts=2 sts=2 sw=2 et :
diff --git a/cpan/CPAN-Meta/t/repository.t b/cpan/CPAN-Meta/t/repository.t
index 8bb1da7ce9..0cd2c249c0 100644
--- a/cpan/CPAN-Meta/t/repository.t
+++ b/cpan/CPAN-Meta/t/repository.t
@@ -225,3 +225,4 @@ delete $ENV{$_} for qw/PERL_JSON_BACKEND PERL_YAML_BACKEND/; # use defaults
);
}
done_testing;
+# vim: ts=2 sts=2 sw=2 et :
diff --git a/cpan/CPAN-Meta/t/save-load.t b/cpan/CPAN-Meta/t/save-load.t
index 5399305ba1..8093344e32 100644
--- a/cpan/CPAN-Meta/t/save-load.t
+++ b/cpan/CPAN-Meta/t/save-load.t
@@ -83,6 +83,16 @@ ok( -f $metafile, "save meta to file" );
ok( my $loaded = Parse::CPAN::Meta->load_file($metafile), 'load saved file' );
is($loaded->{name}, 'Module-Build', 'name correct');
+like(
+ $loaded->{x_serialization_backend},
+ qr/\AJSON::PP version [0-9]/,
+ "x_serialization_backend",
+);
+
+ok(
+ ! exists $meta->{x_serialization_backend},
+ "we didn't leak x_serialization_backend up into the saved struct",
+);
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');
@@ -98,6 +108,17 @@ ok( $loaded = Parse::CPAN::Meta->load_file($metayml), 'load saved file' );
is( $loaded->{name}, 'Module-Build', 'name correct');
is( $loaded->{requires}{perl}, "5.006", 'prereq correct' );
+like(
+ $loaded->{x_serialization_backend},
+ qr/\ACPAN::Meta::YAML version [0-9]/,
+ "x_serialization_backend",
+);
+
+ok(
+ ! exists $meta->{x_serialization_backend},
+ "we didn't leak x_serialization_backend up into the saved struct",
+);
+
# file without suffix
ok( $loaded = CPAN::Meta->load_file('t/data-test/META-2.meta'), 'load_file META-2.meta' );
@@ -106,3 +127,4 @@ my $string = do { open my $fh, '<', 't/data-test/META-2.meta'; local $/; <$fh> }
ok( $loaded = CPAN::Meta->load_string($string), 'load META-2.meta from string' );
done_testing;
+# vim: ts=2 sts=2 sw=2 et :
diff --git a/cpan/CPAN-Meta/t/validator.t b/cpan/CPAN-Meta/t/validator.t
index 4fce19256b..0145073172 100644
--- a/cpan/CPAN-Meta/t/validator.t
+++ b/cpan/CPAN-Meta/t/validator.t
@@ -36,8 +36,9 @@ delete $ENV{$_} for qw/PERL_JSON_BACKEND PERL_YAML_BACKEND/; # use defaults
my $meta = Parse::CPAN::Meta->load_file( File::Spec->catfile($f) );
my $cmv = CPAN::Meta::Validator->new({%$meta});
ok( ! $cmv->is_valid, "$f shouldn't validate" );
+ note 'validation error: ', $_ foreach $cmv->errors;
}
}
done_testing;
-
+# vim: ts=2 sts=2 sw=2 et :