Commit beeb2300 authored by Ruslan Zakirov's avatar Ruslan Zakirov
Browse files

update M::I

parent f923d095
...@@ -8,7 +8,7 @@ build_requires: ...@@ -8,7 +8,7 @@ build_requires:
configure_requires: configure_requires:
ExtUtils::MakeMaker: 6.42 ExtUtils::MakeMaker: 6.42
distribution_type: module distribution_type: module
generated_by: 'Module::Install version 0.87' generated_by: 'Module::Install version 0.88'
license: gpl2 license: gpl2
meta-spec: meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html url: http://module-build.sourceforge.net/META-spec-v1.4.html
......
...@@ -175,15 +175,24 @@ sub import { ...@@ -175,15 +175,24 @@ sub import {
} }
# XXX: check for conflicts and uninstalls(!) them. # XXX: check for conflicts and uninstalls(!) them.
if ( my $cur = _load($mod);
defined( my $cur = _version_check( _load($mod), $arg ||= 0 ) ) ) if (_version_cmp ($cur, $arg) >= 0)
{ {
print "loaded. ($cur" . ( $arg ? " >= $arg" : '' ) . ")\n"; print "loaded. ($cur" . ( $arg ? " >= $arg" : '' ) . ")\n";
push @Existing, $mod => $arg; push @Existing, $mod => $arg;
$DisabledTests{$_} = 1 for map { glob($_) } @skiptests; $DisabledTests{$_} = 1 for map { glob($_) } @skiptests;
} }
else { else {
print "missing." . ( $arg ? " (would need $arg)" : '' ) . "\n"; if (not defined $cur) # indeed missing
{
print "missing." . ( $arg ? " (would need $arg)" : '' ) . "\n";
}
else
{
# no need to check $arg as _version_cmp ($cur, undef) would satisfy >= above
print "too old. ($cur < $arg)\n";
}
push @required, $mod => $arg; push @required, $mod => $arg;
} }
} }
...@@ -268,8 +277,11 @@ sub _check_lock { ...@@ -268,8 +277,11 @@ sub _check_lock {
require CPAN; require CPAN;
if ($CPAN::VERSION > '1.89' && $cpan_env) { if ($CPAN::VERSION > '1.89') {
return _running_under('CPAN'); if ($cpan_env) {
return _running_under('CPAN');
}
return; # CPAN.pm new enough, don't need to check further
} }
# last ditch attempt, this -will- configure CPAN, very sorry # last ditch attempt, this -will- configure CPAN, very sorry
...@@ -310,7 +322,7 @@ sub install { ...@@ -310,7 +322,7 @@ sub install {
while ( my ( $pkg, $ver ) = splice( @_, 0, 2 ) ) { while ( my ( $pkg, $ver ) = splice( @_, 0, 2 ) ) {
# grep out those already installed # grep out those already installed
if ( defined( _version_check( _load($pkg), $ver ) ) ) { if ( _version_cmp( _load($pkg), $ver ) >= 0 ) {
push @installed, $pkg; push @installed, $pkg;
} }
else { else {
...@@ -349,7 +361,7 @@ sub install { ...@@ -349,7 +361,7 @@ sub install {
# see if we have successfully installed them # see if we have successfully installed them
while ( my ( $pkg, $ver ) = splice( @modules, 0, 2 ) ) { while ( my ( $pkg, $ver ) = splice( @modules, 0, 2 ) ) {
if ( defined( _version_check( _load($pkg), $ver ) ) ) { if ( _version_cmp( _load($pkg), $ver ) >= 0 ) {
push @installed, $pkg; push @installed, $pkg;
} }
elsif ( $args{do_once} and open( FAILED, '>> .#autoinstall.failed' ) ) { elsif ( $args{do_once} and open( FAILED, '>> .#autoinstall.failed' ) ) {
...@@ -404,7 +416,7 @@ sub _install_cpanplus { ...@@ -404,7 +416,7 @@ sub _install_cpanplus {
my $success; my $success;
my $obj = $modtree->{$pkg}; my $obj = $modtree->{$pkg};
if ( $obj and defined( _version_check( $obj->{version}, $ver ) ) ) { if ( $obj and _version_cmp( $obj->{version}, $ver ) >= 0 ) {
my $pathname = $pkg; my $pathname = $pkg;
$pathname =~ s/::/\\W/; $pathname =~ s/::/\\W/;
...@@ -497,7 +509,7 @@ sub _install_cpan { ...@@ -497,7 +509,7 @@ sub _install_cpan {
my $obj = CPAN::Shell->expand( Module => $pkg ); my $obj = CPAN::Shell->expand( Module => $pkg );
my $success = 0; my $success = 0;
if ( $obj and defined( _version_check( $obj->cpan_version, $ver ) ) ) { if ( $obj and _version_cmp( $obj->cpan_version, $ver ) >= 0 ) {
my $pathname = $pkg; my $pathname = $pkg;
$pathname =~ s/::/\\W/; $pathname =~ s/::/\\W/;
...@@ -561,7 +573,7 @@ sub _update_to { ...@@ -561,7 +573,7 @@ sub _update_to {
my $ver = shift; my $ver = shift;
return return
if defined( _version_check( _load($class), $ver ) ); # no need to upgrade if _version_cmp( _load($class), $ver ) >= 0; # no need to upgrade
if ( if (
_prompt( "==> A newer version of $class ($ver) is required. Install?", _prompt( "==> A newer version of $class ($ver) is required. Install?",
...@@ -670,9 +682,11 @@ sub _load_cpan { ...@@ -670,9 +682,11 @@ sub _load_cpan {
} }
# compare two versions, either use Sort::Versions or plain comparison # compare two versions, either use Sort::Versions or plain comparison
sub _version_check { # return values same as <=>
sub _version_cmp {
my ( $cur, $min ) = @_; my ( $cur, $min ) = @_;
return unless defined $cur; return -1 unless defined $cur; # if 0 keep comparing
return 1 unless $min;
$cur =~ s/\s+$//; $cur =~ s/\s+$//;
...@@ -683,16 +697,13 @@ sub _version_check { ...@@ -683,16 +697,13 @@ sub _version_check {
) { ) {
# use version.pm if it is installed. # use version.pm if it is installed.
return ( return version->new($cur) <=> version->new($min);
( version->new($cur) >= version->new($min) ) ? $cur : undef );
} }
elsif ( $Sort::Versions::VERSION or defined( _load('Sort::Versions') ) ) elsif ( $Sort::Versions::VERSION or defined( _load('Sort::Versions') ) )
{ {
# use Sort::Versions as the sorting algorithm for a.b.c versions # use Sort::Versions as the sorting algorithm for a.b.c versions
return ( ( Sort::Versions::versioncmp( $cur, $min ) != -1 ) return Sort::Versions::versioncmp( $cur, $min );
? $cur
: undef );
} }
warn "Cannot reliably compare non-decimal formatted versions.\n" warn "Cannot reliably compare non-decimal formatted versions.\n"
...@@ -701,7 +712,7 @@ sub _version_check { ...@@ -701,7 +712,7 @@ sub _version_check {
# plain comparison # plain comparison
local $^W = 0; # shuts off 'not numeric' bugs local $^W = 0; # shuts off 'not numeric' bugs
return ( $cur >= $min ? $cur : undef ); return $cur <=> $min;
} }
# nothing; this usage is deprecated. # nothing; this usage is deprecated.
...@@ -791,4 +802,4 @@ END_MAKE ...@@ -791,4 +802,4 @@ END_MAKE
__END__ __END__
#line 1045 #line 1056
...@@ -28,7 +28,7 @@ BEGIN { ...@@ -28,7 +28,7 @@ BEGIN {
# This is not enforced yet, but will be some time in the next few # This is not enforced yet, but will be some time in the next few
# releases once we can make sure it won't clash with custom # releases once we can make sure it won't clash with custom
# Module::Install extensions. # Module::Install extensions.
$VERSION = '0.87'; $VERSION = '0.88';
# Storage for the pseudo-singleton # Storage for the pseudo-singleton
$MAIN = undef; $MAIN = undef;
...@@ -353,7 +353,7 @@ sub _read { ...@@ -353,7 +353,7 @@ sub _read {
if ( $] >= 5.006 ) { if ( $] >= 5.006 ) {
open( FH, '<', $_[0] ) or die "open($_[0]): $!"; open( FH, '<', $_[0] ) or die "open($_[0]): $!";
} else { } else {
open( FH, "< $_[0]" ) or die "open($_[0]): $!"; open( FH, "< $_[0]" ) or die "open($_[0]): $!";
} }
my $string = do { local $/; <FH> }; my $string = do { local $/; <FH> };
close FH or die "close($_[0]): $!"; close FH or die "close($_[0]): $!";
...@@ -384,7 +384,7 @@ sub _write { ...@@ -384,7 +384,7 @@ sub _write {
if ( $] >= 5.006 ) { if ( $] >= 5.006 ) {
open( FH, '>', $_[0] ) or die "open($_[0]): $!"; open( FH, '>', $_[0] ) or die "open($_[0]): $!";
} else { } else {
open( FH, "> $_[0]" ) or die "open($_[0]): $!"; open( FH, "> $_[0]" ) or die "open($_[0]): $!";
} }
foreach ( 1 .. $#_ ) { foreach ( 1 .. $#_ ) {
print FH $_[$_] or die "print($_[0]): $!"; print FH $_[$_] or die "print($_[0]): $!";
......
...@@ -6,7 +6,7 @@ use Module::Install::Base; ...@@ -6,7 +6,7 @@ use Module::Install::Base;
use vars qw{$VERSION $ISCORE @ISA}; use vars qw{$VERSION $ISCORE @ISA};
BEGIN { BEGIN {
$VERSION = '0.87'; $VERSION = '0.88';
$ISCORE = 1; $ISCORE = 1;
@ISA = qw{Module::Install::Base}; @ISA = qw{Module::Install::Base};
} }
......
...@@ -4,7 +4,7 @@ package Module::Install::Base; ...@@ -4,7 +4,7 @@ package Module::Install::Base;
use strict 'vars'; use strict 'vars';
use vars qw{$VERSION}; use vars qw{$VERSION};
BEGIN { BEGIN {
$VERSION = '0.87'; $VERSION = '0.88';
} }
# Suspend handler for "redefined" warnings # Suspend handler for "redefined" warnings
......
...@@ -9,7 +9,7 @@ use ExtUtils::MakeMaker (); ...@@ -9,7 +9,7 @@ use ExtUtils::MakeMaker ();
use vars qw{$VERSION $ISCORE @ISA}; use vars qw{$VERSION $ISCORE @ISA};
BEGIN { BEGIN {
$VERSION = '0.87'; $VERSION = '0.88';
$ISCORE = 1; $ISCORE = 1;
@ISA = qw{Module::Install::Base}; @ISA = qw{Module::Install::Base};
} }
......
...@@ -6,7 +6,7 @@ use Module::Install::Base; ...@@ -6,7 +6,7 @@ use Module::Install::Base;
use vars qw{$VERSION $ISCORE @ISA}; use vars qw{$VERSION $ISCORE @ISA};
BEGIN { BEGIN {
$VERSION = '0.87'; $VERSION = '0.88';
$ISCORE = 1; $ISCORE = 1;
@ISA = qw{Module::Install::Base}; @ISA = qw{Module::Install::Base};
} }
......
...@@ -6,7 +6,7 @@ use Module::Install::Base; ...@@ -6,7 +6,7 @@ use Module::Install::Base;
use vars qw{$VERSION $ISCORE @ISA}; use vars qw{$VERSION $ISCORE @ISA};
BEGIN { BEGIN {
$VERSION = '0.87'; $VERSION = '0.88';
$ISCORE = 1; $ISCORE = 1;
@ISA = qw{Module::Install::Base}; @ISA = qw{Module::Install::Base};
} }
......
...@@ -7,7 +7,7 @@ use ExtUtils::MakeMaker (); ...@@ -7,7 +7,7 @@ use ExtUtils::MakeMaker ();
use vars qw{$VERSION $ISCORE @ISA}; use vars qw{$VERSION $ISCORE @ISA};
BEGIN { BEGIN {
$VERSION = '0.87'; $VERSION = '0.88';
$ISCORE = 1; $ISCORE = 1;
@ISA = qw{Module::Install::Base}; @ISA = qw{Module::Install::Base};
} }
......
...@@ -6,7 +6,7 @@ use Module::Install::Base; ...@@ -6,7 +6,7 @@ use Module::Install::Base;
use vars qw{$VERSION @ISA $ISCORE}; use vars qw{$VERSION @ISA $ISCORE};
BEGIN { BEGIN {
$VERSION = '0.87'; $VERSION = '0.88';
@ISA = qw{Module::Install::Base}; @ISA = qw{Module::Install::Base};
$ISCORE = 1; $ISCORE = 1;
} }
...@@ -511,7 +511,7 @@ sub requires_from { ...@@ -511,7 +511,7 @@ sub requires_from {
# Also, convert double-part versions (eg, 5.8) # Also, convert double-part versions (eg, 5.8)
sub _perl_version { sub _perl_version {
my $v = $_[-1]; my $v = $_[-1];
$v =~ s/^([1-9])\.([1-9]\d?\d?)$/sprintf("%d.%03d",$1,$2)/e; $v =~ s/^([1-9])\.([1-9]\d?\d?)$/sprintf("%d.%03d",$1,$2)/e;
$v =~ s/^([1-9])\.([1-9]\d?\d?)\.(0|[1-9]\d?\d?)$/sprintf("%d.%03d%03d",$1,$2,$3 || 0)/e; $v =~ s/^([1-9])\.([1-9]\d?\d?)\.(0|[1-9]\d?\d?)$/sprintf("%d.%03d%03d",$1,$2,$3 || 0)/e;
$v =~ s/(\.\d\d\d)000$/$1/; $v =~ s/(\.\d\d\d)000$/$1/;
$v =~ s/_.+$//; $v =~ s/_.+$//;
...@@ -534,7 +534,7 @@ sub WriteMyMeta { ...@@ -534,7 +534,7 @@ sub WriteMyMeta {
sub write_mymeta { sub write_mymeta {
my $self = shift; my $self = shift;
# If there's no existing META.yml there is nothing we can do # If there's no existing META.yml there is nothing we can do
return unless -f 'META.yml'; return unless -f 'META.yml';
...@@ -574,7 +574,7 @@ sub write_mymeta { ...@@ -574,7 +574,7 @@ sub write_mymeta {
# Save as the MYMETA.yml file # Save as the MYMETA.yml file
print "Writing MYMETA.yml\n"; print "Writing MYMETA.yml\n";
YAML::Tiny::DumpFile('MYMETA.yml', $meta); YAML::Tiny::DumpFile('MYMETA.yml', $meta);
} }
1; 1;
...@@ -6,7 +6,7 @@ use Module::Install::Base; ...@@ -6,7 +6,7 @@ use Module::Install::Base;
use vars qw{$VERSION @ISA $ISCORE}; use vars qw{$VERSION @ISA $ISCORE};
BEGIN { BEGIN {
$VERSION = '0.87'; $VERSION = '0.88';
@ISA = qw{Module::Install::Base}; @ISA = qw{Module::Install::Base};
$ISCORE = 1; $ISCORE = 1;
} }
......
...@@ -6,7 +6,7 @@ use Module::Install::Base; ...@@ -6,7 +6,7 @@ use Module::Install::Base;
use vars qw{$VERSION @ISA $ISCORE}; use vars qw{$VERSION @ISA $ISCORE};
BEGIN { BEGIN {
$VERSION = '0.87'; $VERSION = '0.88';
@ISA = qw{Module::Install::Base}; @ISA = qw{Module::Install::Base};
$ISCORE = 1; $ISCORE = 1;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment