diff options
author | Nicholas Clark <nick@ccl4.org> | 2008-10-15 11:27:28 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2008-10-15 11:27:28 +0000 |
commit | bf87a6a1535bf7af2029f8dd0c3728bfa1e325c6 (patch) | |
tree | a3403593d00e844fd4426e1bc4514d26b8a837f6 /lib | |
parent | 6bf6381f4513c0dbdea17a4f96c82c34672ca66c (diff) | |
download | perl-bf87a6a1535bf7af2029f8dd0c3728bfa1e325c6.tar.gz |
Upgrade to ExtUtils-MakeMaker-6.47_01
p4raw-id: //depot/perl@34482
Diffstat (limited to 'lib')
32 files changed, 444 insertions, 60 deletions
diff --git a/lib/ExtUtils/Command/MM.pm b/lib/ExtUtils/Command/MM.pm index 52dab27130..a9e7e148ff 100644 --- a/lib/ExtUtils/Command/MM.pm +++ b/lib/ExtUtils/Command/MM.pm @@ -10,7 +10,7 @@ our @ISA = qw(Exporter); our @EXPORT = qw(test_harness pod2man perllocal_install uninstall warn_if_old_packlist); -our $VERSION = '6.46'; +our $VERSION = '6.47_01'; my $Is_VMS = $^O eq 'VMS'; diff --git a/lib/ExtUtils/Liblist.pm b/lib/ExtUtils/Liblist.pm index e01802e02a..87b8d7d579 100644 --- a/lib/ExtUtils/Liblist.pm +++ b/lib/ExtUtils/Liblist.pm @@ -2,7 +2,7 @@ package ExtUtils::Liblist; use strict; -our $VERSION = '6.46'; +our $VERSION = '6.47_01'; use File::Spec; require ExtUtils::Liblist::Kid; diff --git a/lib/ExtUtils/Liblist/Kid.pm b/lib/ExtUtils/Liblist/Kid.pm index bddcf76a3b..5c16dbc276 100644 --- a/lib/ExtUtils/Liblist/Kid.pm +++ b/lib/ExtUtils/Liblist/Kid.pm @@ -9,7 +9,7 @@ use 5.006; # Broken out of MakeMaker from version 4.11 use strict; -our $VERSION = 6.46; +our $VERSION = 6.47_01; use Config; use Cwd 'cwd'; diff --git a/lib/ExtUtils/MM.pm b/lib/ExtUtils/MM.pm index db791d4a6e..d81d19ceed 100644 --- a/lib/ExtUtils/MM.pm +++ b/lib/ExtUtils/MM.pm @@ -3,7 +3,7 @@ package ExtUtils::MM; use strict; use ExtUtils::MakeMaker::Config; -our $VERSION = '6.46'; +our $VERSION = '6.47_01'; require ExtUtils::Liblist; require ExtUtils::MakeMaker; diff --git a/lib/ExtUtils/MM_AIX.pm b/lib/ExtUtils/MM_AIX.pm index f625d6b190..6d7d6320f4 100644 --- a/lib/ExtUtils/MM_AIX.pm +++ b/lib/ExtUtils/MM_AIX.pm @@ -1,7 +1,7 @@ package ExtUtils::MM_AIX; use strict; -our $VERSION = '6.46'; +our $VERSION = '6.47_01'; require ExtUtils::MM_Unix; our @ISA = qw(ExtUtils::MM_Unix); diff --git a/lib/ExtUtils/MM_Any.pm b/lib/ExtUtils/MM_Any.pm index 449db51fe5..f2519d602d 100644 --- a/lib/ExtUtils/MM_Any.pm +++ b/lib/ExtUtils/MM_Any.pm @@ -1,7 +1,7 @@ package ExtUtils::MM_Any; use strict; -our $VERSION = '6.46'; +our $VERSION = '6.47_01'; use Carp; use File::Spec; @@ -842,8 +842,12 @@ sub metafile_data { version => 1.4 }, ); + + # The author key is required and it takes a list. $meta{author} = defined $self->{AUTHOR} ? [$self->{AUTHOR}] : []; + $meta{requires} = $self->{PREREQ_PM} if defined $self->{PREREQ_PM}; + $meta{requires}{perl} = $self->{MIN_PERL_VERSION} if $self->{MIN_PERL_VERSION}; while( my($key, $val) = each %$meta_add ) { $meta{$key} = $val; diff --git a/lib/ExtUtils/MM_BeOS.pm b/lib/ExtUtils/MM_BeOS.pm index 807658bcb2..52dd0f8bbe 100644 --- a/lib/ExtUtils/MM_BeOS.pm +++ b/lib/ExtUtils/MM_BeOS.pm @@ -26,7 +26,7 @@ require ExtUtils::MM_Any; require ExtUtils::MM_Unix; our @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); -our $VERSION = '6.46'; +our $VERSION = '6.47_01'; =item os_flavor diff --git a/lib/ExtUtils/MM_Cygwin.pm b/lib/ExtUtils/MM_Cygwin.pm index 2a110c215d..9f5e753e8f 100644 --- a/lib/ExtUtils/MM_Cygwin.pm +++ b/lib/ExtUtils/MM_Cygwin.pm @@ -9,7 +9,7 @@ require ExtUtils::MM_Any; require ExtUtils::MM_Unix; our @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); -our $VERSION = '6.46'; +our $VERSION = '6.47_01'; =head1 NAME diff --git a/lib/ExtUtils/MM_DOS.pm b/lib/ExtUtils/MM_DOS.pm index f9f38291eb..f032b567a2 100644 --- a/lib/ExtUtils/MM_DOS.pm +++ b/lib/ExtUtils/MM_DOS.pm @@ -2,7 +2,7 @@ package ExtUtils::MM_DOS; use strict; -our $VERSION = 6.46; +our $VERSION = 6.47_01; require ExtUtils::MM_Any; require ExtUtils::MM_Unix; diff --git a/lib/ExtUtils/MM_MacOS.pm b/lib/ExtUtils/MM_MacOS.pm index 3102e19efb..737359c842 100644 --- a/lib/ExtUtils/MM_MacOS.pm +++ b/lib/ExtUtils/MM_MacOS.pm @@ -2,7 +2,7 @@ package ExtUtils::MM_MacOS; use strict; -our $VERSION = 6.46; +our $VERSION = 6.47_01; sub new { die <<'UNSUPPORTED'; diff --git a/lib/ExtUtils/MM_NW5.pm b/lib/ExtUtils/MM_NW5.pm index 4e18871a7c..cfe9eb0e1d 100644 --- a/lib/ExtUtils/MM_NW5.pm +++ b/lib/ExtUtils/MM_NW5.pm @@ -22,7 +22,7 @@ use strict; use ExtUtils::MakeMaker::Config; use File::Basename; -our $VERSION = '6.46'; +our $VERSION = '6.47_01'; require ExtUtils::MM_Win32; our @ISA = qw(ExtUtils::MM_Win32); diff --git a/lib/ExtUtils/MM_OS2.pm b/lib/ExtUtils/MM_OS2.pm index 7eafc55759..922260e2a2 100644 --- a/lib/ExtUtils/MM_OS2.pm +++ b/lib/ExtUtils/MM_OS2.pm @@ -5,7 +5,7 @@ use strict; use ExtUtils::MakeMaker qw(neatvalue); use File::Spec; -our $VERSION = '6.46'; +our $VERSION = '6.47_01'; require ExtUtils::MM_Any; require ExtUtils::MM_Unix; diff --git a/lib/ExtUtils/MM_QNX.pm b/lib/ExtUtils/MM_QNX.pm index 04730c5a1b..e60ea4d7c9 100644 --- a/lib/ExtUtils/MM_QNX.pm +++ b/lib/ExtUtils/MM_QNX.pm @@ -1,7 +1,7 @@ package ExtUtils::MM_QNX; use strict; -our $VERSION = '6.46'; +our $VERSION = '6.47_01'; require ExtUtils::MM_Unix; our @ISA = qw(ExtUtils::MM_Unix); diff --git a/lib/ExtUtils/MM_UWIN.pm b/lib/ExtUtils/MM_UWIN.pm index bcd91ee915..e227ff1993 100644 --- a/lib/ExtUtils/MM_UWIN.pm +++ b/lib/ExtUtils/MM_UWIN.pm @@ -1,7 +1,7 @@ package ExtUtils::MM_UWIN; use strict; -our $VERSION = 6.46; +our $VERSION = 6.47_01; require ExtUtils::MM_Unix; our @ISA = qw(ExtUtils::MM_Unix); diff --git a/lib/ExtUtils/MM_Unix.pm b/lib/ExtUtils/MM_Unix.pm index e79d67dddb..8c619c524e 100644 --- a/lib/ExtUtils/MM_Unix.pm +++ b/lib/ExtUtils/MM_Unix.pm @@ -15,7 +15,7 @@ use ExtUtils::MakeMaker qw($Verbose neatvalue); # If we make $VERSION an our variable parse_version() breaks use vars qw($VERSION); -$VERSION = '6.46_01'; +$VERSION = '6.47_01'; require ExtUtils::MM_Any; our @ISA = qw(ExtUtils::MM_Any); @@ -1976,12 +1976,14 @@ sub init_PERL { } else { $self->{ABSPERL} = $self->rel2abs($self->{ABSPERL}); + + # Quote the perl command if it contains whitespace + $self->{ABSPERL} = $self->quote_literal($self->{ABSPERL}) + if $self->{ABSPERL} =~ /\s/; + $self->{ABSPERL} = 'MCR '.$self->{ABSPERL} if $has_mcr; } - $self->{ABSPERL} = qq{"$self->{ABSPERL}"} - if ($self->{ABSPERL} =~ /\s/) && ! $has_mcr; - # Are we building the core? $self->{PERL_CORE} = $ENV{PERL_CORE} unless exists $self->{PERL_CORE}; $self->{PERL_CORE} = 0 unless defined $self->{PERL_CORE}; @@ -2945,6 +2947,14 @@ sub postamble { ""; } +# transform dot-separated version string into comma-separated quadruple +# examples: '1.2.3.4.5' => '1,2,3,4' +# '1.2.3' => '1,2,3,0' +sub _ppd_version { + my ($self, $string) = @_; + return join ',', ((split /\./, $string), (0) x 4)[0..3]; +} + =item ppd Defines target that creates a PPD (Perl Package Description) file @@ -2955,7 +2965,7 @@ for a binary distribution. sub ppd { my($self) = @_; - my ($pack_ver) = join ",", (split (/\./, $self->{VERSION}), (0)x4)[0..3]; + my $pack_ver = $self->_ppd_version($self->{VERSION}); my $abstract = $self->{ABSTRACT} || ''; $abstract =~ s/\n/\\n/sg; @@ -2974,11 +2984,17 @@ sub ppd { PPD_HTML $ppd_xml .= " <IMPLEMENTATION>\n"; + if ( $self->{MIN_PERL_VERSION} ) { + my $min_perl_version = $self->_ppd_version($self->{MIN_PERL_VERSION}); + $ppd_xml .= sprintf <<'PPD_PERLVERS', $min_perl_version; + <PERLCORE VERSION="%s" /> +PPD_PERLVERS + + } foreach my $prereq (sort keys %{$self->{PREREQ_PM}}) { my $pre_req = $prereq; $pre_req =~ s/::/-/g; - my ($dep_ver) = join ",", (split (/\./, $self->{PREREQ_PM}{$prereq}), - (0) x 4) [0 .. 3]; + my $dep_ver = $self->_ppd_version($self->{PREREQ_PM}{$prereq}); $ppd_xml .= sprintf <<'PPD_OUT', $pre_req, $dep_ver; <DEPENDENCY NAME="%s" VERSION="%s" /> PPD_OUT diff --git a/lib/ExtUtils/MM_VMS.pm b/lib/ExtUtils/MM_VMS.pm index 9e8d75653f..93112525e1 100644 --- a/lib/ExtUtils/MM_VMS.pm +++ b/lib/ExtUtils/MM_VMS.pm @@ -15,7 +15,7 @@ BEGIN { use File::Basename; -our $VERSION = '6.46'; +our $VERSION = '6.47_01'; require ExtUtils::MM_Any; require ExtUtils::MM_Unix; diff --git a/lib/ExtUtils/MM_VOS.pm b/lib/ExtUtils/MM_VOS.pm index 87bb8eafe9..59460dd205 100644 --- a/lib/ExtUtils/MM_VOS.pm +++ b/lib/ExtUtils/MM_VOS.pm @@ -1,7 +1,7 @@ package ExtUtils::MM_VOS; use strict; -our $VERSION = '6.46'; +our $VERSION = '6.47_01'; require ExtUtils::MM_Unix; our @ISA = qw(ExtUtils::MM_Unix); diff --git a/lib/ExtUtils/MM_Win32.pm b/lib/ExtUtils/MM_Win32.pm index c2160ca7f4..6f034b1964 100644 --- a/lib/ExtUtils/MM_Win32.pm +++ b/lib/ExtUtils/MM_Win32.pm @@ -27,7 +27,7 @@ use ExtUtils::MakeMaker qw( neatvalue ); require ExtUtils::MM_Any; require ExtUtils::MM_Unix; our @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); -our $VERSION = '6.46'; +our $VERSION = '6.47_01'; $ENV{EMXSHELL} = 'sh'; # to run `commands` @@ -126,8 +126,6 @@ Using \ for Windows. sub init_DIRFILESEP { my($self) = shift; - my $make = $self->make; - # The ^ makes sure its not interpreted as an escape in nmake $self->{DIRFILESEP} = $self->is_make_type('nmake') ? '^\\' : $self->is_make_type('dmake') ? '\\\\' diff --git a/lib/ExtUtils/MM_Win95.pm b/lib/ExtUtils/MM_Win95.pm index f97a0c81fd..81fff73fa8 100644 --- a/lib/ExtUtils/MM_Win95.pm +++ b/lib/ExtUtils/MM_Win95.pm @@ -2,7 +2,7 @@ package ExtUtils::MM_Win95; use strict; -our $VERSION = '6.46'; +our $VERSION = '6.47_01'; require ExtUtils::MM_Win32; our @ISA = qw(ExtUtils::MM_Win32); diff --git a/lib/ExtUtils/MY.pm b/lib/ExtUtils/MY.pm index faf68a62f3..ea407be22f 100644 --- a/lib/ExtUtils/MY.pm +++ b/lib/ExtUtils/MY.pm @@ -3,7 +3,7 @@ package ExtUtils::MY; use strict; require ExtUtils::MM; -our $VERSION = 6.46; +our $VERSION = 6.47_01; our @ISA = qw(ExtUtils::MM); { diff --git a/lib/ExtUtils/MakeMaker.pm b/lib/ExtUtils/MakeMaker.pm index 261808cb59..8e2d1c52c9 100644 --- a/lib/ExtUtils/MakeMaker.pm +++ b/lib/ExtUtils/MakeMaker.pm @@ -1,4 +1,4 @@ -# $Id: /local/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm 66493 2008-09-27T21:35:25.560547Z schwern $ +# $Id$ package ExtUtils::MakeMaker; use strict; @@ -18,8 +18,12 @@ our @Overridable; my @Prepend_parent; my %Recognized_Att_Keys; -our $VERSION = '6.46'; -our ($Revision) = q$Revision: 66493 $ =~ /Revision:\s+(\S+)/; +our $VERSION = '6.47_01'; + +# Emulate something resembling CVS $Revision$ +(our $Revision = $VERSION) =~ s{_}{}; +$Revision = int $Revision * 10000; + our $Filename = __FILE__; # referenced outside MakeMaker our @ISA = qw(Exporter); @@ -236,7 +240,7 @@ sub full_setup { INC INCLUDE_EXT LDFROM LIB LIBPERL_A LIBS LICENSE LINKTYPE MAKE MAKEAPERL MAKEFILE MAKEFILE_OLD MAN1PODS MAN3PODS MAP_TARGET - META_ADD META_MERGE + META_ADD META_MERGE MIN_PERL_VERSION MYEXTLIB NAME NEEDS_LINKING NOECHO NO_META NORECURS NO_VC OBJECT OPTIMIZE PERL_MALLOC_OK PERL PERLMAINCC PERLRUN PERLRUNINST PERL_CORE PERL_SRC PERM_RW PERM_RWX @@ -372,14 +376,22 @@ sub new { if ("@ARGV" =~ /\bPREREQ_PRINT\b/) { require Data::Dumper; - print Data::Dumper->Dump([$self->{PREREQ_PM}], [qw(PREREQ_PM)]); + my @what = ('PREREQ_PM'); + push @what, 'MIN_PERL_VERSION' if $self->{MIN_PERL_VERSION}; + print Data::Dumper->Dump([@{$self}{@what}], \@what); exit 0; } # PRINT_PREREQ is RedHatism. if ("@ARGV" =~ /\bPRINT_PREREQ\b/) { - print join(" ", map { "perl($_)>=$self->{PREREQ_PM}->{$_} " } - sort keys %{$self->{PREREQ_PM}}), "\n"; + my @prereq = + map { [$_, $self->{PREREQ_PM}{$_}] } keys %{$self->{PREREQ_PM}}; + if ( $self->{MIN_PERL_VERSION} ) { + push @prereq, ['perl' => $self->{MIN_PERL_VERSION}]; + } + + print join(" ", map { "perl($_->[0])>=$_->[1] " } + sort { $a->[0] cmp $b->[0] } @prereq), "\n"; exit 0; } @@ -392,6 +404,39 @@ sub new { check_hints($self); + # Translate X.Y.Z to X.00Y00Z + if( defined $self->{MIN_PERL_VERSION} ) { + $self->{MIN_PERL_VERSION} =~ s{ ^ (\d+) \. (\d+) \. (\d+) $ } + {sprintf "%d.%03d%03d", $1, $2, $3}ex; + } + + my $perl_version_ok = eval { + local $SIG{__WARN__} = sub { + # simulate "use warnings FATAL => 'all'" for vintage perls + die @_; + }; + !$self->{MIN_PERL_VERSION} or $self->{MIN_PERL_VERSION} <= $] + }; + if (!$perl_version_ok) { + if (!defined $perl_version_ok) { + warn <<'END'; +Warning: MIN_PERL_VERSION is not in a recognized format. +Recommended is a quoted numerical value like '5.005' or '5.008001'. +END + } + elsif ($self->{PREREQ_FATAL}) { + die sprintf <<"END", $self->{MIN_PERL_VERSION}, $]; +MakeMaker FATAL: perl version too low for this distribution. +Required is %s. We run %s. +END + } + else { + warn sprintf + "Warning: Perl version %s or higher required. We run %s.\n", + $self->{MIN_PERL_VERSION}, $]; + } + } + my %configure_att; # record &{$self->{CONFIGURE}} attributes my(%initial_att) = %$self; # record initial attributes @@ -1823,6 +1868,12 @@ own. META_MERGE will merge its value with the default. Unless you want to override the defaults, prefer META_MERGE so as to get the advantage of any future defaults. +=item MIN_PERL_VERSION + +The minimum required version of Perl for this distribution. + +Either 5.006001 or 5.6.1 format is acceptable. + =item MYEXTLIB If the extension links to a library that it builds set this to the @@ -2120,11 +2171,16 @@ Bool. If this parameter is true, the prerequisites will be printed to stdout and MakeMaker will exit. The output format is an evalable hash ref. -$PREREQ_PM = { - 'A::B' => Vers1, - 'C::D' => Vers2, - ... - }; + $PREREQ_PM = { + 'A::B' => Vers1, + 'C::D' => Vers2, + ... + }; + +If a distribution defines a minimal required perl version, this is +added to the output as an additional line of the form: + + $MIN_PERL_VERSION = '5.008001'; =item PRINT_PREREQ @@ -2132,6 +2188,10 @@ RedHatism for C<PREREQ_PRINT>. The output format is different, though: perl(A::B)>=Vers1 perl(C::D)>=Vers2 ... +A minimal required perl version, if present, will look like this: + + perl(perl)>=5.008001 + =item SITEPREFIX Like PERLPREFIX, but only for the site install locations. @@ -2202,7 +2262,7 @@ MakeMaker object. The following lines will be parsed o.k.: $VERSION = '1.00'; *VERSION = \'1.01'; - ($VERSION) = q$Revision: 66493 $ =~ /(\d+)/g; + ($VERSION) = q$Revision$ =~ /(\d+)/g; $FOO::VERSION = '1.10'; *FOO::VERSION = \'1.11'; diff --git a/lib/ExtUtils/MakeMaker/Config.pm b/lib/ExtUtils/MakeMaker/Config.pm index 7744210884..1fe9e56bf3 100644 --- a/lib/ExtUtils/MakeMaker/Config.pm +++ b/lib/ExtUtils/MakeMaker/Config.pm @@ -2,7 +2,7 @@ package ExtUtils::MakeMaker::Config; use strict; -our $VERSION = '6.46'; +our $VERSION = '6.47_01'; use Config (); diff --git a/lib/ExtUtils/MakeMaker/bytes.pm b/lib/ExtUtils/MakeMaker/bytes.pm index 4ac989ce2a..43c235faf0 100644 --- a/lib/ExtUtils/MakeMaker/bytes.pm +++ b/lib/ExtUtils/MakeMaker/bytes.pm @@ -2,7 +2,7 @@ package ExtUtils::MakeMaker::bytes; use strict; -our $VERSION = 6.46; +our $VERSION = 6.47_01; my $Have_Bytes = eval { require bytes; 1; }; diff --git a/lib/ExtUtils/MakeMaker/vmsish.pm b/lib/ExtUtils/MakeMaker/vmsish.pm index 1765e8bdd7..10c2200e77 100644 --- a/lib/ExtUtils/MakeMaker/vmsish.pm +++ b/lib/ExtUtils/MakeMaker/vmsish.pm @@ -2,7 +2,7 @@ package ExtUtils::MakeMaker::vmsish; use strict; -our $VERSION = 6.46; +our $VERSION = 6.47_01; my $IsVMS = $^O eq 'VMS'; diff --git a/lib/ExtUtils/Mkbootstrap.pm b/lib/ExtUtils/Mkbootstrap.pm index 462ae2c179..66fc61789f 100644 --- a/lib/ExtUtils/Mkbootstrap.pm +++ b/lib/ExtUtils/Mkbootstrap.pm @@ -3,7 +3,7 @@ package ExtUtils::Mkbootstrap; # There's just too much Dynaloader incest here to turn on strict vars. use strict 'refs'; -our $VERSION = '6.46'; +our $VERSION = '6.47_01'; require Exporter; our @ISA = ('Exporter'); diff --git a/lib/ExtUtils/Mksymlists.pm b/lib/ExtUtils/Mksymlists.pm index 4114f4bb12..b749da23d6 100644 --- a/lib/ExtUtils/Mksymlists.pm +++ b/lib/ExtUtils/Mksymlists.pm @@ -10,7 +10,7 @@ use Config; our @ISA = qw(Exporter); our @EXPORT = qw(&Mksymlists); -our $VERSION = '6.46'; +our $VERSION = '6.47_01'; sub Mksymlists { my(%spec) = @_; diff --git a/lib/ExtUtils/t/MM_Unix.t b/lib/ExtUtils/t/MM_Unix.t index 476bf2483d..c3a22ec80b 100644 --- a/lib/ExtUtils/t/MM_Unix.t +++ b/lib/ExtUtils/t/MM_Unix.t @@ -171,12 +171,13 @@ is ($t->libscan('Fatty'), 'Fatty', 'libscan on something not a VC file' ); open(FILE, ">command"); print FILE "foo"; close FILE; SKIP: { -skip ("no separate execute mode", 1) if ($^O eq "vos"); -ok (!$t->maybe_command('command') ,"non executable file isn't a command"); -} + skip("no separate execute mode on VOS", 2) if $^O eq "vos"; + + ok !$t->maybe_command('command') ,"non executable file isn't a command"; -chmod 0755, "command"; -ok ($t->maybe_command('command'), "executable file is a command"); + chmod 0755, "command"; + ok ($t->maybe_command('command'), "executable file is a command"); +} unlink "command"; diff --git a/lib/ExtUtils/t/cd.t b/lib/ExtUtils/t/cd.t index 9d62d139e7..dfd3ce44e4 100644 --- a/lib/ExtUtils/t/cd.t +++ b/lib/ExtUtils/t/cd.t @@ -17,7 +17,8 @@ use File::Spec; use Test::More tests => 4; -my @cd_args = ("some/dir", "command1", "command2"); +my $dir = File::Spec->catdir("some", "dir"); +my @cd_args = ($dir, "command1", "command2"); { package Test::MM_Win32; @@ -33,7 +34,7 @@ my @cd_args = ("some/dir", "command1", "command2"); my $expected_updir = File::Spec->catdir(@dirs); ::is $mm->cd(@cd_args), -qq{cd some/dir +qq{cd $dir command1 command2 cd $expected_updir}; @@ -43,15 +44,15 @@ qq{cd some/dir local *make = sub { "dmake" }; ::is $mm->cd(@cd_args), -q{cd some/dir && command1 - cd some/dir && command2}; +qq{cd $dir && command1 + cd $dir && command2}; } } { is +ExtUtils::MM_Unix->cd(@cd_args), -q{cd some/dir && command1 - cd some/dir && command2}; +qq{cd $dir && command1 + cd $dir && command2}; } SKIP: { diff --git a/lib/ExtUtils/t/metafile_data.t b/lib/ExtUtils/t/metafile_data.t index 597e448cf1..9d635600bb 100644 --- a/lib/ExtUtils/t/metafile_data.t +++ b/lib/ExtUtils/t/metafile_data.t @@ -9,7 +9,7 @@ BEGIN { } use strict; -use Test::More tests => 3; +use Test::More tests => 5; use Data::Dumper; @@ -133,3 +133,87 @@ my $new_mm = sub { wobble => 42, ]; } + + +# Test MIN_PERL_VERSION +{ + my $mm = $new_mm->( + DISTNAME => 'Foo-Bar', + VERSION => 1.23, + PM => { + "Foo::Bar" => 'lib/Foo/Bar.pm', + }, + MIN_PERL_VERSION => 5.006, + ); + + is_deeply [$mm->metafile_data], [ + name => 'Foo-Bar', + version => 1.23, + abstract => undef, + author => [], + license => 'unknown', + distribution_type => 'module', + + configure_requires => { + 'ExtUtils::MakeMaker' => 0, + }, + + requires => { + perl => '5.006', + }, + + no_index => { + directory => [qw(t inc)], + }, + + generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION", + 'meta-spec' => { + url => 'http://module-build.sourceforge.net/META-spec-v1.4.html', + version => 1.4 + }, + ]; +} + + +# Test MIN_PERL_VERSION +{ + my $mm = $new_mm->( + DISTNAME => 'Foo-Bar', + VERSION => 1.23, + PM => { + "Foo::Bar" => 'lib/Foo/Bar.pm', + }, + MIN_PERL_VERSION => 5.006, + PREREQ_PM => { + 'Foo::Bar' => 1.23, + }, + ); + + is_deeply [$mm->metafile_data], [ + name => 'Foo-Bar', + version => 1.23, + abstract => undef, + author => [], + license => 'unknown', + distribution_type => 'module', + + configure_requires => { + 'ExtUtils::MakeMaker' => 0, + }, + + requires => { + perl => '5.006', + 'Foo::Bar' => 1.23, + }, + + no_index => { + directory => [qw(t inc)], + }, + + generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION", + 'meta-spec' => { + url => 'http://module-build.sourceforge.net/META-spec-v1.4.html', + version => 1.4 + }, + ]; +} diff --git a/lib/ExtUtils/t/metafile_file.t b/lib/ExtUtils/t/metafile_file.t index 6a67882933..842a249717 100644 --- a/lib/ExtUtils/t/metafile_file.t +++ b/lib/ExtUtils/t/metafile_file.t @@ -14,7 +14,7 @@ BEGIN { } use strict; -use Test::More tests => 13; +use Test::More tests => 16; require ExtUtils::MM_Any; @@ -260,8 +260,29 @@ meta-spec: YAML is($mm->metafile_file(@meta), $expected, "META.yml with extra 'no_index' works"); + + + # Make sure YAML.pm can ready our output + SKIP: { + skip "Need YAML.pm to test if it can load META.yml", 1 + unless eval { require YAML }; + + my $yaml_load = YAML::Load($mm->metafile_file(@meta)); + is_deeply( $yaml_load, {@meta}, "META.yml can be read by YAML.pm" ); + } + + + SKIP: { + skip "Need YAML::Tiny to test if it can load META.yml", 2 + unless eval { require YAML::Tiny }; + + my @yaml_load = YAML::Tiny::Load($mm->metafile_file(@meta)); + is @yaml_load, 1, "YAML::Tiny saw one document in META.yml"; + is_deeply( $yaml_load[0], {@meta}, "META.yml can be read by YAML::Tiny" ); + } } + { my @meta = ( k => 'a : b', 'x : y' => 1 ); my $expected = <<YAML; diff --git a/lib/ExtUtils/t/min_perl_version.t b/lib/ExtUtils/t/min_perl_version.t new file mode 100644 index 0000000000..f488fa5f9f --- /dev/null +++ b/lib/ExtUtils/t/min_perl_version.t @@ -0,0 +1,199 @@ +#!/usr/bin/perl -w + +# This is a test checking various aspects of the optional argument +# MIN_PERL_VERSION to WriteMakefile. + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = ('../lib', 'lib'); + } + else { + unshift @INC, 't/lib'; + } +} + +use strict; +use Test::More tests => 33; + +use TieOut; +use MakeMaker::Test::Utils; +use MakeMaker::Test::Setup::MPV; +use File::Path; + +use ExtUtils::MakeMaker; + +# avoid environment variables interfering with our make runs +delete @ENV{qw(LIB MAKEFLAGS)}; + +my $perl = which_perl(); +my $make = make_run(); +my $makefile = makefile_name(); + +chdir 't'; + +perl_lib(); + +ok( setup_recurs(), 'setup' ); +END { + ok( chdir(File::Spec->updir), 'leaving dir' ); + ok( teardown_recurs(), 'teardown' ); +} + +ok( chdir 'Min-PerlVers', 'entering dir Min-PerlVers' ) || + diag("chdir failed: $!"); + +{ + # ----- argument verification ----- + + my $stdout = tie *STDOUT, 'TieOut'; + ok( $stdout, 'capturing stdout' ); + my $warnings = ''; + local $SIG{__WARN__} = sub { + $warnings .= join '', @_; + }; + + eval { + WriteMakefile( + NAME => 'Min::PerlVers', + MIN_PERL_VERSION => '5', + ); + }; + is( $warnings, '', 'MIN_PERL_VERSION=5 does not trigger a warning' ); + is( $@, '', ' nor a hard failure' ); + + + $warnings = ''; + eval { + WriteMakefile( + NAME => 'Min::PerlVers', + MIN_PERL_VERSION => '5.4.4', + ); + }; + is( $warnings, '', 'MIN_PERL_VERSION=X.Y.Z does not trigger a warning' ); + is( $@, '', ' nor a hard failure' ); + + + $warnings = ''; + eval { + WriteMakefile( + NAME => 'Min::PerlVers', + MIN_PERL_VERSION => '999999', + ); + }; + ok( '' ne $warnings, 'MIN_PERL_VERSION=999999 triggers a warning' ); + is( $warnings, + "Warning: Perl version 999999 or higher required. We run $].\n", + ' with expected message text' ); + is( $@, '', ' and without a hard failure' ); + + $warnings = ''; + eval { + WriteMakefile( + NAME => 'Min::PerlVers', + MIN_PERL_VERSION => '999999', + PREREQ_FATAL => 1, + ); + }; + is( $warnings, '', 'MIN_PERL_VERSION=999999 and PREREQ_FATAL: no warning' ); + is( $@, <<"END", ' correct exception' ); +MakeMaker FATAL: perl version too low for this distribution. +Required is 999999. We run $]. +END + + $warnings = ''; + eval { + WriteMakefile( + NAME => 'Min::PerlVers', + MIN_PERL_VERSION => 'foobar', + ); + }; + ok( '' ne $warnings, 'MIN_PERL_VERSION=foobar triggers a warning' ); + is( $warnings, <<'END', ' with expected message text' ); +Warning: MIN_PERL_VERSION is not in a recognized format. +Recommended is a quoted numerical value like '5.005' or '5.008001'. +END + + is( $@, '', ' and without a hard failure' ); +} + + +# ----- PREREQ_PRINT output ----- +{ + my $prereq_out = run(qq{$perl Makefile.PL "PREREQ_PRINT=1"}); + is( $?, 0, 'PREREQ_PRINT exiting normally' ); + my $prereq_out_sane = $prereq_out =~ /^\s*\$PREREQ_PM\s*=/; + ok( $prereq_out_sane, ' and talking like we expect' ) || + diag($prereq_out); + + SKIP: { + skip 'not going to evaluate rubbish', 3 if !$prereq_out_sane; + + package _Prereq::Print::WithMPV; ## no critic + use vars qw($PREREQ_PM $MIN_PERL_VERSION $ERR); + $ERR = ''; + eval { + eval $prereq_out; ## no critic + $ERR = $@; + }; + ::is( $@ . $ERR, '', 'prereqs evaluable' ); + ::is_deeply( $PREREQ_PM, { strict => 0 }, ' and looking correct' ); + ::is( $MIN_PERL_VERSION, '5.005', 'min version also correct' ); + } +} + + +# ----- PRINT_PREREQ output ----- +{ + my $prereq_out = run(qq{$perl Makefile.PL "PRINT_PREREQ=1"}); + is( $?, 0, 'PRINT_PREREQ exiting normally' ); + ok( $prereq_out !~ /^warning/i, ' and not complaining loudly' ); + like( $prereq_out, + qr/^perl\(perl\) \s* >= 5\.005 \s+ perl\(strict\) \s* >= \s* 0 \s*$/x, + 'dump has prereqs and perl version' ); +} + + +# ----- generated files verification ----- +{ + unlink $makefile; + my @mpl_out = run(qq{$perl Makefile.PL}); + END { unlink $makefile, makefile_backup() } + + cmp_ok( $?, '==', 0, 'Makefile.PL exiting normally' ) || diag(@mpl_out); + ok( -e $makefile, 'Makefile present' ); +} + + +# ----- ppd output ----- +{ + my $ppd_file = 'Min-PerlVers.ppd'; + my @make_out = run(qq{$make ppd}); + END { unlink $ppd_file } + + cmp_ok( $?, '==', 0, 'Make ppd exiting normally' ) || diag(@make_out); + + my $ppd_html = slurp($ppd_file); + ok( defined($ppd_html), ' .ppd file present' ); + + like( $ppd_html, qr{^\s*<PERLCORE VERSION="5,005,0,0" />}m, + ' .ppd file content good' ); +} + + +# ----- META.yml output ----- +{ + my $distdir = 'Min-PerlVers-0.05'; + my $meta_yml = "$distdir/META.yml"; + my @make_out = run(qq{$make metafile}); + END { rmtree $distdir } + + cmp_ok( $?, '==', 0, 'Make metafile exiting normally' ) || diag(@make_out); + my $meta = slurp($meta_yml); + ok( defined($meta), ' META.yml present' ); + + like( $meta, qr{\nrequires:[^\S\n]*\n\s+perl:\s+5\.005\n\s+strict:\s+0\n}, + ' META.yml content good'); +} + +__END__ diff --git a/lib/ExtUtils/testlib.pm b/lib/ExtUtils/testlib.pm index 0325570f00..6a2d43746f 100644 --- a/lib/ExtUtils/testlib.pm +++ b/lib/ExtUtils/testlib.pm @@ -3,7 +3,7 @@ package ExtUtils::testlib; use strict; use warnings; -our $VERSION = 6.46; +our $VERSION = 6.47_01; use Cwd; use File::Spec; |