[Jifty-commit] r7113 - in jifty/trunk: . inc/Module
Jifty commits
jifty-commit at lists.jifty.org
Wed May 27 12:22:30 EDT 2009
Author: sartak
Date: Wed May 27 12:22:29 2009
New Revision: 7113
Modified:
jifty/trunk/META.yml
jifty/trunk/inc/Module/AutoInstall.pm
jifty/trunk/inc/Module/Install.pm
jifty/trunk/inc/Module/Install/AutoInstall.pm
jifty/trunk/inc/Module/Install/Base.pm
jifty/trunk/inc/Module/Install/Can.pm
jifty/trunk/inc/Module/Install/Fetch.pm
jifty/trunk/inc/Module/Install/Include.pm
jifty/trunk/inc/Module/Install/Makefile.pm
jifty/trunk/inc/Module/Install/Metadata.pm
jifty/trunk/inc/Module/Install/Scripts.pm
jifty/trunk/inc/Module/Install/Share.pm
jifty/trunk/inc/Module/Install/Win32.pm
jifty/trunk/inc/Module/Install/WriteAll.pm
Log:
Update MI from 0.85 to 0.89
Modified: jifty/trunk/META.yml
==============================================================================
--- jifty/trunk/META.yml (original)
+++ jifty/trunk/META.yml Wed May 27 12:22:29 2009
@@ -5,7 +5,7 @@
configure_requires:
ExtUtils::MakeMaker: 6.42
distribution_type: module
-generated_by: 'Module::Install version 0.85'
+generated_by: 'Module::Install version 0.89'
license: Perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
Modified: jifty/trunk/inc/Module/AutoInstall.pm
==============================================================================
--- jifty/trunk/inc/Module/AutoInstall.pm (original)
+++ jifty/trunk/inc/Module/AutoInstall.pm Wed May 27 12:22:29 2009
@@ -18,7 +18,9 @@
# various lexical flags
my ( @Missing, @Existing, %DisabledTests, $UnderCPAN, $HasCPANPLUS );
-my ( $Config, $CheckOnly, $SkipInstall, $AcceptDefault, $TestOnly );
+my (
+ $Config, $CheckOnly, $SkipInstall, $AcceptDefault, $TestOnly, $AllDeps
+);
my ( $PostambleActions, $PostambleUsed );
# See if it's a testing or non-interactive session
@@ -73,6 +75,9 @@
elsif ( $arg =~ /^--test(?:only)?$/ ) {
$TestOnly = 1;
}
+ elsif ( $arg =~ /^--all(?:deps)?$/ ) {
+ $AllDeps = 1;
+ }
}
}
@@ -115,7 +120,12 @@
)[0]
);
- $UnderCPAN = _check_lock(1); # check for $UnderCPAN
+ # We want to know if we're under CPAN early to avoid prompting, but
+ # if we aren't going to try and install anything anyway then skip the
+ # check entirely since we don't want to have to load (and configure)
+ # an old CPAN just for a cosmetic message
+
+ $UnderCPAN = _check_lock(1) unless $SkipInstall;
while ( my ( $feature, $modules ) = splice( @args, 0, 2 ) ) {
my ( @required, @tests, @skiptests );
@@ -165,15 +175,24 @@
}
# XXX: check for conflicts and uninstalls(!) them.
- if (
- defined( my $cur = _version_check( _load($mod), $arg ||= 0 ) ) )
+ my $cur = _load($mod);
+ if (_version_cmp ($cur, $arg) >= 0)
{
print "loaded. ($cur" . ( $arg ? " >= $arg" : '' ) . ")\n";
push @Existing, $mod => $arg;
$DisabledTests{$_} = 1 for map { glob($_) } @skiptests;
}
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;
}
}
@@ -187,6 +206,7 @@
and (
$CheckOnly
or ($mandatory and $UnderCPAN)
+ or $AllDeps
or _prompt(
qq{==> Auto-install the }
. ( @required / 2 )
@@ -235,21 +255,38 @@
*{'main::WriteMakefile'} = \&Write if caller(0) eq 'main';
}
+sub _running_under {
+ my $thing = shift;
+ print <<"END_MESSAGE";
+*** Since we're running under ${thing}, I'll just let it take care
+ of the dependency's installation later.
+END_MESSAGE
+ return 1;
+}
+
# Check to see if we are currently running under CPAN.pm and/or CPANPLUS;
# if we are, then we simply let it taking care of our dependencies
sub _check_lock {
return unless @Missing or @_;
+ my $cpan_env = $ENV{PERL5_CPAN_IS_RUNNING};
+
if ($ENV{PERL5_CPANPLUS_IS_RUNNING}) {
- print <<'END_MESSAGE';
+ return _running_under($cpan_env ? 'CPAN' : 'CPANPLUS');
+ }
-*** Since we're running under CPANPLUS, I'll just let it take care
- of the dependency's installation later.
-END_MESSAGE
- return 1;
+ require CPAN;
+
+ if ($CPAN::VERSION > '1.89') {
+ if ($cpan_env) {
+ return _running_under('CPAN');
+ }
+ return; # CPAN.pm new enough, don't need to check further
}
- _load_cpan();
+ # last ditch attempt, this -will- configure CPAN, very sorry
+
+ _load_cpan(1); # force initialize even though it's already loaded
# Find the CPAN lock-file
my $lock = MM->catfile( $CPAN::Config->{cpan_home}, ".lock" );
@@ -285,7 +322,7 @@
while ( my ( $pkg, $ver ) = splice( @_, 0, 2 ) ) {
# grep out those already installed
- if ( defined( _version_check( _load($pkg), $ver ) ) ) {
+ if ( _version_cmp( _load($pkg), $ver ) >= 0 ) {
push @installed, $pkg;
}
else {
@@ -324,7 +361,7 @@
# see if we have successfully installed them
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;
}
elsif ( $args{do_once} and open( FAILED, '>> .#autoinstall.failed' ) ) {
@@ -379,7 +416,7 @@
my $success;
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;
$pathname =~ s/::/\\W/;
@@ -472,7 +509,7 @@
my $obj = CPAN::Shell->expand( Module => $pkg );
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;
$pathname =~ s/::/\\W/;
@@ -536,7 +573,7 @@
my $ver = shift;
return
- if defined( _version_check( _load($class), $ver ) ); # no need to upgrade
+ if _version_cmp( _load($class), $ver ) >= 0; # no need to upgrade
if (
_prompt( "==> A newer version of $class ($ver) is required. Install?",
@@ -633,7 +670,7 @@
# Load CPAN.pm and it's configuration
sub _load_cpan {
- return if $CPAN::VERSION;
+ return if $CPAN::VERSION and $CPAN::Config and not @_;
require CPAN;
if ( $CPAN::HandleConfig::VERSION ) {
# Newer versions of CPAN have a HandleConfig module
@@ -645,9 +682,11 @@
}
# compare two versions, either use Sort::Versions or plain comparison
-sub _version_check {
+# return values same as <=>
+sub _version_cmp {
my ( $cur, $min ) = @_;
- return unless defined $cur;
+ return -1 unless defined $cur; # if 0 keep comparing
+ return 1 unless $min;
$cur =~ s/\s+$//;
@@ -658,16 +697,13 @@
) {
# use version.pm if it is installed.
- return (
- ( version->new($cur) >= version->new($min) ) ? $cur : undef );
+ return version->new($cur) <=> version->new($min);
}
elsif ( $Sort::Versions::VERSION or defined( _load('Sort::Versions') ) )
{
# use Sort::Versions as the sorting algorithm for a.b.c versions
- return ( ( Sort::Versions::versioncmp( $cur, $min ) != -1 )
- ? $cur
- : undef );
+ return Sort::Versions::versioncmp( $cur, $min );
}
warn "Cannot reliably compare non-decimal formatted versions.\n"
@@ -676,7 +712,7 @@
# plain comparison
local $^W = 0; # shuts off 'not numeric' bugs
- return ( $cur >= $min ? $cur : undef );
+ return $cur <=> $min;
}
# nothing; this usage is deprecated.
@@ -766,4 +802,4 @@
__END__
-#line 1004
+#line 1056
Modified: jifty/trunk/inc/Module/Install.pm
==============================================================================
--- jifty/trunk/inc/Module/Install.pm (original)
+++ jifty/trunk/inc/Module/Install.pm Wed May 27 12:22:29 2009
@@ -28,7 +28,7 @@
# 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
# Module::Install extensions.
- $VERSION = '0.85';
+ $VERSION = '0.89';
# Storage for the pseudo-singleton
$MAIN = undef;
@@ -353,7 +353,7 @@
if ( $] >= 5.006 ) {
open( FH, '<', $_[0] ) or die "open($_[0]): $!";
} else {
- open( FH, "< $_[0]" ) or die "open($_[0]): $!";
+ open( FH, "< $_[0]" ) or die "open($_[0]): $!";
}
my $string = do { local $/; <FH> };
close FH or die "close($_[0]): $!";
@@ -384,7 +384,7 @@
if ( $] >= 5.006 ) {
open( FH, '>', $_[0] ) or die "open($_[0]): $!";
} else {
- open( FH, "> $_[0]" ) or die "open($_[0]): $!";
+ open( FH, "> $_[0]" ) or die "open($_[0]): $!";
}
foreach ( 1 .. $#_ ) {
print FH $_[$_] or die "print($_[0]): $!";
Modified: jifty/trunk/inc/Module/Install/AutoInstall.pm
==============================================================================
--- jifty/trunk/inc/Module/Install/AutoInstall.pm (original)
+++ jifty/trunk/inc/Module/Install/AutoInstall.pm Wed May 27 12:22:29 2009
@@ -6,7 +6,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.85';
+ $VERSION = '0.89';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: jifty/trunk/inc/Module/Install/Base.pm
==============================================================================
--- jifty/trunk/inc/Module/Install/Base.pm (original)
+++ jifty/trunk/inc/Module/Install/Base.pm Wed May 27 12:22:29 2009
@@ -4,7 +4,7 @@
use strict 'vars';
use vars qw{$VERSION};
BEGIN {
- $VERSION = '0.85';
+ $VERSION = '0.89';
}
# Suspend handler for "redefined" warnings
Modified: jifty/trunk/inc/Module/Install/Can.pm
==============================================================================
--- jifty/trunk/inc/Module/Install/Can.pm (original)
+++ jifty/trunk/inc/Module/Install/Can.pm Wed May 27 12:22:29 2009
@@ -9,7 +9,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.85';
+ $VERSION = '0.89';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: jifty/trunk/inc/Module/Install/Fetch.pm
==============================================================================
--- jifty/trunk/inc/Module/Install/Fetch.pm (original)
+++ jifty/trunk/inc/Module/Install/Fetch.pm Wed May 27 12:22:29 2009
@@ -6,7 +6,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.85';
+ $VERSION = '0.89';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: jifty/trunk/inc/Module/Install/Include.pm
==============================================================================
--- jifty/trunk/inc/Module/Install/Include.pm (original)
+++ jifty/trunk/inc/Module/Install/Include.pm Wed May 27 12:22:29 2009
@@ -6,7 +6,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.85';
+ $VERSION = '0.89';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: jifty/trunk/inc/Module/Install/Makefile.pm
==============================================================================
--- jifty/trunk/inc/Module/Install/Makefile.pm (original)
+++ jifty/trunk/inc/Module/Install/Makefile.pm Wed May 27 12:22:29 2009
@@ -7,7 +7,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.85';
+ $VERSION = '0.89';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: jifty/trunk/inc/Module/Install/Metadata.pm
==============================================================================
--- jifty/trunk/inc/Module/Install/Metadata.pm (original)
+++ jifty/trunk/inc/Module/Install/Metadata.pm Wed May 27 12:22:29 2009
@@ -6,7 +6,7 @@
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.85';
+ $VERSION = '0.89';
@ISA = qw{Module::Install::Base};
$ISCORE = 1;
}
@@ -440,21 +440,21 @@
/ixms ) {
my $license_text = $1;
my @phrases = (
- 'under the same (?:terms|license) as perl itself' => 'perl', 1,
- 'GNU general public license' => 'gpl', 1,
- 'GNU public license' => 'gpl', 1,
- 'GNU lesser general public license' => 'lgpl', 1,
- 'GNU lesser public license' => 'lgpl', 1,
- 'GNU library general public license' => 'lgpl', 1,
- 'GNU library public license' => 'lgpl', 1,
- 'BSD license' => 'bsd', 1,
- 'Artistic license' => 'artistic', 1,
- 'GPL' => 'gpl', 1,
- 'LGPL' => 'lgpl', 1,
- 'BSD' => 'bsd', 1,
- 'Artistic' => 'artistic', 1,
- 'MIT' => 'mit', 1,
- 'proprietary' => 'proprietary', 0,
+ 'under the same (?:terms|license) as (?:perl|the perl programming language) itself' => 'perl', 1,
+ 'GNU general public license' => 'gpl', 1,
+ 'GNU public license' => 'gpl', 1,
+ 'GNU lesser general public license' => 'lgpl', 1,
+ 'GNU lesser public license' => 'lgpl', 1,
+ 'GNU library general public license' => 'lgpl', 1,
+ 'GNU library public license' => 'lgpl', 1,
+ 'BSD license' => 'bsd', 1,
+ 'Artistic license' => 'artistic', 1,
+ 'GPL' => 'gpl', 1,
+ 'LGPL' => 'lgpl', 1,
+ 'BSD' => 'bsd', 1,
+ 'Artistic' => 'artistic', 1,
+ 'MIT' => 'mit', 1,
+ 'proprietary' => 'proprietary', 0,
);
while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) {
$pattern =~ s{\s+}{\\s+}g;
@@ -511,7 +511,7 @@
# Also, convert double-part versions (eg, 5.8)
sub _perl_version {
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/(\.\d\d\d)000$/$1/;
$v =~ s/_.+$//;
@@ -534,7 +534,7 @@
sub write_mymeta {
my $self = shift;
-
+
# If there's no existing META.yml there is nothing we can do
return unless -f 'META.yml';
@@ -574,7 +574,7 @@
# Save as the MYMETA.yml file
print "Writing MYMETA.yml\n";
- YAML::Tiny::DumpFile('MYMETA.yml', $meta);
+ YAML::Tiny::DumpFile('MYMETA.yml', $meta);
}
1;
Modified: jifty/trunk/inc/Module/Install/Scripts.pm
==============================================================================
--- jifty/trunk/inc/Module/Install/Scripts.pm (original)
+++ jifty/trunk/inc/Module/Install/Scripts.pm Wed May 27 12:22:29 2009
@@ -6,7 +6,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.85';
+ $VERSION = '0.89';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: jifty/trunk/inc/Module/Install/Share.pm
==============================================================================
--- jifty/trunk/inc/Module/Install/Share.pm (original)
+++ jifty/trunk/inc/Module/Install/Share.pm Wed May 27 12:22:29 2009
@@ -6,7 +6,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.85';
+ $VERSION = '0.89';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: jifty/trunk/inc/Module/Install/Win32.pm
==============================================================================
--- jifty/trunk/inc/Module/Install/Win32.pm (original)
+++ jifty/trunk/inc/Module/Install/Win32.pm Wed May 27 12:22:29 2009
@@ -6,7 +6,7 @@
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.85';
+ $VERSION = '0.89';
@ISA = qw{Module::Install::Base};
$ISCORE = 1;
}
Modified: jifty/trunk/inc/Module/Install/WriteAll.pm
==============================================================================
--- jifty/trunk/inc/Module/Install/WriteAll.pm (original)
+++ jifty/trunk/inc/Module/Install/WriteAll.pm Wed May 27 12:22:29 2009
@@ -6,7 +6,7 @@
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.85';
+ $VERSION = '0.89';
@ISA = qw{Module::Install::Base};
$ISCORE = 1;
}
More information about the Jifty-commit
mailing list