From 277189c8ad3fc0d1dcd4c757f62b0a7bf5bacaa0 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Mon, 2 Jul 2007 15:39:52 +0000 Subject: [PATCH] Upgrade to ExtUtils-MakeMaker-6.35 p4raw-id: //depot/perl@31519 --- MANIFEST | 4 + lib/ExtUtils/Liblist/Kid.pm | 7 +- lib/ExtUtils/MM_Unix.pm | 229 +++++++++++++++++++---------------- lib/ExtUtils/MM_VMS.pm | 5 +- lib/ExtUtils/MM_Win32.pm | 18 +-- lib/ExtUtils/MakeMaker/FAQ.pod | 18 ++- lib/ExtUtils/t/WriteEmptyMakefile.t | 40 ++++++ lib/ExtUtils/t/basic.t | 7 +- lib/ExtUtils/t/cd.t | 67 ++++++++++ lib/ExtUtils/t/fixin.t | 45 +++++++ lib/ExtUtils/t/parse_version.t | 23 +++- lib/ExtUtils/t/prereq.t | 109 +++++++++++++++++ lib/ExtUtils/t/recurs.t | 11 +- lib/ExtUtils/t/writemakefile_args.t | 81 ++++++++++++- t/lib/MakeMaker/Test/Setup/Recurs.pm | 8 ++ t/lib/MakeMaker/Test/Utils.pm | 4 +- 16 files changed, 542 insertions(+), 134 deletions(-) create mode 100644 lib/ExtUtils/t/WriteEmptyMakefile.t create mode 100644 lib/ExtUtils/t/cd.t create mode 100644 lib/ExtUtils/t/fixin.t create mode 100644 lib/ExtUtils/t/prereq.t diff --git a/MANIFEST b/MANIFEST index 09c40dd..330ab54 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1782,6 +1782,7 @@ lib/ExtUtils/t/backwards.t Check MakeMaker's backwards compatibility lib/ExtUtils/t/basic.t See if MakeMaker can build a module lib/ExtUtils/t/build_man.t Set if MakeMaker builds manpages lib/ExtUtils/t/bytes.t Test ExtUtils::MakeMaker::bytes +lib/ExtUtils/t/cd.t Test to see cd works lib/ExtUtils/t/config.t Test ExtUtils::MakeMaker::Config lib/ExtUtils/t/Constant.t See if ExtUtils::Constant works lib/ExtUtils/t/dir_target.t Verify if dir_target() is supported @@ -1789,6 +1790,7 @@ lib/ExtUtils/t/Embed.t See if ExtUtils::Embed and embedding works lib/ExtUtils/testlib.pm Fixes up @INC to use just-built extension lib/ExtUtils/t/eu_command.t See if ExtUtils::Command works lib/ExtUtils/t/FIRST_MAKEFILE.t See if FIRST_MAKEFILE works +lib/ExtUtils/t/fixin.t See if ExtUtils::MakeMaker works lib/ExtUtils/t/hints.t See if hint files are honored. lib/ExtUtils/t/INSTALL_BASE.t Test INSTALL_BASE in MakeMaker lib/ExtUtils/t/Installed.t See if ExtUtils::Installed works @@ -1815,6 +1817,7 @@ lib/ExtUtils/t/PL_FILES.t Test PL_FILES in MakeMaker lib/ExtUtils/t/pm.t See if Makemaker can handle PM lib/ExtUtils/t/postamble.t See if postamble works lib/ExtUtils/t/prefixify.t See if MakeMaker can apply a PREFIX +lib/ExtUtils/t/prereq.t See if MakeMaker works lib/ExtUtils/t/prereq_print.t See if PREREQ_PRINT works lib/ExtUtils/t/problems.t How MakeMaker reacts to build problems lib/ExtUtils/t/prompt.t See if E::MM::prompt() works @@ -1824,6 +1827,7 @@ lib/ExtUtils/t/split_command.t See if MM's xargs-like function works lib/ExtUtils/t/testlib.t See if ExtUtils::testlib works lib/ExtUtils/t/VERSION_FROM.t See if MakeMaker's VERSION_FROM works lib/ExtUtils/t/vmsish.t Test ExtUtils::MakeMaker::vmsish +lib/ExtUtils/t/WriteEmptyMakefile.t See if WriteEmptyMakefile works lib/ExtUtils/t/writemakefile_args.t See if WriteMakefile works lib/ExtUtils/t/xs.t Part of MakeMaker's test suite lib/ExtUtils/typemap Extension interface types diff --git a/lib/ExtUtils/Liblist/Kid.pm b/lib/ExtUtils/Liblist/Kid.pm index e00115a..28d2a85 100644 --- a/lib/ExtUtils/Liblist/Kid.pm +++ b/lib/ExtUtils/Liblist/Kid.pm @@ -10,7 +10,7 @@ use 5.00503; use strict; use vars qw($VERSION); -$VERSION = 1.32_02; +$VERSION = 1.33; use Config; use Cwd 'cwd'; @@ -376,8 +376,7 @@ sub _vms_ext { $verbose ||= 0; my(@crtls,$crtlstr); - my($dbgqual) = $Config{'ldflags'}; - @crtls = ( ($dbgqual =~ m-/Debug-i ? $Config{'dbgprefix'} : '') + @crtls = ( ($Config{'ldflags'} =~ m-/Debug-i ? $Config{'dbgprefix'} : '') . 'PerlShr/Share' ); push(@crtls, grep { not /\(/ } split /\s+/, $Config{'perllibs'}); push(@crtls, grep { not /\(/ } split /\s+/, $Config{'libc'}); @@ -389,7 +388,7 @@ sub _vms_ext { if ($self->{PERL_SRC}) { my($lib,$locspec,$type); foreach $lib (@crtls) { - if (($locspec,$type) = $lib =~ m!^([\w\$-]+)(/\w+)?! and $locspec =~ /perl/i) { + if (($locspec,$type) = $lib =~ m{^([\w\$-]+)(/\w+)?} and $locspec =~ /perl/i) { if (lc $type eq '/share') { $locspec .= $Config{'exe_ext'}; } elsif (lc $type eq '/library') { $locspec .= $Config{'lib_ext'}; } else { $locspec .= $Config{'obj_ext'}; } diff --git a/lib/ExtUtils/MM_Unix.pm b/lib/ExtUtils/MM_Unix.pm index 7a1ea7b..dbc8245 100644 --- a/lib/ExtUtils/MM_Unix.pm +++ b/lib/ExtUtils/MM_Unix.pm @@ -18,7 +18,7 @@ use vars qw($VERSION @ISA use ExtUtils::MakeMaker qw($Verbose neatvalue); -$VERSION = '1.52_04'; +$VERSION = '1.54'; require ExtUtils::MM_Any; @ISA = qw(ExtUtils::MM_Any); @@ -632,7 +632,7 @@ manifest : $(PERLRUN) "-MExtUtils::Manifest=mkmanifest" -e mkmanifest veryclean : realclean - $(RM_F) *~ *.orig */*~ */*.orig + $(RM_F) *~ */*~ *.orig */*.orig *.bak */*.bak *.old */*.old MAKE_FRAG @@ -1028,10 +1028,9 @@ WARNING print "Executing $abs\n" if ($trace >= 2); my $version_check = qq{$abs -le "require $ver; print qq{VER_OK}"}; + $version_check = "$Config{run} $version_check" + if defined $Config{run} and length $Config{run}; - if (defined $Config{run}) { - $version_check = "$Config{run} $version_check"; - } # To avoid using the unportable 2>&1 to suppress STDERR, # we close it before running the command. # However, thanks to a thread library bug in many BSDs @@ -1046,7 +1045,7 @@ WARNING open STDERR, '>&STDERR_COPY' if $stderr_duped; } - if ($val =~ /^VER_OK/) { + if ($val =~ /^VER_OK/m) { print "Using PERL=$abs\n" if $trace; return $abs; } elsif ($trace >= 2) { @@ -1067,95 +1066,104 @@ Inserts the sharpbang or equivalent magic number to a set of @files. =cut -sub fixin { # stolen from the pink Camel book, more or less - my($self, @files) = @_; +sub fixin { # stolen from the pink Camel book, more or less + my ( $self, @files ) = @_; - my($does_shbang) = $Config{'sharpbang'} =~ /^\s*\#\!/; + my ($does_shbang) = $Config{'sharpbang'} =~ /^\s*\#\!/; for my $file (@files) { my $file_new = "$file.new"; my $file_bak = "$file.bak"; - local(*FIXIN); - local(*FIXOUT); - open(FIXIN, $file) or croak "Can't process '$file': $!"; - local $/ = "\n"; - chomp(my $line = ); - next unless $line =~ s/^\s*\#!\s*//; # Not a shbang file. - # Now figure out the interpreter name. - my($cmd,$arg) = split ' ', $line, 2; - $cmd =~ s!^.*/!!; - - # Now look (in reverse) for interpreter in absolute PATH (unless perl). + local (*FIXIN); + local (*FIXOUT); + open( FIXIN, $file ) or croak "Can't process '$file': $!"; + local $/ = "\n"; + chomp( my $line = ); + next unless $line =~ s/^\s*\#!\s*//; # Not a shbang file. + # Now figure out the interpreter name. + my ( $cmd, $arg ) = split ' ', $line, 2; + $cmd =~ s!^.*/!!; + + # Now look (in reverse) for interpreter in absolute PATH (unless perl). my $interpreter; - if ($cmd eq "perl") { - if ($Config{startperl} =~ m,^\#!.*/perl,) { + if ( $cmd eq "perl" ) { + if ( $Config{startperl} =~ m,^\#!.*/perl, ) { $interpreter = $Config{startperl}; $interpreter =~ s,^\#!,,; - } else { + } + else { $interpreter = $Config{perlpath}; } - } else { - my(@absdirs) = reverse grep {$self->file_name_is_absolute} $self->path; - $interpreter = ''; - my($dir); - foreach $dir (@absdirs) { - if ($self->maybe_command($cmd)) { - warn "Ignoring $interpreter in $file\n" if $Verbose && $interpreter; - $interpreter = $self->catfile($dir,$cmd); - } - } - } - # Figure out how to invoke interpreter on this machine. - - my($shb) = ""; - if ($interpreter) { - print STDOUT "Changing sharpbang in $file to $interpreter" if $Verbose; - # this is probably value-free on DOSISH platforms - if ($does_shbang) { - $shb .= "$Config{'sharpbang'}$interpreter"; - $shb .= ' ' . $arg if defined $arg; - $shb .= "\n"; - } - $shb .= qq{ + } + else { + my (@absdirs) + = reverse grep { $self->file_name_is_absolute } $self->path; + $interpreter = ''; + my ($dir); + foreach $dir (@absdirs) { + if ( $self->maybe_command($cmd) ) { + warn "Ignoring $interpreter in $file\n" + if $Verbose && $interpreter; + $interpreter = $self->catfile( $dir, $cmd ); + } + } + } + + # Figure out how to invoke interpreter on this machine. + + my ($shb) = ""; + if ($interpreter) { + print STDOUT "Changing sharpbang in $file to $interpreter" + if $Verbose; + + # this is probably value-free on DOSISH platforms + if ($does_shbang) { + $shb .= "$Config{'sharpbang'}$interpreter"; + $shb .= ' ' . $arg if defined $arg; + $shb .= "\n"; + } + $shb .= qq{ eval 'exec $interpreter $arg -S \$0 \${1+"\$\@"}' if 0; # not running under some shell -} unless $Is_Win32; # this won't work on win32, so don't - } else { - warn "Can't find $cmd in PATH, $file unchanged" - if $Verbose; - next; - } +} unless $Is_Win32; # this won't work on win32, so don't + } + else { + warn "Can't find $cmd in PATH, $file unchanged" + if $Verbose; + next; + } - unless ( open(FIXOUT,">$file_new") ) { - warn "Can't create new $file: $!\n"; - next; - } - - # Print out the new #! line (or equivalent). - local $\; - local $/; - print FIXOUT $shb, ; - close FIXIN; - close FIXOUT; + unless ( open( FIXOUT, ">$file_new" ) ) { + warn "Can't create new $file: $!\n"; + next; + } + + # Print out the new #! line (or equivalent). + local $\; + local $/; + print FIXOUT $shb, ; + close FIXIN; + close FIXOUT; chmod 0666, $file_bak; unlink $file_bak; - unless ( _rename($file, $file_bak) ) { - warn "Can't rename $file to $file_bak: $!"; - next; - } - unless ( _rename($file_new, $file) ) { - warn "Can't rename $file_new to $file: $!"; - unless ( _rename($file_bak, $file) ) { - warn "Can't rename $file_bak back to $file either: $!"; - warn "Leaving $file renamed as $file_bak\n"; - } - next; - } - unlink $file_bak; - } continue { - close(FIXIN) if fileno(FIXIN); - system("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';; + unless ( _rename( $file, $file_bak ) ) { + warn "Can't rename $file to $file_bak: $!"; + next; + } + unless ( _rename( $file_new, $file ) ) { + warn "Can't rename $file_new to $file: $!"; + unless ( _rename( $file_bak, $file ) ) { + warn "Can't rename $file_bak back to $file either: $!"; + warn "Leaving $file renamed as $file_bak\n"; + } + next; + } + unlink $file_bak; + } + continue { + close(FIXIN) if fileno(FIXIN); + system("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':'; } } @@ -1577,21 +1585,17 @@ sub init_main { my $inc_carp_dir = dirname($INC{'Carp.pm'}); unless ($self->{PERL_SRC}){ - my($dir); - foreach my $dir_count (1..8) # 8 is the VMS limit for nesting - { - $dir = $self->catdir(($Updir) x $dir_count); - if ( - -f $self->catfile($dir,"config_h.SH") - && - -f $self->catfile($dir,"perl.h") - && - -f $self->catfile($dir,"lib","Exporter.pm") - ) { - $self->{PERL_SRC}=$dir ; - last; - } - } + foreach my $dir_count (1..8) { # 8 is the VMS limit for nesting + my $dir = $self->catdir(($Updir) x $dir_count); + + if (-f $self->catfile($dir,"config_h.SH") && + -f $self->catfile($dir,"perl.h") && + -f $self->catfile($dir,"lib","Exporter.pm") + ) { + $self->{PERL_SRC}=$dir ; + last; + } + } } warn "PERL_CORE is set but I can't find your PERL_SRC!\n" if @@ -2539,7 +2543,7 @@ doc_inst_perl: MAP_LIBPERL "$(MAP_LIBPERL)" \ >> }.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{ -} if -f 'Makefile.PL'; +}; push @m, q{ inst_perl: pure_inst_perl doc_inst_perl @@ -2682,10 +2686,16 @@ sub parse_abstract { =item parse_version -parse a file and return what you think is $VERSION in this file set to. + my $version = MM->parse_version($file); + +Parse a $file and return what $VERSION is set to by the first assignment. It will return the string "undef" if it can't figure out what $VERSION -is. $VERSION should be for all to see, so our $VERSION or plain $VERSION -are okay, but my $VERSION is not. +is. $VERSION should be for all to see, so C or plain $VERSION +are okay, but C is not. + +parse_version() will try to C before checking for C<$VERSION> so the following will work. + + $VERSION = qv(1.2.3); =cut @@ -2705,6 +2715,10 @@ sub parse_version { my $eval = qq{ package ExtUtils::MakeMaker::_version; no strict; + BEGIN { eval { + require version; + "version"->import; + } } local $1$2; \$$2=undef; do { @@ -3415,7 +3429,6 @@ sub test { } # note: 'test.pl' name is also hardcoded in init_dirscan() my(@m); - my $subdirs_test = ($self->{DIR} && @{$self->{DIR}} ? 'subdirs-test' : ''); push(@m," TEST_VERBOSE=0 TEST_TYPE=test_\$(LINKTYPE) @@ -3425,17 +3438,21 @@ TESTDB_SW = -d testdb :: testdb_\$(LINKTYPE) -test :: \$(TEST_TYPE) $subdirs_test +test :: \$(TEST_TYPE) subdirs-test + +subdirs-test :: + \$(NOECHO) \$(NOOP) + "); foreach my $dir (@{ $self->{DIR} }) { - my $test = $self->oneliner(sprintf <<'CODE', $dir); -chdir '%s'; -system '$(MAKE) $(USEMAKEFILE) $(FIRST_MAKEFILE) test $(PASTHRU)' - if -f '$(FIRST_MAKEFILE)'; -CODE + my $test = $self->cd($dir, '$(MAKE) test $(PASTHRU)'); + + push @m, <{OBJECT}; diff --git a/lib/ExtUtils/MM_Win32.pm b/lib/ExtUtils/MM_Win32.pm index a78bc6c..553ad98 100644 --- a/lib/ExtUtils/MM_Win32.pm +++ b/lib/ExtUtils/MM_Win32.pm @@ -29,7 +29,7 @@ use vars qw(@ISA $VERSION); require ExtUtils::MM_Any; require ExtUtils::MM_Unix; @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); -$VERSION = '1.14_01'; +$VERSION = '1.15'; $ENV{EMXSHELL} = 'sh'; # to run `commands` @@ -341,10 +341,12 @@ $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DFSEP). push(@m, q{ $(LD) -out:$@ $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) } .q{$(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) -def:$(EXPORT_LIST)}); + # VS2005 (aka VC 8) or higher, but not for 64-bit compiler from Platform SDK - if ($Config{ivsize} == 4 && $Config{cc} eq 'cl' and $Config{ccversion} =~ /^(\d+)/ and $1 >= 14) { + if ($Config{ivsize} == 4 && $Config{cc} eq 'cl' and $Config{ccversion} =~ /^(\d+)/ and $1 >= 14) + { push(@m, - q{ + q{ mt -nologo -manifest $@.manifest -outputresource:$@;2 && del $@.manifest}); } } @@ -485,8 +487,7 @@ wants: another_command cd .. -B This cd can only go one level down. So far this sufficient for -what MakeMaker needs. +NOTE: This only works with simple relative directories. Throw it an absolute dir or something with .. in it and things will go wrong. =cut @@ -497,11 +498,13 @@ sub cd { my $cmd = join "\n\t", map "$_", @cmds; + my $updirs = $self->catdir(map { $self->updir } $self->splitdir($dir)); + # No leading tab and no trailing newline makes for easier embedding. - my $make_frag = sprintf <<'MAKE_FRAG', $dir, $cmd; + my $make_frag = sprintf <<'MAKE_FRAG', $dir, $cmd, $updirs; cd %s %s - cd .. + cd %s MAKE_FRAG chomp $make_frag; @@ -561,7 +564,6 @@ PERLTYPE = $self->{PERLTYPE} } - 1; __END__ diff --git a/lib/ExtUtils/MakeMaker/FAQ.pod b/lib/ExtUtils/MakeMaker/FAQ.pod index 16d9f29..f733cb8 100644 --- a/lib/ExtUtils/MakeMaker/FAQ.pod +++ b/lib/ExtUtils/MakeMaker/FAQ.pod @@ -1,7 +1,7 @@ package ExtUtils::MakeMaker::FAQ; use vars qw($VERSION); -$VERSION = '1.11_04'; +$VERSION = '1.12'; 1; __END__ @@ -104,6 +104,20 @@ And then set PERL5LIB to F<~/tmp/lib/perl5>. This works well when you have multiple modules to work with. It also ensures that the module goes through its full installation process which may modify it. +=item PREFIX vs INSTALL_BASE from Module::Build::Cookbook + +The behavior of PREFIX is complicated and depends closely on how your +Perl is configured. The resulting installation locations will vary from +machine to machine and even different installations of Perl on the same machine. +Because of this, its difficult to document where prefix will place your modules. + +In contrast, INSTALL_BASE has predictable, easy to explain installation locations. +Now that Module::Build and MakeMaker both have INSTALL_BASE there is little reason +to use PREFIX other than to preserve your existing installation locations. If you +are starting a fresh Perl installation we encourage you to use INSTALL_BASE. If +you have an existing installation installed via PREFIX, consider moving it to an +installation structure matching INSTALL_BASE and using that instead. + =back @@ -175,7 +189,7 @@ in the $Revision$ will be updated, updating your $VERSION. SVN uses a simple integer for $Revision$ so you can adapt it for your $VERSION like so: - $VERSION = (q$Revision$) =~ /(\d+)/g; + ($VERSION) = q$Revision$ =~ /(\d+)/; In CVS and RCS version 1.9 is followed by 1.10. Since CPAN compares version numbers numerically we use a sprintf() to convert 1.9 to 1.009 diff --git a/lib/ExtUtils/t/WriteEmptyMakefile.t b/lib/ExtUtils/t/WriteEmptyMakefile.t new file mode 100644 index 0000000..e9db02b --- /dev/null +++ b/lib/ExtUtils/t/WriteEmptyMakefile.t @@ -0,0 +1,40 @@ +#!/usr/bin/perl -w + +# This is a test of WriteEmptyMakefile. + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = ('../lib', 'lib'); + } + else { + unshift @INC, 't/lib'; + } +} + +chdir 't'; + +use strict; +use Test::More 'no_plan'; + +use ExtUtils::MakeMaker qw(WriteEmptyMakefile); +use TieOut; + +can_ok __PACKAGE__, 'WriteEmptyMakefile'; + +eval { WriteEmptyMakefile("something"); }; +like $@, qr/Need an even number of args/; + + +{ + ok( my $stdout = tie *STDOUT, 'TieOut' ); + + ok !-e 'wibble'; + END { 1 while unlink 'wibble' } + + WriteEmptyMakefile( + NAME => "Foo", + FIRST_MAKEFILE => "wibble", + ); + ok -e 'wibble'; +} diff --git a/lib/ExtUtils/t/basic.t b/lib/ExtUtils/t/basic.t index ba5a7ba..6b9002a 100644 --- a/lib/ExtUtils/t/basic.t +++ b/lib/ExtUtils/t/basic.t @@ -16,7 +16,7 @@ BEGIN { use strict; use Config; -use Test::More tests => 80; +use Test::More tests => 83; use MakeMaker::Test::Utils; use MakeMaker::Test::Setup::BFD; use File::Find; @@ -249,6 +249,11 @@ ok( !-f 'META.yml', 'META.yml not written to source dir' ); ok( -f $meta_yml, 'META.yml written to dist dir' ); ok( !-e "META_new.yml", 'temp META.yml file not left around' ); +ok open META, $meta_yml or diag $!; +my @meta = ; +like $meta[-1], '/\n$/', "META.yml ends with a newline"; +ok close META; + my $manifest = maniread("$distdir/MANIFEST"); # VMS is non-case preserving, so we can't know what the MANIFEST will # look like. :( diff --git a/lib/ExtUtils/t/cd.t b/lib/ExtUtils/t/cd.t new file mode 100644 index 0000000..1ae2132 --- /dev/null +++ b/lib/ExtUtils/t/cd.t @@ -0,0 +1,67 @@ +#!/usr/bin/perl -w + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't'; + @INC = ('../lib', 'lib/'); + } + else { + unshift @INC, 't/lib/'; + } +} +chdir 't'; + +my $Is_VMS = $^O eq 'VMS'; + +use File::Spec; + +use Test::More tests => 4; + +my @cd_args = ("some/dir", "command1", "command2"); + +{ + package Test::MM_Win32; + use ExtUtils::MM_Win32; + @ISA = qw(ExtUtils::MM_Win32); + + my $mm = bless {}, 'Test::MM_Win32'; + + { + local *make = sub { "nmake" }; + + my @dirs = (File::Spec->updir) x 2; + my $expected_updir = File::Spec->catdir(@dirs); + + ::is $mm->cd(@cd_args), +qq{cd some/dir + command1 + command2 + cd $expected_updir}; + } + + { + local *make = sub { "dmake" }; + + ::is $mm->cd(@cd_args), +q{cd some/dir && command1 + cd some/dir && command2}; + } +} + +{ + is +ExtUtils::MM_Unix->cd(@cd_args), +q{cd some/dir && command1 + cd some/dir && command2}; +} + +SKIP: { + skip("VMS' cd requires vmspath which is only on VMS", 1) unless $Is_VMS; + + use ExtUtils::MM_VMS; + is +ExtUtils::MM_VMS->cd(@cd_args), +q{startdir = F$Environment("Default") + Set Default some/dir + command1 + command2 + Set Default 'startdir'}; +} \ No newline at end of file diff --git a/lib/ExtUtils/t/fixin.t b/lib/ExtUtils/t/fixin.t new file mode 100644 index 0000000..69c0ac7 --- /dev/null +++ b/lib/ExtUtils/t/fixin.t @@ -0,0 +1,45 @@ +#!/usr/bin/perl -w + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't'; + @INC = ('../lib', 'lib/'); + } + else { + unshift @INC, 't/lib/'; + } +} +chdir 't'; + +use File::Spec; + +use Test::More tests => 6; + +use TieOut; +use MakeMaker::Test::Utils; +use MakeMaker::Test::Setup::BFD; + +use ExtUtils::MakeMaker; + +chdir 't'; + +perl_lib(); + +ok( setup_recurs(), 'setup' ); +END { + ok( chdir File::Spec->updir ); + ok( teardown_recurs(), 'teardown' ); +} + +ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) || + diag("chdir failed: $!"); + +# [rt.cpan.org 26234] +{ + local $/ = "foo"; + local $\ = "bar"; + MY->fixin("bin/program"); + is $/, "foo", '$/ not clobbered'; + is $\, "bar", '$\ not clobbered'; +} + diff --git a/lib/ExtUtils/t/parse_version.t b/lib/ExtUtils/t/parse_version.t index 8d2a8d0..78ba52e 100644 --- a/lib/ExtUtils/t/parse_version.t +++ b/lib/ExtUtils/t/parse_version.t @@ -11,16 +11,35 @@ BEGIN { } chdir 't'; -use Test::More tests => 10; +use Test::More; use ExtUtils::MakeMaker; -my %versions = ('$VERSION = 0.02' => 0.02, +my %versions = (q[$VERSION = '1.00'] => '1.00', + q[*VERSION = \'1.01'] => '1.01', + q[($VERSION) = q$Revision: 32208 $ =~ /(\d+)/g;] => 32208, + q[$FOO::VERSION = '1.10';] => '1.10', + q[*FOO::VERSION = \'1.11';] => '1.11', + '$VERSION = 0.02' => 0.02, '$VERSION = 0.0' => 0.0, '$VERSION = -1.0' => -1.0, '$VERSION = undef' => 'undef', '$wibble = 1.0' => 'undef', + q[my $VERSION = '1.01'] => 'undef', + q[local $VERISON = '1.02'] => 'undef', + q[local $FOO::VERSION = '1.30'] => 'undef', ); +if( eval 'our $foo' ) { + $versions{q[our $VERSION = '1.23';]} = '1.23', +} + +if( eval 'require version; "version"->import' ) { + $versions{q[use version; $VERSION = qv(1.2.3);]} = qv(1.2.3); + $versions{q[$VERSION = qv(1.2.3)]} = qv(1.2.3); +} + +plan tests => 2 * keys %versions; + while( my($code, $expect) = each %versions ) { open(FILE, ">VERSION.tmp") || die $!; print FILE "$code\n"; diff --git a/lib/ExtUtils/t/prereq.t b/lib/ExtUtils/t/prereq.t new file mode 100644 index 0000000..ae6ac84 --- /dev/null +++ b/lib/ExtUtils/t/prereq.t @@ -0,0 +1,109 @@ +#!/usr/bin/perl -w + +# This is a test of the verification of the arguments 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 'no_plan'; + +use TieOut; +use MakeMaker::Test::Utils; +use MakeMaker::Test::Setup::BFD; + +use ExtUtils::MakeMaker; + +chdir 't'; + +perl_lib(); + +ok( setup_recurs(), 'setup' ); +END { + ok( chdir File::Spec->updir ); + ok( teardown_recurs(), 'teardown' ); +} + +ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) || + diag("chdir failed: $!"); + +{ + ok( my $stdout = tie *STDOUT, 'TieOut' ); + my $warnings = ''; + local $SIG{__WARN__} = sub { + $warnings .= join '', @_; + }; + + WriteMakefile( + NAME => 'Big::Dummy', + PREREQ_PM => { + strict => 0 + } + ); + is $warnings, ''; + + $warnings = ''; + WriteMakefile( + NAME => 'Big::Dummy', + PREREQ_PM => { + strict => 99999 + } + ); + is $warnings, + "Warning: prerequisite strict 99999 not found. We have $strict::VERSION.\n"; + + $warnings = ''; + WriteMakefile( + NAME => 'Big::Dummy', + PREREQ_PM => { + "I::Do::Not::Exist" => 0, + } + ); + is $warnings, + "Warning: prerequisite I::Do::Not::Exist 0 not found.\n"; + + $warnings = ''; + WriteMakefile( + NAME => 'Big::Dummy', + PREREQ_PM => { + "I::Do::Not::Exist" => 0, + "strict" => 99999, + } + ); + is $warnings, + "Warning: prerequisite I::Do::Not::Exist 0 not found.\n". + "Warning: prerequisite strict 99999 not found. We have $strict::VERSION.\n"; + + + $warnings = ''; + eval { + WriteMakefile( + NAME => 'Big::Dummy', + PREREQ_PM => { + "I::Do::Not::Exist" => 0, + "Nor::Do::I" => 0, + "strict" => 99999, + }, + PREREQ_FATAL => 1, + ); + }; + + is $warnings, ''; + is $@, <<'END', "PREREQ_FATAL"; +MakeMaker FATAL: prerequisites not found. + I::Do::Not::Exist not installed + Nor::Do::I not installed + strict 99999 + +Please install these modules first and rerun 'perl Makefile.PL'. +END + +} diff --git a/lib/ExtUtils/t/recurs.t b/lib/ExtUtils/t/recurs.t index 53bdf47..17da39e 100644 --- a/lib/ExtUtils/t/recurs.t +++ b/lib/ExtUtils/t/recurs.t @@ -15,7 +15,7 @@ BEGIN { use strict; use Config; -use Test::More tests => 25; +use Test::More tests => 26; use MakeMaker::Test::Utils; use MakeMaker::Test::Setup::Recurs; @@ -111,3 +111,12 @@ ok( open(MAKEFILE, $submakefile) ) || diag("Can't open $submakefile: $!"); 'prepend .. not stomping WriteMakefile args' ) } close MAKEFILE; + + +{ + # Quiet "make test" failure noise + close *STDERR; + + my $test_out = run("$make test"); + isnt $?, 0, 'test failure in a subdir causes make to fail'; +} \ No newline at end of file diff --git a/lib/ExtUtils/t/writemakefile_args.t b/lib/ExtUtils/t/writemakefile_args.t index a19a5ee..e7b2db5 100644 --- a/lib/ExtUtils/t/writemakefile_args.t +++ b/lib/ExtUtils/t/writemakefile_args.t @@ -14,7 +14,7 @@ BEGIN { } use strict; -use Test::More tests => 16; +use Test::More 'no_plan'; use TieOut; use MakeMaker::Test::Utils; @@ -53,7 +53,7 @@ ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) || }; is( $warnings, <{WIBBLE}, 'something' ); is_deeply( $mm->{wump}, { foo => 42 } ); -} + + + # Test VERSION + $warnings = ''; + eval { + $mm = WriteMakefile( + NAME => 'Big::Dummy', + VERSION => [1,2,3], + ); + }; + like( $warnings, qr{^WARNING: VERSION takes a version object or string/number} ); + + $warnings = ''; + eval { + $mm = WriteMakefile( + NAME => 'Big::Dummy', + VERSION => 1.002_003, + ); + }; + is( $warnings, '' ); + is( $mm->{VERSION}, '1.002003' ); + + $warnings = ''; + eval { + $mm = WriteMakefile( + NAME => 'Big::Dummy', + VERSION => '1.002_003', + ); + }; + is( $warnings, '' ); + is( $mm->{VERSION}, '1.002_003' ); + + + $warnings = ''; + eval { + $mm = WriteMakefile( + NAME => 'Big::Dummy', + VERSION => bless {}, "Some::Class", + ); + }; + like( $warnings, '/^WARNING: VERSION takes a version object or string/number not a Some::Class object/' ); + + + SKIP: { + skip("Can't test version objects",2) unless eval { require version }; + version->import; + + my $version = version->new("1.2.3"); + $warnings = ''; + eval { + $mm = WriteMakefile( + NAME => 'Big::Dummy', + VERSION => $version, + ); + }; + is( $warnings, '' ); + isa_ok( $mm->{VERSION}, 'version' ); + is( $mm->{VERSION}, $version ); + + $warnings = ''; + $version = qv('1.2.3'); + eval { + $mm = WriteMakefile( + NAME => 'Big::Dummy', + VERSION => $version, + ); + }; + is( $warnings, '' ); + isa_ok( $mm->{VERSION}, 'version' ); + is( $mm->{VERSION}, $version ); + } +} \ No newline at end of file diff --git a/t/lib/MakeMaker/Test/Setup/Recurs.pm b/t/lib/MakeMaker/Test/Setup/Recurs.pm index c8b7379..d3585eb 100644 --- a/t/lib/MakeMaker/Test/Setup/Recurs.pm +++ b/t/lib/MakeMaker/Test/Setup/Recurs.pm @@ -27,6 +27,14 @@ WriteMakefile( VERSION => 1.00, ); END + + # Check if a test failure in a subdir causes make test to fail + 'Recurs/prj2/t/fail.t' => <<'END', +#!/usr/bin/perl -w + +print "1..1\n"; +print "not ok 1\n"; +END ); sub setup_recurs { diff --git a/t/lib/MakeMaker/Test/Utils.pm b/t/lib/MakeMaker/Test/Utils.pm index 0d6afc3..fb8162d 100644 --- a/t/lib/MakeMaker/Test/Utils.pm +++ b/t/lib/MakeMaker/Test/Utils.pm @@ -251,7 +251,7 @@ would expect to see on a screen. sub run { my $cmd = shift; - require ExtUtils::MM; + use ExtUtils::MM; # Unix can handle 2>&1 and OS/2 from 5.005_54 up. # This makes our failure diagnostics nicer to read. @@ -304,7 +304,7 @@ sub have_compiler { # ExtUtils::CBuilder prints its compilation lines to the screen. # Shut it up. - require TieOut; + use TieOut; local *STDOUT = *STDOUT; local *STDERR = *STDERR; -- 2.7.4