From: Nicholas Clark Date: Wed, 15 Oct 2008 11:27:28 +0000 (+0000) Subject: Upgrade to ExtUtils-MakeMaker-6.47_01 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bf87a6a1535bf7af2029f8dd0c3728bfa1e325c6;p=p5sagit%2Fp5-mst-13.2.git Upgrade to ExtUtils-MakeMaker-6.47_01 p4raw-id: //depot/perl@34482 --- diff --git a/MANIFEST b/MANIFEST index 63592e2..f7482b5 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2029,6 +2029,7 @@ lib/ExtUtils/t/make.t See if make detection works lib/ExtUtils/t/maketext_filter.t See if maketext_filter works lib/ExtUtils/t/metafile_data.t See if META.yml handling works lib/ExtUtils/t/metafile_file.t See if META.yml handling works +lib/ExtUtils/t/min_perl_version.t Test the MIN_PERL_VERSION argument to WriteMakefile. lib/ExtUtils/t/Manifest.t See if ExtUtils::Manifest works lib/ExtUtils/t/Mkbootstrap.t See if ExtUtils::Mkbootstrap works lib/ExtUtils/t/MM_Any.t See if ExtUtils::MM_Any works @@ -3736,6 +3737,7 @@ t/lib/HasSigDie.pm Module for testing base.pm t/lib/locale/latin1 Part of locale.t in Latin 1 t/lib/locale/utf8 Part of locale.t in UTF8 t/lib/MakeMaker/Test/Setup/BFD.pm MakeMaker test utilities +t/lib/MakeMaker/Test/Setup/MPV.pm MakeMaker test utilities t/lib/MakeMaker/Test/Setup/PL_FILES.pm MakeMaker test utilities t/lib/MakeMaker/Test/Setup/Problem.pm MakeMaker test utilities t/lib/MakeMaker/Test/Setup/Recurs.pm MakeMaker test utilities diff --git a/lib/ExtUtils/Command/MM.pm b/lib/ExtUtils/Command/MM.pm index 52dab27..a9e7e14 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 e01802e..87b8d7d 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 bddcf76..5c16dbc 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 db791d4..d81d19c 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 f625d6b..6d7d632 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 449db51..f2519d6 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 807658b..52dd0f8 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 2a110c2..9f5e753 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 f9f3829..f032b56 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 3102e19..737359c 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 4e18871..cfe9eb0 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 7eafc55..922260e 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 04730c5..e60ea4d 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 bcd91ee..e227ff1 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 e79d67d..8c619c5 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 .= " \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; + +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; PPD_OUT diff --git a/lib/ExtUtils/MM_VMS.pm b/lib/ExtUtils/MM_VMS.pm index 9e8d756..9311252 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 87bb8ea..59460dd 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 c2160ca..6f034b1 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 f97a0c8..81fff73 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 faf68a6..ea407be 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 261808c..8e2d1c5 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. 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 7744210..1fe9e56 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 4ac989c..43c235f 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 1765e8b..10c2200 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 462ae2c..66fc617 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 4114f4b..b749da2 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 476bf24..c3a22ec 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 9d62d13..dfd3ce4 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 597e448..9d63560 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 6a67882..842a249 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 = < 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*}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 0325570..6a2d437 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; diff --git a/t/lib/MakeMaker/Test/Setup/MPV.pm b/t/lib/MakeMaker/Test/Setup/MPV.pm new file mode 100644 index 0000000..f30d65f --- /dev/null +++ b/t/lib/MakeMaker/Test/Setup/MPV.pm @@ -0,0 +1,67 @@ +package MakeMaker::Test::Setup::MPV; + +@ISA = qw(Exporter); +require Exporter; +@EXPORT = qw(setup_recurs teardown_recurs); + +use strict; +use File::Path; +use File::Basename; + +my %Files = ( + 'Min-PerlVers/Makefile.PL' => <<'END', +use ExtUtils::MakeMaker; + +WriteMakefile( + NAME => 'Min::PerlVers', + AUTHOR => 'John Doe ', + VERSION_FROM => 'lib/Min/PerlVers.pm', + PREREQ_PM => { strict => 0 }, + MIN_PERL_VERSION => '5.005', +); +END + + 'Min-PerlVers/lib/Min/PerlVers.pm' => <<'END', +package Min::PerlVers; + +$VERSION = 0.05; + +=head1 NAME + +Min::PerlVers - being picky about perl versions + +=cut + +1; +END + +); + + +sub setup_recurs { + while(my($file, $text) = each %Files) { + # Convert to a relative, native file path. + $file = File::Spec->catfile(File::Spec->curdir, split m{\/}, $file); + + my $dir = dirname($file); + mkpath $dir; + open(FILE, ">$file") || die "Can't create $file: $!"; + print FILE $text; + close FILE; + } + + return 1; +} + +sub teardown_recurs { + foreach my $file (keys %Files) { + my $dir = dirname($file); + if( -e $dir ) { + rmtree($dir) || return; + } + } + return 1; +} + + +1; diff --git a/t/lib/MakeMaker/Test/Utils.pm b/t/lib/MakeMaker/Test/Utils.pm index fb8162d..8c9fc7b 100644 --- a/t/lib/MakeMaker/Test/Utils.pm +++ b/t/lib/MakeMaker/Test/Utils.pm @@ -9,12 +9,12 @@ use vars qw($VERSION @ISA @EXPORT); require Exporter; @ISA = qw(Exporter); -$VERSION = 0.03; +$VERSION = 0.04; @EXPORT = qw(which_perl perl_lib makefile_name makefile_backup make make_run run make_macro calibrate_mtime setup_mm_test_root - have_compiler + have_compiler slurp ); my $Is_VMS = $^O eq 'VMS'; @@ -45,6 +45,8 @@ MakeMaker::Test::Utils - Utility routines for testing MakeMaker my $have_compiler = have_compiler(); + my $text = slurp($filename); + =head1 DESCRIPTION @@ -321,6 +323,27 @@ sub have_compiler { return $have_compiler; } +=item slurp + + $text = slurp($filename); + +Returns the contents of a file if it can be read, otherwise undef. +Contents of excessively large files are truncated to a couple of +kilobytes, though. + +=cut + +sub slurp { + my $filename = shift; + my $text = undef; + local *FH; + local $/ = \8192; + if (open FH, $filename) { + $text = ; + close FH; + } + return $text; +} =back