summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/CPAN
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/tlperl/lib/CPAN')
-rw-r--r--Master/tlpkg/tlperl/lib/CPAN/Meta.pm35
-rw-r--r--Master/tlpkg/tlperl/lib/CPAN/Meta/Converter.pm10
-rw-r--r--Master/tlpkg/tlperl/lib/CPAN/Meta/Feature.pm11
-rw-r--r--Master/tlpkg/tlperl/lib/CPAN/Meta/History.pm4
-rw-r--r--Master/tlpkg/tlperl/lib/CPAN/Meta/History/Meta_1_0.pod3
-rw-r--r--Master/tlpkg/tlperl/lib/CPAN/Meta/History/Meta_1_1.pod3
-rw-r--r--Master/tlpkg/tlperl/lib/CPAN/Meta/History/Meta_1_2.pod3
-rw-r--r--Master/tlpkg/tlperl/lib/CPAN/Meta/History/Meta_1_3.pod3
-rw-r--r--Master/tlpkg/tlperl/lib/CPAN/Meta/History/Meta_1_4.pod3
-rw-r--r--Master/tlpkg/tlperl/lib/CPAN/Meta/Merge.pm25
-rw-r--r--Master/tlpkg/tlperl/lib/CPAN/Meta/Prereqs.pm15
-rw-r--r--Master/tlpkg/tlperl/lib/CPAN/Meta/Requirements.pm233
-rw-r--r--Master/tlpkg/tlperl/lib/CPAN/Meta/Spec.pm4
-rw-r--r--Master/tlpkg/tlperl/lib/CPAN/Meta/Validator.pm11
-rw-r--r--Master/tlpkg/tlperl/lib/CPAN/Meta/YAML.pm58
15 files changed, 275 insertions, 146 deletions
diff --git a/Master/tlpkg/tlperl/lib/CPAN/Meta.pm b/Master/tlpkg/tlperl/lib/CPAN/Meta.pm
index 2a78691906b..afbb221855a 100644
--- a/Master/tlpkg/tlperl/lib/CPAN/Meta.pm
+++ b/Master/tlpkg/tlperl/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/Master/tlpkg/tlperl/lib/CPAN/Meta/Converter.pm b/Master/tlpkg/tlperl/lib/CPAN/Meta/Converter.pm
index 8b32b1360ab..03806bc82bf 100644
--- a/Master/tlpkg/tlperl/lib/CPAN/Meta/Converter.pm
+++ b/Master/tlpkg/tlperl/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/Master/tlpkg/tlperl/lib/CPAN/Meta/Feature.pm b/Master/tlpkg/tlperl/lib/CPAN/Meta/Feature.pm
index 4bfbb19b4c7..9dac4f42185 100644
--- a/Master/tlpkg/tlperl/lib/CPAN/Meta/Feature.pm
+++ b/Master/tlpkg/tlperl/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/Master/tlpkg/tlperl/lib/CPAN/Meta/History.pm b/Master/tlpkg/tlperl/lib/CPAN/Meta/History.pm
index 3d7e5585199..f4cac5e59a9 100644
--- a/Master/tlpkg/tlperl/lib/CPAN/Meta/History.pm
+++ b/Master/tlpkg/tlperl/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/Master/tlpkg/tlperl/lib/CPAN/Meta/History/Meta_1_0.pod b/Master/tlpkg/tlperl/lib/CPAN/Meta/History/Meta_1_0.pod
index 1052c3eb440..cd3bb9c3f68 100644
--- a/Master/tlpkg/tlperl/lib/CPAN/Meta/History/Meta_1_0.pod
+++ b/Master/tlpkg/tlperl/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/Master/tlpkg/tlperl/lib/CPAN/Meta/History/Meta_1_1.pod b/Master/tlpkg/tlperl/lib/CPAN/Meta/History/Meta_1_1.pod
index 69f34115189..7b4b2f41ce6 100644
--- a/Master/tlpkg/tlperl/lib/CPAN/Meta/History/Meta_1_1.pod
+++ b/Master/tlpkg/tlperl/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/Master/tlpkg/tlperl/lib/CPAN/Meta/History/Meta_1_2.pod b/Master/tlpkg/tlperl/lib/CPAN/Meta/History/Meta_1_2.pod
index 69cd5bb5861..48867b2b350 100644
--- a/Master/tlpkg/tlperl/lib/CPAN/Meta/History/Meta_1_2.pod
+++ b/Master/tlpkg/tlperl/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/Master/tlpkg/tlperl/lib/CPAN/Meta/History/Meta_1_3.pod b/Master/tlpkg/tlperl/lib/CPAN/Meta/History/Meta_1_3.pod
index deff28dc828..b075adccde6 100644
--- a/Master/tlpkg/tlperl/lib/CPAN/Meta/History/Meta_1_3.pod
+++ b/Master/tlpkg/tlperl/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/Master/tlpkg/tlperl/lib/CPAN/Meta/History/Meta_1_4.pod b/Master/tlpkg/tlperl/lib/CPAN/Meta/History/Meta_1_4.pod
index a84fb3dd8a6..471296ce291 100644
--- a/Master/tlpkg/tlperl/lib/CPAN/Meta/History/Meta_1_4.pod
+++ b/Master/tlpkg/tlperl/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/Master/tlpkg/tlperl/lib/CPAN/Meta/Merge.pm b/Master/tlpkg/tlperl/lib/CPAN/Meta/Merge.pm
index f4c12869c44..05a18ea9732 100644
--- a/Master/tlpkg/tlperl/lib/CPAN/Meta/Merge.pm
+++ b/Master/tlpkg/tlperl/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/Master/tlpkg/tlperl/lib/CPAN/Meta/Prereqs.pm b/Master/tlpkg/tlperl/lib/CPAN/Meta/Prereqs.pm
index 75035107f8c..8a13eb13c81 100644
--- a/Master/tlpkg/tlperl/lib/CPAN/Meta/Prereqs.pm
+++ b/Master/tlpkg/tlperl/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/Master/tlpkg/tlperl/lib/CPAN/Meta/Requirements.pm b/Master/tlpkg/tlperl/lib/CPAN/Meta/Requirements.pm
index 83485594985..b0e83b0d2d2 100644
--- a/Master/tlpkg/tlperl/lib/CPAN/Meta/Requirements.pm
+++ b/Master/tlpkg/tlperl/lib/CPAN/Meta/Requirements.pm
@@ -1,9 +1,10 @@
+use 5.006; # keep at v5.6 for CPAN.pm
use strict;
use warnings;
package CPAN::Meta::Requirements;
# ABSTRACT: a set of version requirements for a CPAN dist
-our $VERSION = '2.132';
+our $VERSION = '2.140';
#pod =head1 SYNOPSIS
#pod
@@ -110,34 +111,38 @@ sub _isa_version {
sub _version_object {
my ($self, $module, $version) = @_;
- my $vobj;
+ my ($vobj, $err);
- # hack around version::vpp not handling <3 character vstring literals
- if ( $INC{'version/vpp.pm'} || $INC{'ExtUtils/MakeMaker/version/vpp.pm'} ) {
- my $magic = _find_magic_vstring( $version );
- $version = $magic if length $magic;
+ if (not defined $version or (!ref($version) && $version eq '0')) {
+ return $V0;
}
-
- eval {
- if (not defined $version or (!ref($version) && $version eq '0')) {
- $vobj = $V0;
+ elsif ( ref($version) eq 'version' || ( ref($version) && _isa_version($version) ) ) {
+ $vobj = $version;
+ }
+ else {
+ # hack around version::vpp not handling <3 character vstring literals
+ if ( $INC{'version/vpp.pm'} || $INC{'ExtUtils/MakeMaker/version/vpp.pm'} ) {
+ my $magic = _find_magic_vstring( $version );
+ $version = $magic if length $magic;
}
- elsif ( ref($version) eq 'version' || _isa_version($version) ) {
- $vobj = $version;
+ # pad to 3 characters if before 5.8.1 and appears to be a v-string
+ if ( $] < 5.008001 && $version !~ /\A[0-9]/ && substr($version,0,1) ne 'v' && length($version) < 3 ) {
+ $version .= "\0" x (3 - length($version));
}
- else {
+ eval {
local $SIG{__WARN__} = sub { die "Invalid version: $_[0]" };
+ # avoid specific segfault on some older version.pm versions
+ die "Invalid version: $version" if $version eq 'version';
$vobj = version->new($version);
- }
- };
-
- if ( my $err = $@ ) {
- my $hook = $self->{bad_version_hook};
- $vobj = eval { $hook->($version, $module) }
- if ref $hook eq 'CODE';
- unless (eval { $vobj->isa("version") }) {
- $err =~ s{ at .* line \d+.*$}{};
- die "Can't convert '$version': $err";
+ };
+ if ( my $err = $@ ) {
+ my $hook = $self->{bad_version_hook};
+ $vobj = eval { $hook->($version, $module) }
+ if ref $hook eq 'CODE';
+ unless (eval { $vobj->isa("version") }) {
+ $err =~ s{ at .* line \d+.*$}{};
+ die "Can't convert '$version': $err";
+ }
}
}
@@ -220,22 +225,26 @@ BEGIN {
return $self;
};
-
+
no strict 'refs';
*$to_add = $code;
}
}
+# add_minimum is optimized compared to generated subs above because
+# it is called frequently and with "0" or equivalent input
sub add_minimum {
my ($self, $name, $version) = @_;
- if (not defined $version or (!ref($version) && $version eq '0')) {
+ # stringify $version so that version->new("0.00")->stringify ne "0"
+ # which preserves the user's choice of "0.00" as the requirement
+ if (not defined $version or "$version" eq '0') {
return $self if $self->__entry_for($name);
Carp::confess("can't add new requirements to finalized requirements")
if $self->is_finalized;
$self->{requirements}{ $name } =
- CPAN::Meta::Requirements::_Range::Range->with_minimum($V0);
+ CPAN::Meta::Requirements::_Range::Range->with_minimum($V0, $name);
}
else {
$version = $self->_version_object( $name, $version );
@@ -249,9 +258,9 @@ sub add_minimum {
#pod
#pod $req->add_requirements( $another_req_object );
#pod
-#pod This method adds all the requirements in the given CPAN::Meta::Requirements object
-#pod to the requirements object on which it was called. If there are any conflicts,
-#pod an exception is thrown.
+#pod This method adds all the requirements in the given CPAN::Meta::Requirements
+#pod object to the requirements object on which it was called. If there are any
+#pod conflicts, an exception is thrown.
#pod
#pod This method returns the requirements object.
#pod
@@ -328,7 +337,7 @@ sub clear_requirement {
#pod the format described in L<CPAN::Meta::Spec> or undef if the given module has no
#pod requirements. This should only be used for informational purposes such as error
#pod messages and should not be interpreted or used for comparison (see
-#pod L</accepts_module> instead.)
+#pod L</accepts_module> instead).
#pod
#pod =cut
@@ -339,6 +348,25 @@ sub requirements_for_module {
return $entry->as_string;
}
+#pod =method structured_requirements_for_module
+#pod
+#pod $req->structured_requirements_for_module( $module );
+#pod
+#pod This returns a data structure containing the version requirements for a given
+#pod module or undef if the given module has no requirements. This should
+#pod not be used for version checks (see L</accepts_module> instead).
+#pod
+#pod Added in version 2.134.
+#pod
+#pod =cut
+
+sub structured_requirements_for_module {
+ my ($self, $module) = @_;
+ my $entry = $self->__entry_for($module);
+ return unless $entry;
+ return $entry->as_struct;
+}
+
#pod =method required_modules
#pod
#pod This method returns a list of all the modules for which requirements have been
@@ -376,7 +404,7 @@ sub __modify_entry_for {
if $fin and not $old;
my $new = ($old || 'CPAN::Meta::Requirements::_Range::Range')
- ->$method($version);
+ ->$method($version, $name);
Carp::confess("can't modify finalized requirements")
if $fin and $old->as_string ne $new->as_string;
@@ -587,36 +615,62 @@ sub from_string_hash {
sub as_string { return "== $_[0]{version}" }
+ sub as_struct { return [ [ '==', "$_[0]{version}" ] ] }
+
sub as_modifiers { return [ [ exact_version => $_[0]{version} ] ] }
+ sub _reject_requirements {
+ my ($self, $module, $error) = @_;
+ Carp::confess("illegal requirements for $module: $error")
+ }
+
sub _clone {
(ref $_[0])->_new( version->new( $_[0]{version} ) )
}
sub with_exact_version {
- my ($self, $version) = @_;
+ my ($self, $version, $module) = @_;
+ $module = 'module' unless defined $module;
return $self->_clone if $self->_accepts($version);
- Carp::confess("illegal requirements: unequal exact version specified");
+ $self->_reject_requirements(
+ $module,
+ "can't be exactly $version when exact requirement is already $self->{version}",
+ );
}
sub with_minimum {
- my ($self, $minimum) = @_;
+ my ($self, $minimum, $module) = @_;
+ $module = 'module' unless defined $module;
+
return $self->_clone if $self->{version} >= $minimum;
- Carp::confess("illegal requirements: minimum above exact specification");
+ $self->_reject_requirements(
+ $module,
+ "minimum $minimum exceeds exact specification $self->{version}",
+ );
}
sub with_maximum {
- my ($self, $maximum) = @_;
+ my ($self, $maximum, $module) = @_;
+ $module = 'module' unless defined $module;
+
return $self->_clone if $self->{version} <= $maximum;
- Carp::confess("illegal requirements: maximum below exact specification");
+ $self->_reject_requirements(
+ $module,
+ "maximum $maximum below exact specification $self->{version}",
+ );
}
sub with_exclusion {
- my ($self, $exclusion) = @_;
+ my ($self, $exclusion, $module) = @_;
+ $module = 'module' unless defined $module;
+
return $self->_clone unless $exclusion == $self->{version};
- Carp::confess("illegal requirements: excluded exact specification");
+ $self->_reject_requirements(
+ $module,
+ "tried to exclude $exclusion, which is already exactly specified",
+ );
}
}
@@ -653,61 +707,87 @@ sub from_string_hash {
return \@mods;
}
- sub as_string {
+ sub as_struct {
my ($self) = @_;
return 0 if ! keys %$self;
- return "$self->{minimum}" if (keys %$self) == 1 and exists $self->{minimum};
-
my @exclusions = @{ $self->{exclusions} || [] };
my @parts;
- for my $pair (
+ for my $tuple (
[ qw( >= > minimum ) ],
[ qw( <= < maximum ) ],
) {
- my ($op, $e_op, $k) = @$pair;
+ my ($op, $e_op, $k) = @$tuple;
if (exists $self->{$k}) {
my @new_exclusions = grep { $_ != $self->{ $k } } @exclusions;
if (@new_exclusions == @exclusions) {
- push @parts, "$op $self->{ $k }";
+ push @parts, [ $op, "$self->{ $k }" ];
} else {
- push @parts, "$e_op $self->{ $k }";
+ push @parts, [ $e_op, "$self->{ $k }" ];
@exclusions = @new_exclusions;
}
}
}
- push @parts, map {; "!= $_" } @exclusions;
+ push @parts, map {; [ "!=", "$_" ] } @exclusions;
- return join q{, }, @parts;
+ return \@parts;
+ }
+
+ sub as_string {
+ my ($self) = @_;
+
+ my @parts = @{ $self->as_struct };
+
+ return $parts[0][1] if @parts == 1 and $parts[0][0] eq '>=';
+
+ return join q{, }, map {; join q{ }, @$_ } @parts;
+ }
+
+ sub _reject_requirements {
+ my ($self, $module, $error) = @_;
+ Carp::confess("illegal requirements for $module: $error")
}
sub with_exact_version {
- my ($self, $version) = @_;
+ my ($self, $version, $module) = @_;
+ $module = 'module' unless defined $module;
$self = $self->_clone;
- Carp::confess("illegal requirements: exact specification outside of range")
- unless $self->_accepts($version);
+ unless ($self->_accepts($version)) {
+ $self->_reject_requirements(
+ $module,
+ "exact specification $version outside of range " . $self->as_string
+ );
+ }
return CPAN::Meta::Requirements::_Range::Exact->_new($version);
}
sub _simplify {
- my ($self) = @_;
+ my ($self, $module) = @_;
if (defined $self->{minimum} and defined $self->{maximum}) {
if ($self->{minimum} == $self->{maximum}) {
- Carp::confess("illegal requirements: excluded all values")
- if grep { $_ == $self->{minimum} } @{ $self->{exclusions} || [] };
+ if (grep { $_ == $self->{minimum} } @{ $self->{exclusions} || [] }) {
+ $self->_reject_requirements(
+ $module,
+ "minimum and maximum are both $self->{minimum}, which is excluded",
+ );
+ }
return CPAN::Meta::Requirements::_Range::Exact->_new($self->{minimum})
}
- Carp::confess("illegal requirements: minimum exceeds maximum")
- if $self->{minimum} > $self->{maximum};
+ if ($self->{minimum} > $self->{maximum}) {
+ $self->_reject_requirements(
+ $module,
+ "minimum $self->{minimum} exceeds maximum $self->{maximum}",
+ );
+ }
}
# eliminate irrelevant exclusions
@@ -726,7 +806,8 @@ sub from_string_hash {
}
sub with_minimum {
- my ($self, $minimum) = @_;
+ my ($self, $minimum, $module) = @_;
+ $module = 'module' unless defined $module;
$self = $self->_clone;
if (defined (my $old_min = $self->{minimum})) {
@@ -735,11 +816,12 @@ sub from_string_hash {
$self->{minimum} = $minimum;
}
- return $self->_simplify;
+ return $self->_simplify($module);
}
sub with_maximum {
- my ($self, $maximum) = @_;
+ my ($self, $maximum, $module) = @_;
+ $module = 'module' unless defined $module;
$self = $self->_clone;
if (defined (my $old_max = $self->{maximum})) {
@@ -748,16 +830,17 @@ sub from_string_hash {
$self->{maximum} = $maximum;
}
- return $self->_simplify;
+ return $self->_simplify($module);
}
sub with_exclusion {
- my ($self, $exclusion) = @_;
+ my ($self, $exclusion, $module) = @_;
+ $module = 'module' unless defined $module;
$self = $self->_clone;
push @{ $self->{exclusions} ||= [] }, $exclusion;
- return $self->_simplify;
+ return $self->_simplify($module);
}
sub _accepts {
@@ -787,7 +870,7 @@ CPAN::Meta::Requirements - a set of version requirements for a CPAN dist
=head1 VERSION
-version 2.132
+version 2.140
=head1 SYNOPSIS
@@ -887,9 +970,9 @@ This method returns the requirements object.
$req->add_requirements( $another_req_object );
-This method adds all the requirements in the given CPAN::Meta::Requirements object
-to the requirements object on which it was called. If there are any conflicts,
-an exception is thrown.
+This method adds all the requirements in the given CPAN::Meta::Requirements
+object to the requirements object on which it was called. If there are any
+conflicts, an exception is thrown.
This method returns the requirements object.
@@ -924,7 +1007,17 @@ This returns a string containing the version requirements for a given module in
the format described in L<CPAN::Meta::Spec> or undef if the given module has no
requirements. This should only be used for informational purposes such as error
messages and should not be interpreted or used for comparison (see
-L</accepts_module> instead.)
+L</accepts_module> instead).
+
+=head2 structured_requirements_for_module
+
+ $req->structured_requirements_for_module( $module );
+
+This returns a data structure containing the version requirements for a given
+module or undef if the given module has no requirements. This should
+not be used for version checks (see L</accepts_module> instead).
+
+Added in version 2.134.
=head2 required_modules
@@ -1041,7 +1134,7 @@ method.
=head2 Bugs / Feature Requests
Please report any bugs or feature requests through the issue tracker
-at L<https://github.com/dagolden/CPAN-Meta-Requirements/issues>.
+at L<https://github.com/Perl-Toolchain-Gang/CPAN-Meta-Requirements/issues>.
You will be notified automatically of any progress on your issue.
=head2 Source Code
@@ -1049,9 +1142,9 @@ You will be notified automatically of any progress on your issue.
This is open source software. The code repository is available for
public review and contribution under the terms of the license.
-L<https://github.com/dagolden/CPAN-Meta-Requirements>
+L<https://github.com/Perl-Toolchain-Gang/CPAN-Meta-Requirements>
- git clone https://github.com/dagolden/CPAN-Meta-Requirements.git
+ git clone https://github.com/Perl-Toolchain-Gang/CPAN-Meta-Requirements.git
=head1 AUTHORS
diff --git a/Master/tlpkg/tlperl/lib/CPAN/Meta/Spec.pm b/Master/tlpkg/tlperl/lib/CPAN/Meta/Spec.pm
index ec68f178edf..9056940b51a 100644
--- a/Master/tlpkg/tlperl/lib/CPAN/Meta/Spec.pm
+++ b/Master/tlpkg/tlperl/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/Master/tlpkg/tlperl/lib/CPAN/Meta/Validator.pm b/Master/tlpkg/tlperl/lib/CPAN/Meta/Validator.pm
index cc0409e6e48..eddaa107302 100644
--- a/Master/tlpkg/tlperl/lib/CPAN/Meta/Validator.pm
+++ b/Master/tlpkg/tlperl/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/Master/tlpkg/tlperl/lib/CPAN/Meta/YAML.pm b/Master/tlpkg/tlperl/lib/CPAN/Meta/YAML.pm
index 387a8c4bb80..746abd63bc4 100644
--- a/Master/tlpkg/tlperl/lib/CPAN/Meta/YAML.pm
+++ b/Master/tlpkg/tlperl/lib/CPAN/Meta/YAML.pm
@@ -1,17 +1,12 @@
use 5.008001; # sane UTF-8 support
use strict;
use warnings;
-package CPAN::Meta::YAML;
-$CPAN::Meta::YAML::VERSION = '0.012';
-BEGIN {
- $CPAN::Meta::YAML::AUTHORITY = 'cpan:ADAMK';
-}
-# git description: v1.60-1-g1c16a0a
-; # original $VERSION removed by Doppelgaenger
+package CPAN::Meta::YAML; # git description: v1.68-2-gcc5324e
# XXX-INGY is 5.8.1 too old/broken for utf8?
# XXX-XDG Lancaster consensus was that it was sufficient until
# proven otherwise
-
+$CPAN::Meta::YAML::VERSION = '0.018';
+; # original $VERSION removed by Doppelgaenger
#####################################################################
# The CPAN::Meta::YAML API.
@@ -153,7 +148,7 @@ my %QUOTE = map { $_ => 1 } qw{
my $re_capture_double_quoted = qr/\"([^\\"]*(?:\\.[^\\"]*)*)\"/;
my $re_capture_single_quoted = qr/\'([^\']*(?:\'\'[^\']*)*)\'/;
# unquoted re gets trailing space that needs to be stripped
-my $re_capture_unquoted_key = qr/([^:]+(?::+\S[^:]*)*)(?=\s*\:(?:\s+|$))/;
+my $re_capture_unquoted_key = qr/([^:]+(?::+\S(?:[^:]*|.*?(?=:)))*)(?=\s*\:(?:\s+|$))/;
my $re_trailing_comment = qr/(?:\s+\#.*)?/;
my $re_key_value_separator = qr/\s*:(?:\s+(?:\#.*)?|$)/;
@@ -300,10 +295,11 @@ Did you decode with lax ":utf8" instead of strict ":encoding(UTF-8)"?
}
}
};
- if ( ref $@ eq 'SCALAR' ) {
- $self->_error(${$@});
- } elsif ( $@ ) {
- $self->_error($@);
+ my $err = $@;
+ if ( ref $err eq 'SCALAR' ) {
+ $self->_error(${$err});
+ } elsif ( $err ) {
+ $self->_error($err);
}
return $self;
@@ -515,6 +511,10 @@ sub _load_hash {
die \"CPAN::Meta::YAML failed to classify line '$lines->[0]'";
}
+ if ( exists $hash->{$key} ) {
+ warn "CPAN::Meta::YAML found a duplicate key '$key' in line '$lines->[0]'";
+ }
+
# Do we have a value?
if ( length $lines->[0] ) {
# Yes
@@ -828,12 +828,10 @@ sub _can_flock {
#####################################################################
# Use Scalar::Util if possible, otherwise emulate it
+use Scalar::Util ();
BEGIN {
local $@;
- if ( eval { require Scalar::Util }
- && $Scalar::Util::VERSION
- && eval($Scalar::Util::VERSION) >= 1.18
- ) {
+ if ( eval { Scalar::Util->VERSION(1.18); } ) {
*refaddr = *Scalar::Util::refaddr;
}
else {
@@ -855,8 +853,7 @@ END_PERL
}
}
-
-
+delete $CPAN::Meta::YAML::{refaddr};
1;
@@ -881,7 +878,7 @@ CPAN::Meta::YAML - Read and write a subset of YAML for CPAN Meta files
=head1 VERSION
-version 0.012
+version 0.018
=head1 SYNOPSIS
@@ -917,31 +914,12 @@ C<write> methods do B<not> support UTF-8 and should not be used.
This module is currently derived from L<YAML::Tiny> by Adam Kennedy. If
there are bugs in how it parses a particular META.yml file, please file
a bug report in the YAML::Tiny bugtracker:
-L<https://rt.cpan.org/Public/Dist/Display.html?Name=YAML-Tiny>
+L<https://github.com/Perl-Toolchain-Gang/YAML-Tiny/issues>
=head1 SEE ALSO
L<YAML::Tiny>, L<YAML>, L<YAML::XS>
-=for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
-
-=head1 SUPPORT
-
-=head2 Bugs / Feature Requests
-
-Please report any bugs or feature requests through the issue tracker
-at L<https://github.com/dagolden/CPAN-Meta-YAML/issues>.
-You will be notified automatically of any progress on your issue.
-
-=head2 Source Code
-
-This is open source software. The code repository is available for
-public review and contribution under the terms of the license.
-
-L<https://github.com/dagolden/CPAN-Meta-YAML>
-
- git clone https://github.com/dagolden/CPAN-Meta-YAML.git
-
=head1 AUTHORS
=over 4