From: Yves Orton Date: Wed, 5 Nov 2008 22:47:58 +0000 (+0000) Subject: Bring ExtUtils::Install up to date with the latest on CPAN 1.50_04 and related test... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4954abf77fcbac122d63699b1b3921b4d44d4570;p=p5sagit%2Fp5-mst-13.2.git Bring ExtUtils::Install up to date with the latest on CPAN 1.50_04 and related test changes This involves changes to shared test files used by ExtUtils::MakeMaker and ExtUtils::Install, in particular updating the core/MakeMaker version of ExtUtils/t/basic.t so that it reflects the 1.50_03 version, and then splitting it in half into basic.pl and basic_finish.pl, which are then evalled (together) by basic.t. ExtUtils::Install does somethign similar but only with basic.pl. This also silences an odd warning from MM_Any.pm that comes up once in a while, which I believe is to do with a deeper core failure as it occurs in code utterly unrelated to these changes. This patch needs to be pushed upstream to the ExtUtils::MakeMaker distribution on CPAN under Schwern's supervision. In this way it will be possible to simply copy the t/basic.pl from core into ExtUtils::Install or into ExtUtils::MakeMaker or whatever. Includes the following changes from ExtUtils::Install: 1.50_04 SVN revision 41. Restructure tests to make it easier to maintain given it is distributed in various ways in three different packages. 1.50_03 SVN revision 40. Sigh, just after i released 1.50_02 I noticed that a test modified in it will fail under VMS. So this is a fixup release for that alone. 1.50_02 SVN revision 39. Synchronize with the changes that were made in blead perl patch #33567. VMS changes by Craig Berry. See http://public.activestate.com/cgi-bin/perlbrowse/p/33567 This was marked in the pod as 1.51 but not actually version bumped. So I've marked it as 1.50_02 as a test release prior to putting it out as the real 1.51 This release also restores the missing installed.t which was accidentally missed by the MANIFEST having a duplicate entry for install.t instead. Probably something should have warned about this, but I haven't worked out what. Includes changes from Activestate/ActivePerl: - To make installation less chatty when not under verbose mode. See http://rt.cpan.org/Public/Bug/Display.html?id=5903 - To install HTML documentation files under builds that set $Config{installhtmldir} (and presumably also create HTML versions of the pod -- which is quite nice actually :-) http://rt.cpan.org/Ticket/Display.html?id=37727 p4raw-id: //depot/perl@34742 --- diff --git a/MANIFEST b/MANIFEST index b2dcdab..ce887bd 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2013,7 +2013,9 @@ lib/ExtUtils/PATCHING Suggestions for patching MakeMaker lib/ExtUtils/README MakeMaker README lib/ExtUtils/t/00compile.t See if MakeMaker modules compile 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/basic.t See if MakeMaker can build a module (wrapper for basic.pl and basic_finish.pl) +lib/ExtUtils/t/basic.pl See if MakeMaker can build a module (part 1) +lib/ExtUtils/t/basic_finish.pl See if MakeMaker can build a module (part 2) lib/ExtUtils/t/build_man.t Set if MakeMaker builds manpages lib/ExtUtils/t/bytes.t Test ExtUtils::MakeMaker::bytes lib/ExtUtils/t/can_write_dir.t Does the _can_write_dir function of ExtUtils::Install work properly? diff --git a/lib/ExtUtils/Install.pm b/lib/ExtUtils/Install.pm index aec9aca..3832a8e 100644 --- a/lib/ExtUtils/Install.pm +++ b/lib/ExtUtils/Install.pm @@ -38,11 +38,11 @@ ExtUtils::Install - install files from here to there =head1 VERSION -1.51 +1.50_04 =cut -$VERSION = '1.50_01'; +$VERSION = '1.50_04'; $VERSION = eval $VERSION; =pod @@ -816,7 +816,7 @@ sub install { #XXX OS-SPECIFIC if ($pack{'write'}) { $dir = install_rooted_dir(dirname($pack{'write'})); _mkpath( $dir, 0, 0755, $verbose, $dry_run ); - print "Writing $pack{'write'}\n"; + print "Writing $pack{'write'}\n" if $verbose; $packlist->write(install_rooted_file($pack{'write'})) unless $dry_run; } @@ -957,6 +957,13 @@ sub install_default { my $INST_SCRIPT = File::Spec->catdir($Curdir,'blib','script'); my $INST_MAN1DIR = File::Spec->catdir($Curdir,'blib','man1'); my $INST_MAN3DIR = File::Spec->catdir($Curdir,'blib','man3'); + + my @INST_HTML; + if($Config{installhtmldir}) { + my $INST_HTMLDIR = File::Spec->catdir($Curdir,'blib','html'); + @INST_HTML = ($INST_HTMLDIR => $Config{installhtmldir}); + } + install({ read => "$Config{sitearchexp}/auto/$FULLEXT/.packlist", write => "$Config{installsitearch}/auto/$FULLEXT/.packlist", @@ -968,6 +975,7 @@ sub install_default { $INST_SCRIPT => $Config{installscript}, $INST_MAN1DIR => $Config{installman1dir}, $INST_MAN3DIR => $Config{installman3dir}, + @INST_HTML, },1,0,0); } diff --git a/lib/ExtUtils/MM_Any.pm b/lib/ExtUtils/MM_Any.pm index 5e4bd69..2cee73f 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.48'; +our $VERSION = '6.48_01'; use Carp; use File::Spec; @@ -354,7 +354,7 @@ to do some normalization on the information from %Config or the user. sub make { my $self = shift; - my $make = lc $self->{MAKE}; + my $make = lc($self->{MAKE}|| ''); # Truncate anything like foomake6 to just foomake. $make =~ s/^(\w+make).*/$1/; diff --git a/lib/ExtUtils/t/INSTALL_BASE.t b/lib/ExtUtils/t/INSTALL_BASE.t index cac65f2..4442762 100644 --- a/lib/ExtUtils/t/INSTALL_BASE.t +++ b/lib/ExtUtils/t/INSTALL_BASE.t @@ -48,8 +48,10 @@ ok( grep(/^Writing $makefile for Big::Dummy/, my $make = make_run(); run("$make"); # this is necessary due to a dmake bug. -my $install_out = run("$make install"); -is( $?, 0, ' make install exited normally' ) || diag $install_out; +# Test 'make install VERBINST=1' +my $make_install_verbinst = make_macro($make, 'install', VERBINST => 1); +my $install_out = run($make_install_verbinst); +is( $?, 0, 'install' ) || diag $install_out; like( $install_out, qr/^Installing /m ); like( $install_out, qr/^Writing /m ); diff --git a/lib/ExtUtils/t/basic.pl b/lib/ExtUtils/t/basic.pl new file mode 100644 index 0000000..f84e568 --- /dev/null +++ b/lib/ExtUtils/t/basic.pl @@ -0,0 +1,231 @@ +#!/usr/bin/perl -w + +# *NOTE* This is executed by basic.t and is included in both ExtUtils-Install +# and ExtUtils-MakeMaker as well as Perl itself. Which bits of it execute depend +# on each given packages basic.t + +# This test puts MakeMaker through the paces of a basic perl module +# build, test and installation of the Big::Fat::Dummy module. + +use strict; +use Config; +use ExtUtils::MakeMaker; + +use Test::More tests => $::TESTS; +use MakeMaker::Test::Utils; +use MakeMaker::Test::Setup::BFD; +use File::Find; +use File::Spec; +use File::Path; + +# 'make disttest' sets a bunch of environment variables which interfere +# with our testing. +delete @ENV{qw(PREFIX LIB MAKEFLAGS)}; + +my $perl = which_perl(); +my $Is_VMS = $^O eq 'VMS'; + +# GNV logical interferes with testing +$ENV{'bin'} = '[.bin]' if $Is_VMS; + +chdir 't'; + +perl_lib; + +my $Touch_Time = calibrate_mtime(); + +$| = 1; + +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: $!"); + +my @mpl_out = run(qq{$perl Makefile.PL "PREFIX=../dummy-install"}); +END { rmtree '../dummy-install'; } + +cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || + diag(@mpl_out); + +my $makefile = makefile_name(); +ok( grep(/^Writing $makefile for Big::Dummy/, + @mpl_out) == 1, + 'Makefile.PL output looks right'); + +ok( grep(/^Current package is: main$/, + @mpl_out) == 1, + 'Makefile.PL run in package main'); + +ok( -e $makefile, 'Makefile exists' ); + +# -M is flakey on VMS +my $mtime = (stat($makefile))[9]; +cmp_ok( $Touch_Time, '<=', $mtime, ' its been touched' ); + +END { unlink makefile_name(), makefile_backup() } + +my $make = make_run(); + +{ + # Supress 'make manifest' noise + local $ENV{PERL_MM_MANIFEST_VERBOSE} = 0; + my $manifest_out = run("$make manifest"); + ok( -e 'MANIFEST', 'make manifest created a MANIFEST' ); + ok( -s 'MANIFEST', ' its not empty' ); +} + +END { unlink 'MANIFEST'; } + +unless ($::TEST_INSTALL_ONLY) { + my $ppd_out = run("$make ppd"); + is( $?, 0, ' exited normally' ) || diag $ppd_out; + ok( open(PPD, 'Big-Dummy.ppd'), ' .ppd file generated' ); + my $ppd_html; + { local $/; $ppd_html = } + close PPD; + like( $ppd_html, qr{^}m, + ' ' ); + like( $ppd_html, qr{^\s*Big-Dummy}m, ' ' ); + like( $ppd_html, qr{^\s*<ABSTRACT>Try "our" hot dog's</ABSTRACT>}m, # Unconfuse highlighters: ' + ' <ABSTRACT>'); + like( $ppd_html, + qr{^\s*<AUTHOR>Michael G Schwern <schwern\@pobox.com></AUTHOR>}m, + ' <AUTHOR>' ); + like( $ppd_html, qr{^\s*<IMPLEMENTATION>}m, ' <IMPLEMENTATION>'); + like( $ppd_html, qr{^\s*<DEPENDENCY NAME="strict" VERSION="0,0,0,0" />}m, + ' <DEPENDENCY>' ); + like( $ppd_html, qr{^\s*<OS NAME="$Config{osname}" />}m, + ' <OS>' ); + my $archname = $Config{archname}; + $archname .= "-". substr($Config{version},0,3) if $] >= 5.008; + like( $ppd_html, qr{^\s*<ARCHITECTURE NAME="$archname" />}m, + ' <ARCHITECTURE>'); + like( $ppd_html, qr{^\s*<CODEBASE HREF="" />}m, ' <CODEBASE>'); + like( $ppd_html, qr{^\s*</IMPLEMENTATION>}m, ' </IMPLEMENTATION>'); + like( $ppd_html, qr{^\s*</SOFTPKG>}m, ' </SOFTPKG>'); + END { unlink 'Big-Dummy.ppd' } +} + +my $test_out = run("$make test"); +like( $test_out, qr/All tests successful/, 'make test' ); +is( $?, 0, ' exited normally' ) || + diag $test_out; + +# Test 'make test TEST_VERBOSE=1' +my $make_test_verbose = make_macro($make, 'test', TEST_VERBOSE => 1); +$test_out = run("$make_test_verbose"); +like( $test_out, qr/ok \d+ - TEST_VERBOSE/, 'TEST_VERBOSE' ); +like( $test_out, qr/All tests successful/, ' successful' ); +is( $?, 0, ' exited normally' ) || + diag $test_out; + +# Test 'make install VERBINST=1' +my $make_install_verbinst = make_macro($make, 'install', VERBINST => 1); +my $install_out = run($make_install_verbinst); +is( $?, 0, 'install' ) || diag $install_out; +like( $install_out, qr/^Installing /m ); +like( $install_out, qr/^Writing /m ); + +ok( -r '../dummy-install', ' install dir created' ); +my %files = (); +find( sub { + # do it case-insensitive for non-case preserving OSs + my $file = lc $_; + + # VMS likes to put dots on the end of things that don't have them. + $file =~ s/\.$// if $Is_VMS; + + $files{$file} = $File::Find::name; +}, '../dummy-install' ); +ok( $files{'dummy.pm'}, ' Dummy.pm installed' ); +ok( $files{'liar.pm'}, ' Liar.pm installed' ); +ok( $files{'program'}, ' program installed' ); +ok( $files{'.packlist'}, ' packlist created' ); +ok( $files{'perllocal.pod'},' perllocal.pod created' ); + + +SKIP: { + skip 'VMS install targets do not preserve $(PREFIX)', 9 if $Is_VMS; + + $install_out = run("$make install PREFIX=elsewhere VERBINST=1"); + is( $?, 0, 'install with PREFIX override' ) || diag $install_out; + like( $install_out, qr/^Installing /m ); + like( $install_out, qr/^Writing /m ); + + ok( -r 'elsewhere', ' install dir created' ); + %files = (); + find( sub { $files{$_} = $File::Find::name; }, 'elsewhere' ); + ok( $files{'Dummy.pm'}, ' Dummy.pm installed' ); + ok( $files{'Liar.pm'}, ' Liar.pm installed' ); + ok( $files{'program'}, ' program installed' ); + ok( $files{'.packlist'}, ' packlist created' ); + ok( $files{'perllocal.pod'},' perllocal.pod created' ); + rmtree('elsewhere'); +} + + +SKIP: { + skip 'VMS install targets do not preserve $(DESTDIR)', 11 if $Is_VMS; + + $install_out = run("$make install PREFIX= DESTDIR=other VERBINST=1"); + is( $?, 0, 'install with DESTDIR' ) || + diag $install_out; + like( $install_out, qr/^Installing /m ); + like( $install_out, qr/^Writing /m ); + + ok( -d 'other', ' destdir created' ); + %files = (); + my $perllocal; + find( sub { + $files{$_} = $File::Find::name; + }, 'other' ); + ok( $files{'Dummy.pm'}, ' Dummy.pm installed' ); + ok( $files{'Liar.pm'}, ' Liar.pm installed' ); + ok( $files{'program'}, ' program installed' ); + ok( $files{'.packlist'}, ' packlist created' ); + ok( $files{'perllocal.pod'},' perllocal.pod created' ); + + ok( open(PERLLOCAL, $files{'perllocal.pod'} ) ) || + diag("Can't open $files{'perllocal.pod'}: $!"); + { local $/; + unlike(<PERLLOCAL>, qr/other/, 'DESTDIR should not appear in perllocal'); + } + close PERLLOCAL; + +# TODO not available in the min version of Test::Harness we require +# ok( open(PACKLIST, $files{'.packlist'} ) ) || +# diag("Can't open $files{'.packlist'}: $!"); +# { local $/; +# local $TODO = 'DESTDIR still in .packlist'; +# unlike(<PACKLIST>, qr/other/, 'DESTDIR should not appear in .packlist'); +# } +# close PACKLIST; + + rmtree('other'); +} + + +SKIP: { + skip 'VMS install targets do not preserve $(PREFIX)', 10 if $Is_VMS; + + $install_out = run("$make install PREFIX=elsewhere DESTDIR=other/ VERBINST=1"); + is( $?, 0, 'install with PREFIX override and DESTDIR' ) || + diag $install_out; + like( $install_out, qr/^Installing /m ); + like( $install_out, qr/^Writing /m ); + + ok( !-d 'elsewhere', ' install dir not created' ); + ok( -d 'other/elsewhere', ' destdir created' ); + %files = (); + find( sub { $files{$_} = $File::Find::name; }, 'other/elsewhere' ); + ok( $files{'Dummy.pm'}, ' Dummy.pm installed' ); + ok( $files{'Liar.pm'}, ' Liar.pm installed' ); + ok( $files{'program'}, ' program installed' ); + ok( $files{'.packlist'}, ' packlist created' ); + ok( $files{'perllocal.pod'},' perllocal.pod created' ); + rmtree('other'); +} diff --git a/lib/ExtUtils/t/basic.t b/lib/ExtUtils/t/basic.t index b26b3e2..97e7d9c 100644 --- a/lib/ExtUtils/t/basic.t +++ b/lib/ExtUtils/t/basic.t @@ -13,322 +13,31 @@ BEGIN { } } -use strict; -use Config; -use ExtUtils::MakeMaker; +# The test logic is shared between MakeMaker and Install +# because in MakeMaker we test aspects that we are uninterested +# in with Install.pm, however MakeMaker needs to know if it +# accidentally breaks Install. So we have this two stage test file +# thing happening. + +# This version is distinct to MakeMaker and the core. + +use vars qw/$TESTS $TEST_INSTALL_ONLY/; +use Cwd qw(cwd); + +$::TESTS= 55 + 30; +$::TEST_INSTALL_ONLY= 0; + +(my $start=$0)=~s/\.t$/.pl/; +(my $finish=$start)=~s/\.pl$/_finish.pl/; +my $code; +for my $file ($start,$finish) { + open my $fh,$file or die "Failed to read: $file"; + $code .= do { + local $/; + <$fh>; + }; + close $fh; + $code .= "\n;\n"; +} +eval $code or die $@,$code; -use Test::More tests => 85; -use MakeMaker::Test::Utils; -use MakeMaker::Test::Setup::BFD; -use File::Find; -use File::Spec; -use File::Path; - -# 'make disttest' sets a bunch of environment variables which interfere -# with our testing. -delete @ENV{qw(PREFIX LIB MAKEFLAGS)}; - -my $perl = which_perl(); -my $Is_VMS = $^O eq 'VMS'; - -# GNV logical interferes with testing -$ENV{'bin'} = '[.bin]' if $Is_VMS; - -chdir 't'; - -perl_lib; - -my $Touch_Time = calibrate_mtime(); - -$| = 1; - -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: $!"); - -my @mpl_out = run(qq{$perl Makefile.PL "PREFIX=../dummy-install"}); -END { rmtree '../dummy-install'; } - -cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || - diag(@mpl_out); - -my $makefile = makefile_name(); -ok( grep(/^Writing $makefile for Big::Dummy/, - @mpl_out) == 1, - 'Makefile.PL output looks right'); - -ok( grep(/^Current package is: main$/, - @mpl_out) == 1, - 'Makefile.PL run in package main'); - -ok( -e $makefile, 'Makefile exists' ); - -# -M is flakey on VMS -my $mtime = (stat($makefile))[9]; -cmp_ok( $Touch_Time, '<=', $mtime, ' its been touched' ); - -END { unlink makefile_name(), makefile_backup() } - -my $make = make_run(); - -{ - # Supress 'make manifest' noise - local $ENV{PERL_MM_MANIFEST_VERBOSE} = 0; - my $manifest_out = run("$make manifest"); - ok( -e 'MANIFEST', 'make manifest created a MANIFEST' ); - ok( -s 'MANIFEST', ' its not empty' ); -} - -END { unlink 'MANIFEST'; } - - -my $ppd_out = run("$make ppd"); -is( $?, 0, ' exited normally' ) || diag $ppd_out; -ok( open(PPD, 'Big-Dummy.ppd'), ' .ppd file generated' ); -my $ppd_html; -{ local $/; $ppd_html = <PPD> } -close PPD; -like( $ppd_html, qr{^<SOFTPKG NAME="Big-Dummy" VERSION="0,01,0,0">}m, - ' <SOFTPKG>' ); -like( $ppd_html, qr{^\s*<TITLE>Big-Dummy}m, ' ' ); -like( $ppd_html, qr{^\s*<ABSTRACT>Try "our" hot dog's</ABSTRACT>}m, - ' <ABSTRACT>'); -like( $ppd_html, - qr{^\s*<AUTHOR>Michael G Schwern <schwern\@pobox.com></AUTHOR>}m, - ' <AUTHOR>' ); -like( $ppd_html, qr{^\s*<IMPLEMENTATION>}m, ' <IMPLEMENTATION>'); -like( $ppd_html, qr{^\s*<DEPENDENCY NAME="strict" VERSION="0,0,0,0" />}m, - ' <DEPENDENCY>' ); -like( $ppd_html, qr{^\s*<OS NAME="$Config{osname}" />}m, - ' <OS>' ); -my $archname = $Config{archname}; -$archname .= "-". substr($Config{version},0,3) if $] >= 5.008; -like( $ppd_html, qr{^\s*<ARCHITECTURE NAME="$archname" />}m, - ' <ARCHITECTURE>'); -like( $ppd_html, qr{^\s*<CODEBASE HREF="" />}m, ' <CODEBASE>'); -like( $ppd_html, qr{^\s*</IMPLEMENTATION>}m, ' </IMPLEMENTATION>'); -like( $ppd_html, qr{^\s*</SOFTPKG>}m, ' </SOFTPKG>'); -END { unlink 'Big-Dummy.ppd' } - - -my $test_out = run("$make test"); -like( $test_out, qr/All tests successful/, 'make test' ); -is( $?, 0, ' exited normally' ) || - diag $test_out; - -# Test 'make test TEST_VERBOSE=1' -my $make_test_verbose = make_macro($make, 'test', TEST_VERBOSE => 1); -$test_out = run("$make_test_verbose"); -like( $test_out, qr/ok \d+ - TEST_VERBOSE/, 'TEST_VERBOSE' ); -like( $test_out, qr/All tests successful/, ' successful' ); -is( $?, 0, ' exited normally' ) || - diag $test_out; - - -my $install_out = run("$make install"); -is( $?, 0, 'install' ) || diag $install_out; -like( $install_out, qr/^Installing /m ); -like( $install_out, qr/^Writing /m ); - -ok( -r '../dummy-install', ' install dir created' ); -my %files = (); -find( sub { - # do it case-insensitive for non-case preserving OSs - my $file = lc $_; - - # VMS likes to put dots on the end of things that don't have them. - $file =~ s/\.$// if $Is_VMS; - - $files{$file} = $File::Find::name; -}, '../dummy-install' ); -ok( $files{'dummy.pm'}, ' Dummy.pm installed' ); -ok( $files{'liar.pm'}, ' Liar.pm installed' ); -ok( $files{'program'}, ' program installed' ); -ok( $files{'.packlist'}, ' packlist created' ); -ok( $files{'perllocal.pod'},' perllocal.pod created' ); - - -SKIP: { - skip 'VMS install targets do not preserve $(PREFIX)', 9 if $Is_VMS; - - $install_out = run("$make install PREFIX=elsewhere"); - is( $?, 0, 'install with PREFIX override' ) || diag $install_out; - like( $install_out, qr/^Installing /m ); - like( $install_out, qr/^Writing /m ); - - ok( -r 'elsewhere', ' install dir created' ); - %files = (); - find( sub { $files{$_} = $File::Find::name; }, 'elsewhere' ); - ok( $files{'Dummy.pm'}, ' Dummy.pm installed' ); - ok( $files{'Liar.pm'}, ' Liar.pm installed' ); - ok( $files{'program'}, ' program installed' ); - ok( $files{'.packlist'}, ' packlist created' ); - ok( $files{'perllocal.pod'},' perllocal.pod created' ); - rmtree('elsewhere'); -} - - -SKIP: { - skip 'VMS install targets do not preserve $(DESTDIR)', 11 if $Is_VMS; - - $install_out = run("$make install PREFIX= DESTDIR=other"); - is( $?, 0, 'install with DESTDIR' ) || - diag $install_out; - like( $install_out, qr/^Installing /m ); - like( $install_out, qr/^Writing /m ); - - ok( -d 'other', ' destdir created' ); - %files = (); - my $perllocal; - find( sub { - $files{$_} = $File::Find::name; - }, 'other' ); - ok( $files{'Dummy.pm'}, ' Dummy.pm installed' ); - ok( $files{'Liar.pm'}, ' Liar.pm installed' ); - ok( $files{'program'}, ' program installed' ); - ok( $files{'.packlist'}, ' packlist created' ); - ok( $files{'perllocal.pod'},' perllocal.pod created' ); - - ok( open(PERLLOCAL, $files{'perllocal.pod'} ) ) || - diag("Can't open $files{'perllocal.pod'}: $!"); - { local $/; - unlike(<PERLLOCAL>, qr/other/, 'DESTDIR should not appear in perllocal'); - } - close PERLLOCAL; - -# TODO not available in the min version of Test::Harness we require -# ok( open(PACKLIST, $files{'.packlist'} ) ) || -# diag("Can't open $files{'.packlist'}: $!"); -# { local $/; -# local $TODO = 'DESTDIR still in .packlist'; -# unlike(<PACKLIST>, qr/other/, 'DESTDIR should not appear in .packlist'); -# } -# close PACKLIST; - - rmtree('other'); -} - - -SKIP: { - skip 'VMS install targets do not preserve $(PREFIX)', 10 if $Is_VMS; - - $install_out = run("$make install PREFIX=elsewhere DESTDIR=other/"); - is( $?, 0, 'install with PREFIX override and DESTDIR' ) || - diag $install_out; - like( $install_out, qr/^Installing /m ); - like( $install_out, qr/^Writing /m ); - - ok( !-d 'elsewhere', ' install dir not created' ); - ok( -d 'other/elsewhere', ' destdir created' ); - %files = (); - find( sub { $files{$_} = $File::Find::name; }, 'other/elsewhere' ); - ok( $files{'Dummy.pm'}, ' Dummy.pm installed' ); - ok( $files{'Liar.pm'}, ' Liar.pm installed' ); - ok( $files{'program'}, ' program installed' ); - ok( $files{'.packlist'}, ' packlist created' ); - ok( $files{'perllocal.pod'},' perllocal.pod created' ); - rmtree('other'); -} - - -my $dist_test_out = run("$make disttest"); -is( $?, 0, 'disttest' ) || diag($dist_test_out); - -# Test META.yml generation -use ExtUtils::Manifest qw(maniread); - -my $distdir = 'Big-Dummy-0.01'; -$distdir =~ s/\./_/g if $Is_VMS; -my $meta_yml = "$distdir/META.yml"; - -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' ); - -SKIP: { - # META.yml spec 1.4 was added in 0.11 - skip "Test::YAML::Meta >= 0.11 required", 2 - unless eval { require Test::YAML::Meta } and - Test::YAML::Meta->VERSION >= 0.11; - - Test::YAML::Meta::meta_spec_ok($meta_yml); -} - -ok open META, $meta_yml or diag $!; -my $meta = join '', <META>; -ok close META; - -is $meta, <<"END"; ---- #YAML:1.0 -name: Big-Dummy -version: 0.01 -abstract: Try "our" hot dog's -author: - - Michael G Schwern <schwern\@pobox.com> -license: unknown -distribution_type: module -configure_requires: - ExtUtils::MakeMaker: 0 -requires: - strict: 0 -no_index: - directory: - - 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 -END - -my $manifest = maniread("$distdir/MANIFEST"); -# VMS is non-case preserving, so we can't know what the MANIFEST will -# look like. :( -_normalize($manifest); -is( $manifest->{'meta.yml'}, 'Module meta-data (added by MakeMaker)' ); - - -# Test NO_META META.yml suppression -unlink $meta_yml; -ok( !-f $meta_yml, 'META.yml deleted' ); -@mpl_out = run(qq{$perl Makefile.PL "NO_META=1"}); -cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out); -my $distdir_out = run("$make distdir"); -is( $?, 0, 'distdir' ) || diag($distdir_out); -ok( !-f $meta_yml, 'META.yml generation suppressed by NO_META' ); - - -# Make sure init_dirscan doesn't go into the distdir -@mpl_out = run(qq{$perl Makefile.PL "PREFIX=../dummy-install"}); - -cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out); - -ok( grep(/^Writing $makefile for Big::Dummy/, @mpl_out) == 1, - 'init_dirscan skipped distdir') || - diag(@mpl_out); - -# I know we'll get ignored errors from make here, that's ok. -# Send STDERR off to oblivion. -open(SAVERR, ">&STDERR") or die $!; -open(STDERR, ">".File::Spec->devnull) or die $!; - -my $realclean_out = run("$make realclean"); -is( $?, 0, 'realclean' ) || diag($realclean_out); - -open(STDERR, ">&SAVERR") or die $!; -close SAVERR; - - -sub _normalize { - my $hash = shift; - - while(my($k,$v) = each %$hash) { - delete $hash->{$k}; - $hash->{lc $k} = $v; - } -} diff --git a/lib/ExtUtils/t/basic_finish.pl b/lib/ExtUtils/t/basic_finish.pl new file mode 100644 index 0000000..7cc4e8a --- /dev/null +++ b/lib/ExtUtils/t/basic_finish.pl @@ -0,0 +1,104 @@ +# *NOTE* This is executed by basic.t and is included in both ExtUtils-MakeMaker +# as well as Perlcore. Note also that it is expected to be executed in a do "FILE" +# immediately after basic.plt is executed (similarly). + +# It is NOT expected to be executed under ExtUtils-Install alone, and in fact is not +# distributed there, however it is expected to be executed under ExtUtils-MakeMaker +# and Perl itself. + +my $dist_test_out = run("$make disttest"); +is( $?, 0, 'disttest' ) || diag($dist_test_out); + +# Test META.yml generation +use ExtUtils::Manifest qw(maniread); + +my $distdir = 'Big-Dummy-0.01'; +$distdir =~ s/\./_/g if $Is_VMS; +my $meta_yml = "$distdir/META.yml"; + +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' ); + +SKIP: { + # META.yml spec 1.4 was added in 0.11 + skip "Test::YAML::Meta >= 0.11 required", 2 + unless eval { require Test::YAML::Meta } and + Test::YAML::Meta->VERSION >= 0.11; + + Test::YAML::Meta::meta_spec_ok($meta_yml); +} + +ok open META, $meta_yml or diag $!; +my $meta = join '', <META>; +ok close META; + +is $meta, <<"END"; +--- #YAML:1.0 +name: Big-Dummy +version: 0.01 +abstract: Try "our" hot dog's +author: + - Michael G Schwern <schwern\@pobox.com> +license: unknown +distribution_type: module +configure_requires: + ExtUtils::MakeMaker: 0 +requires: + strict: 0 +no_index: + directory: + - 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 +END + +my $manifest = maniread("$distdir/MANIFEST"); +# VMS is non-case preserving, so we can't know what the MANIFEST will +# look like. :( +_normalize($manifest); +is( $manifest->{'meta.yml'}, 'Module meta-data (added by MakeMaker)' ); + + +# Test NO_META META.yml suppression +unlink $meta_yml; +ok( !-f $meta_yml, 'META.yml deleted' ); +@mpl_out = run(qq{$perl Makefile.PL "NO_META=1"}); +cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out); +my $distdir_out = run("$make distdir"); +is( $?, 0, 'distdir' ) || diag($distdir_out); +ok( !-f $meta_yml, 'META.yml generation suppressed by NO_META' ); + + +# Make sure init_dirscan doesn't go into the distdir +@mpl_out = run(qq{$perl Makefile.PL "PREFIX=../dummy-install"}); + +cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out); + +ok( grep(/^Writing $makefile for Big::Dummy/, @mpl_out) == 1, + 'init_dirscan skipped distdir') || + diag(@mpl_out); + +# I know we'll get ignored errors from make here, that's ok. +# Send STDERR off to oblivion. +open(SAVERR, ">&STDERR") or die $!; +open(STDERR, ">".File::Spec->devnull) or die $!; + +my $realclean_out = run("$make realclean"); +is( $?, 0, 'realclean' ) || diag($realclean_out); + +open(STDERR, ">&SAVERR") or die $!; +close SAVERR; + + +sub _normalize { + my $hash = shift; + + while(my($k,$v) = each %$hash) { + delete $hash->{$k}; + $hash->{lc $k} = $v; + } +}