diff options
author | 2009-10-12 18:10:27 +0000 | |
---|---|---|
committer | 2009-10-12 18:10:27 +0000 | |
commit | 43003dfe3ad45d1698bed8a37f2b0f5b14f20d4f (patch) | |
tree | 1abc677556fd1cb82189030802130c0f670a32d9 /gnu/usr.bin/perl/lib/ExtUtils | |
parent | More inodes by default on the ramdisk, because otherwise a many-disk (diff) | |
download | wireguard-openbsd-43003dfe3ad45d1698bed8a37f2b0f5b14f20d4f.tar.xz wireguard-openbsd-43003dfe3ad45d1698bed8a37f2b0f5b14f20d4f.zip |
import perl 5.10.1
Diffstat (limited to 'gnu/usr.bin/perl/lib/ExtUtils')
85 files changed, 4247 insertions, 519 deletions
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/CBuilder.pm b/gnu/usr.bin/perl/lib/ExtUtils/CBuilder.pm index fae01b116dd..eb859ae409e 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/CBuilder.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/CBuilder.pm @@ -5,7 +5,7 @@ use File::Path (); use File::Basename (); use vars qw($VERSION @ISA); -$VERSION = '0.21'; +$VERSION = '0.2602'; $VERSION = eval $VERSION; # Okay, this is the brute-force method of finding out what kind of @@ -36,6 +36,9 @@ my %OSTYPES = qw( sunos Unix cygwin Unix os2 Unix + gnu Unix + gnukfreebsd Unix + haiku Unix dos Windows MSWin32 Windows @@ -127,7 +130,8 @@ commands before executing them: Returns true if the current system has a working C compiler and linker, false otherwise. To determine this, we actually compile and -link a sample C library. +link a sample C library. The sample will be compiled in the system +tempdir or, if that fails for some reason, in the current directory. =item compile diff --git a/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Base.pm b/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Base.pm index 0c08ab71b73..1184953183e 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Base.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Base.pm @@ -6,9 +6,10 @@ use File::Basename; use Cwd (); use Config; use Text::ParseWords; +use IO::File; use vars qw($VERSION); -$VERSION = '0.21'; +$VERSION = '0.2602'; sub new { my $class = shift; @@ -115,27 +116,40 @@ sub compile { sub have_compiler { my ($self) = @_; return $self->{have_compiler} if defined $self->{have_compiler}; - - my $tmpfile = File::Spec->catfile(File::Spec->tmpdir, 'compilet.c'); - { - local *FH; - open FH, "> $tmpfile" or die "Can't create $tmpfile: $!"; - print FH "int boot_compilet() { return 1; }\n"; - close FH; - } - my ($obj_file, @lib_files); - eval { - $obj_file = $self->compile(source => $tmpfile); - @lib_files = $self->link(objects => $obj_file, module_name => 'compilet'); - }; - warn $@ if $@; - my $result = $self->{have_compiler} = $@ ? 0 : 1; - - foreach (grep defined, $tmpfile, $obj_file, @lib_files) { - 1 while unlink; + my $result; + my $attempts = 3; + # tmpdir has issues for some people so fall back to current dir + DIR: for my $dir ( File::Spec->tmpdir, '.' ) { + + # don't clobber existing files (rare, but possible) + my $rand = int(rand(2**31)); + my $tmpfile = File::Spec->catfile($dir, "compilet-$rand.c"); + if ( -e $tmpfile ) { + redo DIR if $attempts--; + next DIR; + } + + { + my $FH = IO::File->new("> $tmpfile") or die "Can't create $tmpfile: $!"; + print $FH "int boot_compilet() { return 1; }\n"; + } + + my ($obj_file, @lib_files); + eval { + local $^W = 0; + $obj_file = $self->compile(source => $tmpfile); + @lib_files = $self->link(objects => $obj_file, module_name => 'compilet'); + }; + $result = $@ ? 0 : 1; + + foreach (grep defined, $tmpfile, $obj_file, @lib_files) { + 1 while unlink; + } + last DIR if $result; } - return $result; + + return $self->{have_compiler} = $result; } sub lib_file { diff --git a/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Changes b/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Changes index fbf6f4a1200..2e011eed39a 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Changes +++ b/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Changes @@ -1,5 +1,77 @@ Revision history for Perl extension ExtUtils::CBuilder. +0.2602 - Sat Jul 4 10:57:12 EDT 2009 + + Bugs fixed: + - Fixed 00-have-compiler.t if $^X is a relative path [David Wheeler] + +0.2601 - Wed Jul 1 09:37:39 EDT 2009 + + Bugs fixed: + - On VMS, cleans up extra files generated during testing + [John E. Malmberg, Craig Berry] + +0.26 - Mon Jun 29 20:11:52 EDT 2009 + + - No changes from 0.25_01 + +0.25_01 - Sat Jun 27 23:13:20 EDT 2009 + + - Changed test library to Test::More + + - Added tests for have_compiler + + - Skips tests that need a compiler if have_compiler is false + + - have_compiler will try to compile in the current directory + if compiling in tmpdir fails for whatever reason + +0.25 - Fri Jun 26 16:18:13 EDT 2009 + + - Slight diagnostic improvements in link.t + +0.24_01 - Sun Mar 8 14:50:10 2009 + + - On Windows, don't generate "mt" command when CRT is statically + linked. [Jan Dubois] + + - On Cygwin, examine $Config{useshrplib} to see whether we're + supposed to be linking with a shared perl library or not. [Reini + Urban] + + - In link_executable() on Cygwin, trust $Config{ld} rather than using + $Config{cc} for linking. [Reini Urban] + + - Add 'haiku' as a Unix-like platform. [Ingo Weinhold] + +0.24 - Fri Aug 15 22:01:48 2008 + + - Added 'gnu' and 'gnukfreebsd' as Unix variants. [Niko Tyni] + + - Brought in some VMS fixes from bleadperl: "Correct and complete + CBuilder's handling of external libraries when linking on VMS." + [Craig Berry] + +0.23 - Sat Apr 19 22:28:03 2008 + + - Fixed some problems (some old, some new) with Strawberry Perl on + Windows. [Alberto Simo~es] + + - Will now install in the core perl lib directory when the user's + perl is new enough to have us in core. [Yi Ma Mao] + +0.22 - Fri Feb 8 21:52:21 2008 + + - Replaced the split_like_shell() method on Windows with a + near-no-op, which is probably more correct and has the benefit of + not messing up UNC paths. [John R. LoVerso, see + http://rt.cpan.org/Ticket/Display.html?id=26545] + + - Fixed extra_compiler_flags on Windows, they were being + ignored. [Robert May] + +0.21 - Tue Oct 30 06:46:01 2007 + - Clean up perl_src path using Cwd::realpath(). Only affects usage as part of the perl core. diff --git a/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/Unix.pm b/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/Unix.pm index 3fa73788c0c..8672e3ef885 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/Unix.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/Unix.pm @@ -4,12 +4,15 @@ use strict; use ExtUtils::CBuilder::Base; use vars qw($VERSION @ISA); -$VERSION = '0.21'; +$VERSION = '0.2602'; @ISA = qw(ExtUtils::CBuilder::Base); sub link_executable { my $self = shift; - # $Config{cc} is usually a better bet for linking executables than $Config{ld} + + # On some platforms (which ones??) $Config{cc} seems to be a better + # bet for linking executables than $Config{ld}. Cygwin is a notable + # exception. local $self->{config}{ld} = $self->{config}{cc} . " " . $self->{config}{ldflags}; return $self->SUPER::link_executable(@_); diff --git a/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/VMS.pm b/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/VMS.pm index ab22cb23acc..97434a39305 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/VMS.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/VMS.pm @@ -4,7 +4,7 @@ use strict; use ExtUtils::CBuilder::Base; use vars qw($VERSION @ISA); -$VERSION = '0.22'; +$VERSION = '0.2602'; @ISA = qw(ExtUtils::CBuilder::Base); use File::Spec::Functions qw(catfile catdir); @@ -134,7 +134,7 @@ sub _liblist_ext { # In general, we pass through the basic libraries from %Config unchanged. # The one exception is that if we're building in the Perl source tree, and # a library spec could be resolved via a logical name, we go to some trouble - # to insure that the copy in the local tree is used, rather than one to + # to ensure that the copy in the local tree is used, rather than one to # which a system-wide logical may point. if ($self->perl_src) { my($lib,$locspec,$type); diff --git a/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/Windows.pm b/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/Windows.pm index 7b74ae0d99a..73d53ae874b 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/Windows.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/Windows.pm @@ -7,9 +7,10 @@ use File::Basename; use File::Spec; use ExtUtils::CBuilder::Base; +use IO::File; use vars qw($VERSION @ISA); -$VERSION = '0.21'; +$VERSION = '0.2602'; @ISA = qw(ExtUtils::CBuilder::Base); sub new { @@ -33,61 +34,24 @@ sub _compiler_type { } sub split_like_shell { - # As it turns out, Windows command-parsing is very different from - # Unix command-parsing. Double-quotes mean different things, - # backslashes don't necessarily mean escapes, and so on. So we - # can't use Text::ParseWords::shellwords() to break a command string - # into words. The algorithm below was bashed out by Randy and Ken - # (mostly Randy), and there are a lot of regression tests, so we - # should feel free to adjust if desired. - + # Since Windows will pass the whole command string (not an argument + # array) to the target program and make the program parse it itself, + # we don't actually need to do any processing here. (my $self, local $_) = @_; return @$_ if defined() && UNIVERSAL::isa($_, 'ARRAY'); - - my @argv; - return @argv unless defined() && length(); - - my $arg = ''; - my( $i, $quote_mode ) = ( 0, 0 ); - - while ( $i < length() ) { - - my $ch = substr( $_, $i , 1 ); - my $next_ch = substr( $_, $i+1, 1 ); - - if ( $ch eq '\\' && $next_ch eq '"' ) { - $arg .= '"'; - $i++; - } elsif ( $ch eq '\\' && $next_ch eq '\\' ) { - $arg .= '\\'; - $i++; - } elsif ( $ch eq '"' && $next_ch eq '"' && $quote_mode ) { - $quote_mode = !$quote_mode; - $arg .= '"'; - $i++; - } elsif ( $ch eq '"' && $next_ch eq '"' && !$quote_mode && - ( $i + 2 == length() || - substr( $_, $i + 2, 1 ) eq ' ' ) - ) { # for cases like: a"" => [ 'a' ] - push( @argv, $arg ); - $arg = ''; - $i += 2; - } elsif ( $ch eq '"' ) { - $quote_mode = !$quote_mode; - } elsif ( $ch eq ' ' && !$quote_mode ) { - push( @argv, $arg ) if $arg; - $arg = ''; - ++$i while substr( $_, $i + 1, 1 ) eq ' '; - } else { - $arg .= $ch; - } - - $i++; - } - - push( @argv, $arg ) if defined( $arg ) && length( $arg ); - return @argv; + return unless defined() && length(); + return ($_); +} + +sub do_system { + # See above + my $self = shift; + my $cmd = join(" ", + grep length, + map {$a=$_;$a=~s/\t/ /g;$a=~s/^\s+|\s+$//;$a} + grep defined, @_); + return $self->SUPER::do_system($cmd); } sub arg_defines { @@ -119,7 +83,7 @@ sub compile { cflags => [ $self->split_like_shell($cf->{ccflags}), $self->split_like_shell($cf->{cccdlflags}), - $self->split_like_shell($cf->{extra_compiler_flags}), + $self->split_like_shell($args{extra_compiler_flags}), ], optimize => [ $self->split_like_shell($cf->{optimize}) ], defines => \@defines, @@ -329,18 +293,16 @@ sub write_compiler_script { $self->add_to_cleanup($script); print "Generating script '$script'\n" if !$self->{quiet}; - open( SCRIPT, ">$script" ) + my $SCRIPT = IO::File->new( ">$script" ) or die( "Could not create script '$script': $!" ); - print SCRIPT join( "\n", + print $SCRIPT join( "\n", map { ref $_ ? @{$_} : $_ } grep defined, delete( @spec{ qw(includes cflags optimize defines perlinc) } ) ); - close SCRIPT; - push @{$spec{includes}}, '@"' . $script . '"'; return %spec; @@ -385,7 +347,7 @@ sub format_linker_cmd { # Embed the manifest file for VC 2005 (aka VC 8) or higher, but not for the 64-bit Platform SDK compiler if ($cf->{ivsize} == 4 && $cf->{cc} eq 'cl' and $cf->{ccversion} =~ /^(\d+)/ and $1 >= 14) { push @cmds, [ - 'mt', '-nologo', $spec{manifest}, '-outputresource:' . "$output;2" + 'if', 'exist', $spec{manifest}, 'mt', '-nologo', $spec{manifest}, '-outputresource:' . "$output;2" ]; } @@ -402,10 +364,10 @@ sub write_linker_script { print "Generating script '$script'\n" if !$self->{quiet}; - open( SCRIPT, ">$script" ) + my $SCRIPT = IO::File->new( ">$script" ) or die( "Could not create script '$script': $!" ); - print SCRIPT join( "\n", + print $SCRIPT join( "\n", map { ref $_ ? @{$_} : $_ } grep defined, delete( @@ -414,8 +376,6 @@ sub write_linker_script { def_file implib map_file) } ) ); - close SCRIPT; - push @{$spec{lddlflags}}, '@"' . $script . '"'; return %spec; @@ -459,7 +419,7 @@ sub write_compiler_script { print "Generating script '$script'\n" if !$self->{quiet}; - open( SCRIPT, ">$script" ) + my $SCRIPT = IO::File->new( ">$script" ) or die( "Could not create script '$script': $!" ); # XXX Borland "response files" seem to be unable to accept macro @@ -467,15 +427,13 @@ sub write_compiler_script { # backslash doesn't work, and any level of quotes are stripped. The # result is is a floating point number in the source file where a # string is expected. So we leave the macros on the command line. - print SCRIPT join( "\n", + print $SCRIPT join( "\n", map { ref $_ ? @{$_} : $_ } grep defined, delete( @spec{ qw(includes cflags optimize perlinc) } ) ); - close SCRIPT; - push @{$spec{includes}}, '@"' . $script . '"'; return %spec; @@ -525,29 +483,25 @@ sub write_linker_script { print "Generating scripts '$ld_script' and '$ld_libs'.\n" if !$self->{quiet}; # Script 1: contains options & names of object files. - open( LD_SCRIPT, ">$ld_script" ) + my $LD_SCRIPT = IO::File->new( ">$ld_script" ) or die( "Could not create linker script '$ld_script': $!" ); - print LD_SCRIPT join( " +\n", + print $LD_SCRIPT join( " +\n", map { @{$_} } grep defined, delete( @spec{ qw(lddlflags libpath other_ldflags startup objects) } ) ); - close LD_SCRIPT; - # Script 2: contains name of libs to link against. - open( LD_LIBS, ">$ld_libs" ) + my $LD_LIBS = IO::File->new( ">$ld_libs" ) or die( "Could not create linker script '$ld_libs': $!" ); - print LD_LIBS join( " +\n", + print $LD_LIBS join( " +\n", (delete $spec{libperl} || ''), @{delete $spec{perllibs} || []}, ); - close LD_LIBS; - push @{$spec{lddlflags}}, '@"' . $ld_script . '"'; push @{$spec{perllibs}}, '@"' . $ld_libs . '"'; @@ -669,32 +623,30 @@ sub write_linker_script { print "Generating script '$script'\n" if !$self->{quiet}; - open( SCRIPT, ">$script" ) + my $SCRIPT = IO::File->new( ">$script" ) or die( "Could not create script '$script': $!" ); - print( SCRIPT 'SEARCH_DIR(' . $_ . ")\n" ) + print $SCRIPT ( 'SEARCH_DIR(' . $_ . ")\n" ) for @{delete $spec{libpath} || []}; # gcc takes only one startup file, so the first object in startup is # specified as the startup file and any others are shifted into the # beginning of the list of objects. if ( $spec{startup} && @{$spec{startup}} ) { - print SCRIPT 'STARTUP(' . shift( @{$spec{startup}} ) . ")\n"; + print $SCRIPT 'STARTUP(' . shift( @{$spec{startup}} ) . ")\n"; unshift @{$spec{objects}}, @{delete $spec{startup} || []}; } - print SCRIPT 'INPUT(' . join( ',', + print $SCRIPT 'INPUT(' . join( ',', @{delete $spec{objects} || []} ) . ")\n"; - print SCRIPT 'INPUT(' . join( ' ', + print $SCRIPT 'INPUT(' . join( ' ', (delete $spec{libperl} || ''), @{delete $spec{perllibs} || []}, ) . ")\n"; - close SCRIPT; - push @{$spec{other_ldflags}}, '"' . $script . '"'; return %spec; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/aix.pm b/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/aix.pm index 6ad2a6842f0..011ef811406 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/aix.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/aix.pm @@ -5,7 +5,7 @@ use ExtUtils::CBuilder::Platform::Unix; use File::Spec; use vars qw($VERSION @ISA); -$VERSION = '0.21'; +$VERSION = '0.2602'; @ISA = qw(ExtUtils::CBuilder::Platform::Unix); sub need_prelink { 1 } diff --git a/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/cygwin.pm b/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/cygwin.pm index 623fe0a30c2..7f996dc5be6 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/cygwin.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/cygwin.pm @@ -5,22 +5,22 @@ use File::Spec; use ExtUtils::CBuilder::Platform::Unix; use vars qw($VERSION @ISA); -$VERSION = '0.21'; +$VERSION = '0.2602'; @ISA = qw(ExtUtils::CBuilder::Platform::Unix); sub link_executable { my $self = shift; - # $Config{ld} is set up as a special script for building - # perl-linkable libraries. We don't want that here. - local $self->{config}{ld} = 'gcc'; + # $Config{ld} is okay. Circumvent the Unix ld=cc override in the superclass. + local $self->{config}{cc} = $self->{config}{ld}; return $self->SUPER::link_executable(@_); } sub link { my ($self, %args) = @_; + my $lib = $self->{config}{useshrplib} ? 'libperl.dll.a' : 'libperl.a'; $args{extra_linker_flags} = [ - File::Spec->catdir($self->perl_inc(), 'libperl.dll.a'), + File::Spec->catfile($self->perl_inc(), $lib), $self->split_like_shell($args{extra_linker_flags}) ]; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/darwin.pm b/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/darwin.pm index 3b0cfb4c596..45c03a8f58b 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/darwin.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/darwin.pm @@ -4,7 +4,7 @@ use strict; use ExtUtils::CBuilder::Platform::Unix; use vars qw($VERSION @ISA); -$VERSION = '0.21'; +$VERSION = '0.2602'; @ISA = qw(ExtUtils::CBuilder::Platform::Unix); sub compile { diff --git a/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/dec_osf.pm b/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/dec_osf.pm index cb7a9e3da5d..65344f25555 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/dec_osf.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/dec_osf.pm @@ -6,7 +6,7 @@ use File::Spec; use vars qw($VERSION @ISA); @ISA = qw(ExtUtils::CBuilder::Platform::Unix); -$VERSION = '0.21'; +$VERSION = '0.2602'; sub link_executable { my $self = shift; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/os2.pm b/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/os2.pm index 4657c593ab2..16648901b20 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/os2.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/os2.pm @@ -4,7 +4,7 @@ use strict; use ExtUtils::CBuilder::Platform::Unix; use vars qw($VERSION @ISA); -$VERSION = '0.21'; +$VERSION = '0.2602'; @ISA = qw(ExtUtils::CBuilder::Platform::Unix); sub need_prelink { 1 } diff --git a/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/t/00-have-compiler.t b/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/t/00-have-compiler.t new file mode 100755 index 00000000000..cf62e97f2f5 --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/t/00-have-compiler.t @@ -0,0 +1,43 @@ +#! perl -w + +use File::Spec; +my $perl; +BEGIN { + $perl = File::Spec->rel2abs($^X); + if ($ENV{PERL_CORE}) { + chdir 't' if -d 't'; + chdir '../lib/ExtUtils/CBuilder' + or die "Can't chdir to lib/ExtUtils/CBuilder: $!"; + @INC = qw(../..); + } +} + +use strict; +use Test::More; +BEGIN { + if ($^O eq 'VMS') { + # So we can get the return value of system() + require vmsish; + import vmsish; + } +} + +plan tests => 4; + +require_ok "ExtUtils::CBuilder"; + +my $b = eval { ExtUtils::CBuilder->new(quiet => 1) }; +ok( $b, "got CBuilder object" ) or diag $@; + +# test missing compiler +$b->{config}{cc} = 'djaadjfkadjkfajdf'; +$b->{config}{ld} = 'djaadjfkadjkfajdf'; +is( $b->have_compiler, 0, "have_compiler: fake missing cc" ); + +# test found compiler +$b->{have_compiler} = undef; +$b->{config}{cc} = "$perl -e1 --"; +$b->{config}{ld} = "$perl -e1 --"; +is( $b->have_compiler, 1, "have_compiler: fake present cc" ); + + diff --git a/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/t/01-basic.t b/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/t/01-basic.t index 9f14e8f0a7d..79a0b0c0eb8 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/t/01-basic.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/t/01-basic.t @@ -10,49 +10,72 @@ BEGIN { } use strict; -use Test; -BEGIN { plan tests => 11 } - +use Test::More; +BEGIN { + if ($^O eq 'VMS') { + # So we can get the return value of system() + require vmsish; + import vmsish; + } +} use ExtUtils::CBuilder; use File::Spec; -ok 1; # TEST doesn't like extraneous output my $quiet = $ENV{PERL_CORE} && !$ENV{HARNESS_ACTIVE}; +my ($source_file, $object_file, $lib_file); my $b = ExtUtils::CBuilder->new(quiet => $quiet); -ok $b; -ok $b->have_compiler; +# test plan +if ( ! $b->have_compiler ) { + plan skip_all => "no compiler available for testing"; +} +else { + plan tests => 10; +} + +ok $b, "created EU::CB object"; + +ok $b->have_compiler, "have_compiler"; -my $source_file = File::Spec->catfile('t', 'compilet.c'); +$source_file = File::Spec->catfile('t', 'compilet.c'); { local *FH; open FH, "> $source_file" or die "Can't create $source_file: $!"; print FH "int boot_compilet(void) { return 1; }\n"; close FH; } -ok -e $source_file; +ok -e $source_file, "source file '$source_file' created"; -my $object_file = $b->object_file($source_file); +$object_file = $b->object_file($source_file); ok 1; -ok $object_file, $b->compile(source => $source_file); +is $object_file, $b->compile(source => $source_file); -my $lib_file = $b->lib_file($object_file); +$lib_file = $b->lib_file($object_file); ok 1; my ($lib, @temps) = $b->link(objects => $object_file, module_name => 'compilet'); $lib =~ tr/"'//d; -ok $lib_file, $lib; +is $lib_file, $lib; for ($source_file, $object_file, $lib_file) { tr/"'//d; 1 while unlink; } +if ($^O eq 'VMS') { + 1 while unlink 'COMPILET.LIS'; + 1 while unlink 'COMPILET.OPT'; +} + my @words = $b->split_like_shell(' foo bar'); -ok @words, 2; -ok $words[0], 'foo'; -ok $words[1], 'bar'; + +SKIP: { + skip "MSWindows", 3 if $^O =~ m/MSWin/; + is( @words, 2 ); + is( $words[0], 'foo' ); + is( $words[1], 'bar' ); +} diff --git a/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/t/02-link.t b/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/t/02-link.t index 30ecbe5d3b2..c748d3b75ad 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/t/02-link.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/t/02-link.t @@ -10,57 +10,74 @@ BEGIN { } use strict; -use Test; +use Test::More; BEGIN { - if ($^O eq 'MSWin32') { - print "1..0 # Skipped: link_executable() is not implemented yet on Win32\n"; - exit; - } if ($^O eq 'VMS') { # So we can get the return value of system() require vmsish; import vmsish; } - plan tests => 5; } - use ExtUtils::CBuilder; use File::Spec; # TEST doesn't like extraneous output my $quiet = $ENV{PERL_CORE} && !$ENV{HARNESS_ACTIVE}; +my ($source_file, $object_file, $exe_file); my $b = ExtUtils::CBuilder->new(quiet => $quiet); -ok $b; -my $source_file = File::Spec->catfile('t', 'compilet.c'); +# test plan +if ($^O eq 'MSWin32') { + plan skip_all => "link_executable() is not implemented yet on Win32"; +} +elsif ( ! $b->have_compiler ) { + plan skip_all => "no compiler available for testing"; +} +else { + plan tests => 7; +} + +ok $b, "created EU::CB object"; + +$source_file = File::Spec->catfile('t', 'compilet.c'); { local *FH; open FH, "> $source_file" or die "Can't create $source_file: $!"; print FH "int main(void) { return 11; }\n"; close FH; } -ok -e $source_file; +ok -e $source_file, "generated '$source_file'"; # Compile -my $object_file; -ok $object_file = $b->compile(source => $source_file); +eval { $object_file = $b->compile(source => $source_file) }; +is $@, q{}, "no exception from compilation"; +ok -e $object_file, "found object file"; # Link -my ($exe_file, @temps); -($exe_file, @temps) = $b->link_executable(objects => $object_file); -ok $exe_file; +SKIP: { + skip "error compiling source", 3 + unless -e $object_file; -if ($^O eq 'os2') { # Analogue of LDLOADPATH... - # Actually, not needed now, since we do not link with the generated DLL - my $old = OS2::extLibpath(); # [builtin function] - $old = ";$old" if defined $old and length $old; - # To pass the sanity check, components must have backslashes... - OS2::extLibpath_set(".\\$old"); -} + my @temps; + eval { ($exe_file, @temps) = $b->link_executable(objects => $object_file) }; + is $@, q{}, "no exception from linking"; + ok -e $exe_file, "found executable file"; + + if ($^O eq 'os2') { # Analogue of LDLOADPATH... + # Actually, not needed now, since we do not link with the generated DLL + my $old = OS2::extLibpath(); # [builtin function] + $old = ";$old" if defined $old and length $old; + # To pass the sanity check, components must have backslashes... + OS2::extLibpath_set(".\\$old"); + } -# Try the executable -ok my_system($exe_file), 11; + # Try the executable + my $ec = my_system($exe_file); + is $ec, 11, "got expected exit code from executable" + or print( $? == -1 ? "# Could not run '$exe_file'\n" + : "# Unexpected exit code '$ec'\n"); +} # Clean up for ($source_file, $object_file, $exe_file) { @@ -68,6 +85,11 @@ for ($source_file, $object_file, $exe_file) { 1 while unlink; } +if ($^O eq 'VMS') { + 1 while unlink 'COMPILET.LIS'; + 1 while unlink 'COMPILET.OPT'; +} + sub my_system { my $cmd = shift; if ($^O eq 'VMS') { diff --git a/gnu/usr.bin/perl/lib/ExtUtils/Changes b/gnu/usr.bin/perl/lib/ExtUtils/Changes index c4c37c80a39..2943c53417f 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/Changes +++ b/gnu/usr.bin/perl/lib/ExtUtils/Changes @@ -1,3 +1,324 @@ +6.55_02 Wed Aug 5 00:36:36 PDT 2009 + Feature Changes + * PREFIX now applies to relative directories. This is a change since + 6.20 when they were ignored. Its necessary for relocatable Perls. + + VMS + * Refactoring of "MakeMaker Parameters" section in 6.55_01 broke VMS. + (Craig Berry) + + +6.55_01 Tue Jul 14 15:53:30 PDT 2009 + Test Fixes + * The tests got a bit overzealous and removed the LIB environment variable + while is necessary for some compilers to work. [rt.cpan.org 47722] + (Jan Dubois) + * Another fix for arch_check() on Windows changing how we normalize + long and short filenames. [rt.cpan.org 47723] (Jan Dubois) + + New Features + * BUILD_REQUIRES is added, similar to PREREQ_PM but for modules which + are necessary to build, but not run, your module. (Alexandr Ciornii) + + +6.54 Tue Jul 7 16:48:22 PDT 2009 + Test Fixes + * Added perl core boilerplate code to a few new tests which were missing + them. + + +6.53_03 Thu Jul 2 14:47:45 PDT 2009 + Bug Fixes + * You'd get a warning if you had a PREREQ_PM on a module with no $VERSION + like Config (broken in 6.51_01) [rt.cpan.org 47448] + + Test Fixes + * Upgrade the version of Test::More we ship with to 0.88. + * Fix MM_Cygwin.t for older Perls missing Cygwin::win_to_posix_path() + broken in 6.53_01. + * Fix miniperl.t for Windows. Our method of shutting off XS didn't + work for Win32.pm + * Old versions of version.pm, like what ships with OS X, dent Foo->VERSION + causing prereq.t to fail. [rt.cpan.org 47296] + * Add missing core test boilerplates + [blead e39d780342f3e91579069fdc80eda72bfe639ae7] + + +6.53_02 Sun Jun 7 19:24:56 PDT 2009 + Test Fixes + * Stray use of Shell::Command broke older perls + + Other + * MakeMaker will now automatically test itself with multiple + perl versions before releasing. + + +6.53_01 Sun Jun 7 19:02:20 PDT 2009 + Bug Fixes + * blib will now be rebuilt if the Makefile is changed + [rt.cpan.org 46658] + * 6.52 broke the setting of EXTRALIBS, LDLOADLIBS and BSLOADLIBS + when $self->{LIBS}[0] is undefined. + [rt.cpan.org 46633] (Craig Berry) + + Cygwin + * Fixed MM_Cygwin.t when the path prefix (ie. cygdrive) has been + changed by the user. [rt.cpan.org 46585] (JDHEDDEN) + + VMS + * Removed attempts to compensate for the "bin" logical added + by some versions of GNV, Craig says they're futile. + Put a warning into the Makefile.PL instead. + [rt.cpan.org 46679] (Craig Berry) + * Removed the arch_check() special case for VMS. + [rt.cpan.org 46678] (Craig Berry) + + Win32 + * Restore building the core by not trying to load the Win32 + module in arch_check() with miniperl. + [rt.cpan.org 46667] (Max Maischein) + + Tests + * Forgot to get rid of the tests for bytes and vmsish + which were removed in 6.51_01. + * Stopped running a Windows specific arch_check.t test + on non-Windows. (Craig Berry) + [rt.cpan.org 46678] + + +6.52 Sat May 30 11:22:04 PDT 2009 + Docs + * Documented CONFIGURE_REQUIRES (Alexandr Ciornii) + * Modernized the docs for PREREQ_PM + + +6.51_04 Sun May 24 14:04:11 PDT 2009 + Other + * All work on INSTALLHTML* has been reverted pending a fix for + [rt.cpan.org 45600] + + +6.51_03 Sat May 23 22:38:26 PDT 2009 + Bug Fixes + * Building *.C files was broken in 6.37. [rt.cpan.org 45557] + Thanks to Rajesh Mandalemula for spotting it. + New Features + * Optional parameter CONFIGURE_REQUIRES was added, to control + this section in META.yml (Alexandr Ciornii) + + +6.51_02 Mon Apr 13 21:19:56 PDT 2009 + Bug Fixes + * Fix a minor bug with the new PERM_DIR stuff which caused EUI to think + PERM_DIR was an install skip file. + * A Win32 function call in the last alpha broke Win32 builds. + + +6.51_01 Fri Apr 10 14:30:27 PDT 2009 + New Features + * Module installation will not be stopped by a broken Pod::Man. + Man pages will just not be installed. + [rt.cpan.org 43546] (Jesse Vincent) + * vim swap files, *.swp, will now be ignored by MakeMaker. + * Added PERM_DIR to control permissions on directories. + [rt.cpan.org 3927] (Rajesh Mandalemula) + + Feature Changes + * Modules in PREREQ_PM are no longer loaded in order to figure out + their version. parse_version() is used instead. + [rt.cpan.org 44646] + * PPD files generated with "make ppd" now use the new REQUIRES key + rather than the now deprecated DEPENDENCY. + [rt.cpan.org 25179] (GAAS) + * PPD files no longer contain the deprecated OS tag. + * fixin is a bit less restrictive allowing things like + #!perl5.8.8 and #!perl-debug [rt.cpan.org 29442] + * Remove the unused perm_rw() and perm_rwx() methods. + + Bug Fixes + * On 5.10 "make ppd" would generate the wrong ARCHITECTURE saying the + version is 5.1 instead of 5.10. + * Our pod2man emulation now requires an argument to --perm_rw. + [rt.cpan.org 35190] (imacat) + * DISTVNAME was documented as a WriteMakefile() param but you'd + get a warning if you tried to use it. [rt.cpan.org 43217] + * Better support for parallel make installs. + [rt.cpan.org 32758] (Brendan O'Dea) + * parse_version() will now skip uses of $VERSION in conditions + [rt.cpan.org 9452] (jc@unser.net) + * The architecture mismatch warning could show up on Win32 due + to long vs short filenames being used to compare. + [rt.cpan.org 33532] (DAGOLDEN) + * maybe_command() will recognize Windows executables in + /cygdrive on Cygwin [rt.cpan.org 16375] (PJF) + * parse_version() will now look for the first use of $VERSION + that results in $VERSION being set. + + Test Fixes + * basic.t will not leave a "bin" environment variable defined on VMS. + [rt.cpan.org 42150] (John E. Malmberg) + * Made the tests work ok on systems whose makes assume that files which + have the same mod time are out of date. This is often the case for + the tests which generate files and run make rapidly. + [rt.cpan.org 29955] (Ken Hirsch) + * skip test numbers were wrong on VMS in t/basic.t + [rt.cpan.org 43511] (John E. Malmberg) + + Portability + * Removed a few hard coded uses of the "false" command. + [rt.cpan.org 44504] + + VMS + * Fixed a few calls to catfile() that should be catdir(). + (John E. Malmberg) + * Override catdir() and catfile() to expand macros. This is normally done + inside File::Spec::VMS but is really a MakeMaker-only thing. + (John E. Malmberg) + + Other + * Remove ExtUtils::MakeMaker::bytes and vmsish which are unused and + seem to never have been used. + * Repository now on github. + + +6.50 Sun Mar 22 12:28:06 PDT 2009 + Windows + * Remove the special checks for compilers that need a "manifest". Instead, + the code will just be a no-op if there's no manifest. Or something. + I dunno, I'm hoping Jan and Steve know what they're doing. + [rt.perl.org 61492] + + +6.49_01 Thu Feb 19 17:06:36 PST 2009 + New OS Support + * Recognize "Haiku", a resurrection of BeOS. + + New Features + - META.yml now includes ExtUtils::MakeMaker in build_requires by + default. + + Test Fixes + - ExtUtils::Install 1.51 changed its output breaking some tests that + were looking for /^Writing/ [rt.cpan.org 42927] + + Bug Fixes + - Upgrade bundled modules: ExtUtils::Install 1.52, ExtUtils::Command + 1.16, ExtUtils::Manifest 1.56. + + Other + - The MakeMaker repository moved slightly. Changed the metadata to + reflect this. [rt.cpan.org 41571] + + +6.48 Mon Oct 20 11:18:13 PDT 2008 + Test Fixes + * Protect against stray environment variables effecting the tests. + [rt.cpan.org 14930] + + +6.47_02 Thu Oct 16 16:14:20 PDT 2008 + Test Fixes + * MIN_PERL_VERSION test had some goofs on VMS. [thanks Craig Berry] + + +6.47_01 Tue Oct 14 12:38:05 EDT 2008 + New Features + * Added optional parameter MIN_PERL_VERSION, to define minimal + required perl version for dependency checks and to pass on to + META.yml and ppd files. [rt.cpan.org 28374] + Thanks to David Golden, Alexandr Ciornii (chorny) and Martin Becker + + Bug Fixes + * Guard against a path to Perl with a space in it. + From Max Maischein. [bleadperl@32905] + + Test Fixes + - Small fix for VOS from Paul Green [bleadperl@33259] + + Other + * $ExtUtils::MakeMaker::Revision, $ExtUtils::MM_Unix::Revision and + $ExtUtils::MM_VMS::Revision are all now based on $VERSION. You + shouldn't be using them for anything anyway. + + +6.46 Sat Sep 27 17:34:03 EDT 2008 + Bug Fixes + - Fix META_MERGE for more than one level of hashes. [rt.cpan.org 39348] + + +6.45_02 Sun Sep 7 13:59:14 PDT 2008 + Bug Fixes + - Updated bundled ExtUtils::Command to 1.14, ExtUtils::Install to + 1.50 and ExtUtils::Manifest to 1.54 + + Test Fixes + - t/writemakefile_args.t had the wrong skip amount causing failures + when run without version.pm (mostly 5.6 users) + + +6.45_01 Sat Sep 6 03:19:03 PDT 2008 + New Features + * META_ADD and META_MERGE have been added to manipulate the META.yml. + Thanks to Adriano Ferreira. [rt.cpan.org 21282] + - META.yml now includes configure_requires ExtUtils::MakeMaker by + default. [rt.cpan.org 32337] + - META.yml now excludes t/ and inc/ from indexing by default. + - META.yml license is now "unknown" instead of undef if a LICENSE is not + given. + - META.yml now conforms to version 1.4 of the spec. + + Bug Fixes + - Make @MM_Sections and @Overridable global again. It's an undocumented + but used way to manipulate MakeMaker behavior. [rt.cpan.org 36047] + + Portability + * Changed the name/dmake test in MM_Win32.pm to use regexs to that + they are able to handle Perl on a Stick absolute paths. + + +6.44 Thu Feb 28 16:06:04 PST 2008 + Bug Fixes + * Updated bundled ExtUtils::Install to 1.45 which should fix some + Cygwin issues. [rt.cpan.org 33291] + + +6.43_01 Tue Jan 1 16:06:47 PST 2008 + Bug Fixes + * Change the "is this really a Perl core library directory" checks to + look for strict instead of Exporter. Now that Exporter is on CPAN + it can wind up in site_perl. + * split_command() will now set aside a little more space for macro + expansion. This should help on systems with cramped command line + lengths. Specifically, Pugs on Win32. [rt.cpan.org 20145] + + Installation + * MakeMaker would not install if the installed MakeMaker was too old, + like on 5.6.1. The installation process was still using the + installed MakeMaker in a few places. This has been fixed. + [rt.cpan.org 24746] + + OS X + * "make dist" will no longer bundle up resource fork files (._foo). + [rt.cpan.org 29525] + + Docs + * The documentation of VERSION_FROM was recommending vstrings (1.2.3) + which have never worked right. + * The documentation for the accepted values of LICENSE moved to + Module::Build::API. [rt.cpan.org 32020] + + Tests + * The compilation test was testing the installed modules, not the + about-to-be-installed. + * xs.t would fail if ExtUtils::CBuilder was not installed. + + Misc + * Cleanups brought to you by no more 5.5 compatibility! + * MakeMaker is now perlcritic clean at severity level 5... except + the really silly ones. + * DIE use vars DIE! + * Added some resources to the META.yml + 6.42 Fri Dec 7 17:00:14 PST 2007 Bug Fixes - 6.33 moved PREREQ_FATAL to happen after CONFIGURE. This meant if @@ -727,7 +1048,7 @@ causing warnings when generating the Makefile. 6.06_03 Sat Mar 29 19:44:53 PST 2003 - - Added AUTHOR and ABSTRACT_FROM info for ppd generation. + - Added AUTHOR and ABSTRACT_FROM info to Makefile.PL for ppd generation. - Added echo() method to portably echo text to a file. - Worked around 5.8.0 eval 'require Foo::Bar' bug causing MakeMaker to think modules weren't installed. diff --git a/gnu/usr.bin/perl/lib/ExtUtils/Changes_EU-Install b/gnu/usr.bin/perl/lib/ExtUtils/Changes_EU-Install new file mode 100644 index 00000000000..55c60134f64 --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/Changes_EU-Install @@ -0,0 +1,327 @@ +Revision history for ExtUtils-Install + +1.54 + +This is a "no-change" version bump because I pushed the v1.53 change +and then realized that MakeMaker.t was a bad name for a file that would +end up in core where the EUMM tests and the EUI tests are in the same +directory. This renames it to InstallWithMM.t. + +1.53 + +Final stage of the divorce from EUMM. Now the EUMM related tests are no +longer shared. Build.pl and Build.t go, and there shall be peace on earth. +At least until somebody patches EUMM/t/basic.t for something EUI related... + +Thanks to M. Schwern for helping me work this one out. Cheers man. + +1.52_03 + +Missed the t/Installed.t test from core. Bumped version number to allow +a new distro to be released. + +1.52_02 + +Make _chmod verbose message use octal modes, thanks to BDFOY + +Further changes from core, including lastest test file infrastructure +from EUMM. + +Fixed a number of problems in ExtUtils::Installed, for various reasons +this includes a version bump to 1.999_001, which will eventually become +version 2.0. These problems related to finding modules that were installed +with either INSTALL_BASE or PREFIX. Hopefully this resolves these issues. + +1.52_01 (core only release) + +Changes from Core: + +commit 3d55b451d9544fbd4c27c33287b76bee30328830 +Author: John Malmberg +Date: Sun Feb 15 09:25:10 2009 -0600 + + ExtUtils::Install VMS extended character set support + + Preview from https://rt.cpan.org/Ticket/Display.html?id=42149 + + +1.52 + +Production rerelease of 1.51 to make the CPAN indexer happy about permissions +(hopefully). + +SVN Revision 44. + +1.51 + +Production release of 1.50_05. No other changes. + +SVN revision 43. + +1.50_05 + +SVN revision 42. + +Fix broken test as reported by Craig Berry. + +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 + +1.50_01 + +Version only released as part of bleadperl added in revision #33566. +Cygwin related changes by Steve Hay, and others, see + +http://public.activestate.com/cgi-bin/perlbrowse/p/33566 + +and discussion at + +http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2008-03/msg00056.html + +1.50 + +Previous patches to _have_write_access() were causing problems +on Cygwin. So now we skip using POSIX::access under cygwin. +Also added some =pod directives to make my favorite editor +highlight the pod properly. + +1.49 + +Turns out that the new can_write_dir.t doesnt work properly under root +as root can read the files regardless as to their mode. So we skip those +tests when the effective UID is 0 indicating root. + +1.48 + +We were getting N/A test results from CPAN testers due to the +presence of Config in the prequisities list. This has been corrected. + +Also it was pointed out that EU_ALWAYS_COPY did not follow the naming +convention of other ExtUtils::Install environment variables. It has +been renamed EU_INSTALL_ALWAYS_COPY. Support remains for the original +deprecated environment variable but it will be removed in 1.50. + +1.47 + +Fix build process so a new META.YML is produced each time. Also +add support for a new argument syntax to install() as well as +support for always copying installed files even when the old +file was identical. This is needed for some bundling mechanisms +and can be activated by setting the environment variable EU_ALWAYS_COPY +before the install process starts. + +Add a newer cleaner interface to install() to allow named parameters +and easier external monitoring of what transpired. + +1.46 2008-03-01 12:42:35 + +Apply patches from Michael G. Schwern (rt #33688, rt #31429, rt #31248) +and from Slaven Rezic (rt #33290). Also implemented the suggestion from +Schwern about not dieing when failing to remove a shadow file that is +later on in INC than the installed version. (rt #2928) + +1.45 2008-02-27 13:55:27 + +Fix rt.cpan.org #32813, use catpath() to attach volume name +to dirs in _can_write_dir() when necessary to avoid cygwin +builds doing a hostname lookup. + +1.44 2007-09-09 23:12:25 + +by Schwern + +*** MAJOR BUG FIX *** + +install() would always try to uninstall different versions of the +installed files when $uninstall_shadows was given whether it was true or false. +This meant "make install" and "Build install" would both always try to uninstall +differing versions of the modules. [rt.cpan.org 28672] + +1.43 2007-07-21 00:09:24 + +Turns out some recent version, I haven't figured out which, causes +ExtUtils::MakeMaker to fail test. The failure is actually bogus, EUMM +is testing for output that we stopped producing except under verbose, +however it is a pain, so this release fixes the problem. It also adds +a new test file, a stripped down version of ExtUtils::MakeMakers +t/basic.t. + +1.42 2007-07-20 22:43:04 + +This is just 1.41_04 as a production release. + +1.41_04 2007-07-07 16:52:40 + +Reorganize how things work in Install so that we don't try to create +directories which exist but are not writable to us when they contain +files which we want to install which are writable by us. +http://rt.cpan.org/Public/Bug/Display.html?id=25627 + +Also fix a VMS issue as recommended by Craig Berry. +http://rt.cpan.org/Public/Bug/Display.html?id=22157 + +1.41_03 2007-02-11 15:13 + +Add an extra_libs parameter to ExtUtils::Installed->new() which allows +one to specify additional libs to search for installed modules. + +Additional code cleanup and tweaks. + +1.41_02 2007-02-03 21:10 + +Fix bug in _can_write_file(). + +1.41_01 2007-02-02 21:03 + +Integrated changes from + +1. Steffen Mueller: make ExtUtils::Installed respect PERL5LIB and allow +overriding the current config and inc with something else. + +2. Michael Schwern (RT#21949, RT#21948): Fix use lib and installdirs +and other EU::MakeMaker related changes. + +3. ActiveState (RT#5903): Reduce install verbosity. + +4. Craig Berry (RT#22157): Fix VMS related install failure. + +5. Ken Williams (RT#16225): Make fake uninstall actually fake. + + +1.41 2006-07-02 16:09 + +Integrated ExtUtils::Packlist changes from Nicholas Clark to allow for +relocatable perls. Bumped version numbers on all files. + +1.40 2006-04-30 15:04 + +Enhanced errorcatching and reporting. Fixed a problem with the INSTALL.SKIP +file. Changed the Makefile.PL so that when installing it would not use the same +stuff it was replacing. This doesn't affect building with Module::Build +currently. + +Removed META.yml from distribution. + +1.39 2006-04-14 18:53 + +- Fixed problem with the META.yml file being produced from a Win32 point of view. +IMO this is an error/failing in the design of the META.yml process. META.yml should +be created on the client side not on the distributor side. Now produces a +platform agnostic (ie UNIXy) META.yml. + +- Reversed order of change file so newest entries go on top. + + +1.38 2006-04-02 17:31 + +- Removed MANIFEST.SKIP support (INSTALL.SKIP still supported), and +added support for providing a fallback skip file by using +ENV{EU_INSTALL_SITE_SKIP} as a fallback if there is not a distribution +specific skip file. + +- Released under the ExtUtils-Install-1.38 Name + + +1.3702 2006-03-19 16:54 + +- Added support for skipping files during install based on a set of filter +rules. If there is an INSTALL.SKIP in the current directory when doing an +install then it is loaded, otherwise if there is a MANIFEST.SKIP then it is +loaded. If neither exists then no filtration occurs. The env variable +EU_INSTALL_IGNORE_SKIP may be set to a true value to override this behaviour. +This means that you can make .svn directories be ignored on install. + +1.3701 2006-03-13 20:00 + +- Integrated patch from Randy Sims. + + 1. Fixes error during `perl Makefile.PL` because it MakeMaker can't + find the NAME section describing DISTNAME (which has the 'ex-' + prefix). + + 2. Win32API::File is recommended on MSWin32 && cygwin. + + 3. Under Perl5.005, ExtUtils::MM is not present in the version of + MakeMaker included. I don't know what version first includes it. + Needs research or better: eliminate need for it. + + 4. Test::More is bundled with the distro for its test suite. This + would be needed on Perl5.005, for example. It was listed as a + requirement, but the directory it's bundled in is not in @INC when + prereqs are checked. I removed the prereq from Build.PL & + Makefile.PL. Other options: 1) fixup @INC to include t/lib; or 2) + unbundle and add back to prereqs. + + 4. Update t/pod.t t/pod-coverage fixup of @INC so it can find + bundled Test::More. + +- Fixed pod/coverage related issues. + +- When trying to schedule a delete at reboot after renaming a dll out of +the way no error occurs if Win32API::File isn't available. Instead it +merely warns that the file should be hand deleted. + +- Fixed install at reboot behaviour by making sure the temporar file is +writable after install (normally files installed are readonly) + +1.37 2006-03-12 23:20 + +- Refactored reboot support. Integrated changes from Randy Sims +in p5p message 4413F4E9.7090802@thepierianspring.org + + +1.36 2006-03-11 12:42 + +- Extended Win32 support. Added ExtUtils::Install::MUST_REBOOT to +handle such scenario when rebooting. + +- Released as ex-ExtUtils-Install by demerphq + +1.35 Wed Feb 1 23:00:00 CST 2006 + + - First independent release; Extracted ExtUtils::Install, + ExtUtils::Installed, & ExtUtils::Packlist from MakeMaker. + + - Changed the $VERSION of all modules to the same version number, a + number higher than all $VERSIONs. diff --git a/gnu/usr.bin/perl/lib/ExtUtils/Command/MM.pm b/gnu/usr.bin/perl/lib/ExtUtils/Command/MM.pm index 48a66cedb95..d4a0ef7d068 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/Command/MM.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/Command/MM.pm @@ -1,15 +1,16 @@ package ExtUtils::Command::MM; +require 5.006; + use strict; +use warnings; -require 5.005_03; require Exporter; -use vars qw($VERSION @ISA @EXPORT); -@ISA = qw(Exporter); +our @ISA = qw(Exporter); -@EXPORT = qw(test_harness pod2man perllocal_install uninstall - warn_if_old_packlist); -$VERSION = '6.42'; +our @EXPORT = qw(test_harness pod2man perllocal_install uninstall + warn_if_old_packlist); +our $VERSION = '6.55_02'; my $Is_VMS = $^O eq 'VMS'; @@ -86,23 +87,32 @@ And the removal of: If no arguments are given to pod2man it will read from @ARGV. +If Pod::Man is unavailable, this function will warn and return undef. + =cut sub pod2man { - require Pod::Man; - require Getopt::Long; + local @ARGV = @_ ? @_ : @ARGV; - my %options = (); + { + local $@; + if( !eval { require Pod::Man } ) { + warn "Pod::Man is not available: $@". + "Man pages will not be generated during this install.\n"; + return undef; + } + } + require Getopt::Long; # We will cheat and just use Getopt::Long. We fool it by putting # our arguments into @ARGV. Should be safe. - local @ARGV = @_ ? @_ : @ARGV; + my %options = (); Getopt::Long::config ('bundling_override'); Getopt::Long::GetOptions (\%options, 'section|s=s', 'release|r=s', 'center|c=s', 'date|d=s', 'fixed=s', 'fixedbold=s', 'fixeditalic=s', 'fixedbolditalic=s', 'official|o', 'quotes|q=s', 'lax|l', - 'name|n=s', 'perm_rw:i' + 'name|n=s', 'perm_rw=i' ); # If there's no files, don't bother going further. @@ -130,7 +140,7 @@ sub pod2man { $parser->parse_from_file($pod, $man) or do { warn("Could not install $man\n"); next }; - if (length $options{perm_rw}) { + if (exists $options{perm_rw}) { chmod(oct($options{perm_rw}), $man) or do { warn("chmod $options{perm_rw} $man: $!\n"); next }; } @@ -193,7 +203,8 @@ sub perllocal_install { # VMS feeds args as a piped file on STDIN since it usually can't # fit all the args on a single command line. - @ARGV = split /\|/, <STDIN> if $Is_VMS; + my @mod_info = $Is_VMS ? split /\|/, <STDIN> + : @ARGV; my $pod; $pod = sprintf <<POD, scalar localtime; @@ -204,7 +215,7 @@ sub perllocal_install { POD do { - my($key, $val) = splice(@ARGV, 0, 2); + my($key, $val) = splice(@mod_info, 0, 2); $pod .= <<POD =item * @@ -213,7 +224,7 @@ POD POD - } while(@ARGV); + } while(@mod_info); $pod .= "=back\n\n"; $pod =~ s/^ //mg; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/Constant.pm b/gnu/usr.bin/perl/lib/ExtUtils/Constant.pm index c449a9b3f83..0a20b89b792 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/Constant.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/Constant.pm @@ -1,6 +1,6 @@ package ExtUtils::Constant; use vars qw (@ISA $VERSION @EXPORT_OK %EXPORT_TAGS); -$VERSION = 0.20; +$VERSION = 0.22; =head1 NAME @@ -149,7 +149,7 @@ sub C_constant { breakout => $breakout}, @items); } -=item XS_constant PACKAGE, TYPES, SUBNAME, C_SUBNAME +=item XS_constant PACKAGE, TYPES, XS_SUBNAME, C_SUBNAME A function to generate the XS code to implement the perl subroutine I<PACKAGE>::constant used by I<PACKAGE>::AUTOLOAD to load constants. @@ -163,7 +163,7 @@ be the same list of types as C<C_constant> was given. the number of parameters passed to the C function C<constant>] You can call the perl visible subroutine something other than C<constant> if -you give the parameter I<SUBNAME>. The C subroutine it calls defaults to +you give the parameter I<XS_SUBNAME>. The C subroutine it calls defaults to the name of the perl visible subroutine, unless you give the parameter I<C_SUBNAME>. @@ -172,10 +172,10 @@ I<C_SUBNAME>. sub XS_constant { my $package = shift; my $what = shift; - my $subname = shift; + my $XS_subname = shift; my $C_subname = shift; - $subname ||= 'constant'; - $C_subname ||= $subname; + $XS_subname ||= 'constant'; + $C_subname ||= $XS_subname; if (!ref $what) { # Convert line of the form IV,UV,NV to hash @@ -186,7 +186,7 @@ sub XS_constant { my $xs = <<"EOT"; void -$subname(sv) +$XS_subname(sv) PREINIT: #ifdef dXSTARG dXSTARG; /* Faster if we have it. */ @@ -438,6 +438,10 @@ for each group with this number or more names in. An array of constants' names, either scalars containing names, or hashrefs as detailed in L<"C_constant">. +=item PROXYSUBS + +If true, uses proxy subs. See L<ExtUtils::Constant::ProxySubs>. + =item C_FH A filehandle to write the C code to. If not given, then I<C_FILE> is opened @@ -461,7 +465,7 @@ for writing. The name of the file to write containing the XS code. The default is C<const-xs.inc>. -=item SUBNAME +=item XS_SUBNAME The perl visible name of the XS subroutine generated which will return the constants. The default is C<constant>. @@ -469,7 +473,7 @@ constants. The default is C<constant>. =item C_SUBNAME The name of the C subroutine generated which will return the constants. -The default is I<SUBNAME>. Child subroutines have C<_> and the name +The default is I<XS_SUBNAME>. Child subroutines have C<_> and the name length appended, so constants with 10 character names would be in C<constant_10> with the default I<XS_SUBNAME>. @@ -482,11 +486,11 @@ sub WriteConstants { ( # defaults C_FILE => 'const-c.inc', XS_FILE => 'const-xs.inc', - SUBNAME => 'constant', + XS_SUBNAME => 'constant', DEFAULT_TYPE => 'IV', @_); - $ARGS{C_SUBNAME} ||= $ARGS{SUBNAME}; # No-one sane will have C_SUBNAME eq '0' + $ARGS{C_SUBNAME} ||= $ARGS{XS_SUBNAME}; # No-one sane will have C_SUBNAME eq '0' croak "Module name not specified" unless length $ARGS{NAME}; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/Constant/ProxySubs.pm b/gnu/usr.bin/perl/lib/ExtUtils/Constant/ProxySubs.pm index af8c458b634..c3fe8ed3c56 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/Constant/ProxySubs.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/Constant/ProxySubs.pm @@ -9,7 +9,7 @@ require ExtUtils::Constant::XS; use ExtUtils::Constant::Utils qw(C_stringify); use ExtUtils::Constant::XS qw(%XS_TypeSet); -$VERSION = '0.05'; +$VERSION = '0.06'; @ISA = 'ExtUtils::Constant::XS'; %type_to_struct = @@ -197,9 +197,19 @@ sub WriteConstants { my $athx = $self->C_constant_prefix_param(); my $symbol_table = C_stringify($package) . '::'; + my $can_do_pcs = $] >= 5.009; + my $cast_CONSTSUB = $] < 5.010 ? '(char *)' : ''; + print $c_fh $self->header(), <<"EOADD"; static void ${c_subname}_add_symbol($pthx HV *hash, const char *name, I32 namelen, SV *value) { +EOADD + if (!$can_do_pcs) { + print $c_fh <<'EO_NOPCS'; + if (namelen == namelen) { +EO_NOPCS + } else { + print $c_fh <<"EO_PCS"; SV **sv = hv_fetch(hash, name, namelen, TRUE); if (!sv) { Perl_croak($athx "Couldn't add key '%s' to %%$package_sprintf_safe\::", @@ -207,13 +217,27 @@ ${c_subname}_add_symbol($pthx HV *hash, const char *name, I32 namelen, SV *value } if (SvOK(*sv) || SvTYPE(*sv) == SVt_PVGV) { /* Someone has been here before us - have to make a real sub. */ - newCONSTSUB(hash, name, value); +EO_PCS + } + # This piece of code is common to both + print $c_fh <<"EOADD"; + newCONSTSUB(hash, ${cast_CONSTSUB}name, value); +EOADD + if ($can_do_pcs) { + print $c_fh <<'EO_PCS'; } else { SvUPGRADE(*sv, SVt_RV); SvRV_set(*sv, value); SvROK_on(*sv); SvREADONLY_on(value); } +EO_PCS + } else { + print $c_fh <<'EO_NOPCS'; + } +EO_NOPCS + } + print $c_fh <<'EOADD'; } EOADD @@ -294,7 +318,7 @@ BOOT: #ifdef dTHX dTHX; #endif - HV *symbol_table = get_hv("$symbol_table", TRUE); + HV *symbol_table = get_hv("$symbol_table", GV_ADD); #ifndef SYMBIAN HV *${c_subname}_missing; #endif @@ -411,7 +435,8 @@ EXPLODE /* It turns out to be incredibly hard to deal with all the corner cases of sub foo (); and reporting errors correctly, so lets cheat a bit. Start with a constant subroutine */ - CV *cv = newCONSTSUB(symbol_table, value_for_notfound->name, + CV *cv = newCONSTSUB(symbol_table, + ${cast_CONSTSUB}value_for_notfound->name, &PL_sv_yes); /* and then turn it into a non constant declaration only. */ SvREFCNT_dec(CvXSUBANY(cv).any_ptr); diff --git a/gnu/usr.bin/perl/lib/ExtUtils/Constant/Utils.pm b/gnu/usr.bin/perl/lib/ExtUtils/Constant/Utils.pm index 067170157e3..016507c72a6 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/Constant/Utils.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/Constant/Utils.pm @@ -6,7 +6,7 @@ use Carp; @ISA = 'Exporter'; @EXPORT_OK = qw(C_stringify perl_stringify); -$VERSION = '0.01'; +$VERSION = '0.02'; $is_perl56 = ($] < 5.007 && $] > 5.005_50); diff --git a/gnu/usr.bin/perl/lib/ExtUtils/Constant/XS.pm b/gnu/usr.bin/perl/lib/ExtUtils/Constant/XS.pm index 010dfbd48f6..14eb8097146 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/Constant/XS.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/Constant/XS.pm @@ -10,13 +10,13 @@ require ExtUtils::Constant::Base; @ISA = qw(ExtUtils::Constant::Base Exporter); @EXPORT_OK = qw(%XS_Constant %XS_TypeSet); -$VERSION = '0.02'; +$VERSION = '0.03'; $is_perl56 = ($] < 5.007 && $] > 5.005_50); =head1 NAME -ExtUtils::Constant::Base - base class for ExtUtils::Constant objects +ExtUtils::Constant::XS - generate C code for XS modules' constants. =head1 SYNOPSIS diff --git a/gnu/usr.bin/perl/lib/ExtUtils/Installed.pm b/gnu/usr.bin/perl/lib/ExtUtils/Installed.pm index 8e6513998bb..9cb1fc10d75 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/Installed.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/Installed.pm @@ -2,6 +2,7 @@ package ExtUtils::Installed; use 5.00503; use strict; +#use warnings; # XXX requires 5.6 use Carp qw(); use ExtUtils::Packlist; use ExtUtils::MakeMaker; @@ -16,7 +17,7 @@ my $DOSISH = ($^O =~ /^(MSWin\d\d|os2|dos|mint)$/); require VMS::Filespec if $Is_VMS; use vars qw($VERSION); -$VERSION = '1.43'; +$VERSION = '1.999_001'; $VERSION = eval $VERSION; sub _is_prefix { @@ -28,9 +29,8 @@ sub _is_prefix { $path = VMS::Filespec::unixify($path); } - # Sloppy Unix path normalization. - $prefix =~ s{/+}{/}g; - $path =~ s{/+}{/}g; + # Unix path normalization. + $prefix = File::Spec->canonpath($prefix); return 1 if substr($path, 0, length($prefix)) eq $prefix; @@ -58,12 +58,10 @@ sub _is_type { return 1 if $type eq "all"; return($self->_is_doc($path)) if $type eq "doc"; - + my $conf= $self->{':private:'}{Config}; if ($type eq "prog") { - return($self->_is_prefix($path, $self->{':private:'}{Config}{prefix} || $self->{':private:'}{Config}{prefixexp}) - && - !($self->_is_doc($path)) - ? 1 : 0); + return($self->_is_prefix($path, $conf->{prefix} || $conf->{prefixexp}) + && !($self->_is_doc($path)) ? 1 : 0); } return(0); } @@ -78,13 +76,63 @@ sub _is_under { return(0); } +sub _fix_dirs { + my ($self, @dirs)= @_; + # File::Find does not know how to deal with VMS filepaths. + if( $Is_VMS ) { + $_ = VMS::Filespec::unixify($_) + for @dirs; + } + + if ($DOSISH) { + s|\\|/|g for @dirs; + } + return wantarray ? @dirs : $dirs[0]; +} + +sub _make_entry { + my ($self, $module, $packlist_file, $modfile)= @_; + + my $data= { + module => $module, + packlist => scalar(ExtUtils::Packlist->new($packlist_file)), + packlist_file => $packlist_file, + }; + + if (!$modfile) { + $data->{version} = $self->{':private:'}{Config}{version}; + } else { + $data->{modfile} = $modfile; + # Find the top-level module file in @INC + $data->{version} = ''; + foreach my $dir (@{$self->{':private:'}{INC}}) { + my $p = File::Spec->catfile($dir, $modfile); + if (-r $p) { + $module = _module_name($p, $module) if $Is_VMS; + + $data->{version} = MM->parse_version($p); + $data->{version_from} = $p; + $data->{packlist_valid} = exists $data->{packlist}{$p}; + last; + } + } + } + $self->{$module}= $data; +} + +our $INSTALLED; sub new { my ($class) = shift(@_); $class = ref($class) || $class; my %args = @_; - my $self = {}; + return $INSTALLED if $INSTALLED and ($args{default_get} || $args{default}); + + my $self = bless {}, $class; + + $INSTALLED= $self if $args{default_set} || $args{default}; + if ($args{config_override}) { eval { @@ -96,9 +144,9 @@ sub new { else { $self->{':private:'}{Config} = \%Config; } - + for my $tuple ([inc_override => INC => [ @INC ] ], - [ extra_libs => EXTRA => [] ]) + [ extra_libs => EXTRA => [] ]) { my ($arg,$key,$val)=@$tuple; if ( $args{$arg} ) { @@ -114,33 +162,17 @@ sub new { } { my %dupe; - @{$self->{':private:'}{INC}} = grep { -e $_ && !$dupe{$_}++ } - @{$self->{':private:'}{INC}}, @{$self->{':private:'}{EXTRA}}; - } - my $perl5lib = defined $ENV{PERL5LIB} ? $ENV{PERL5LIB} : ""; - - my @dirs = ( $self->{':private:'}{Config}{archlibexp}, - $self->{':private:'}{Config}{sitearchexp}, - split(/\Q$Config{path_sep}\E/, $perl5lib), - @{$self->{':private:'}{EXTRA}}, - ); - - # File::Find does not know how to deal with VMS filepaths. - if( $Is_VMS ) { - $_ = VMS::Filespec::unixify($_) - for @dirs; + @{$self->{':private:'}{LIBDIRS}} = grep { -e $_ && !$dupe{$_}++ } + @{$self->{':private:'}{EXTRA}}, @{$self->{':private:'}{INC}}; } - if ($DOSISH) { - s|\\|/|g for @dirs; - } - my $archlib = $dirs[0]; - + my @dirs= $self->_fix_dirs(@{$self->{':private:'}{LIBDIRS}}); + # Read the core packlist - $self->{Perl}{packlist} = - ExtUtils::Packlist->new( File::Spec->catfile($archlib, '.packlist') ); - $self->{Perl}{version} = $self->{':private:'}{Config}{version}; + my $archlib = $self->_fix_dirs($self->{':private:'}{Config}{archlibexp}); + $self->_make_entry("Perl",File::Spec->catfile($archlib, '.packlist')); + my $root; # Read the module packlists my $sub = sub { # Only process module .packlists @@ -148,41 +180,26 @@ sub new { # Hack of the leading bits of the paths & convert to a module name my $module = $File::Find::name; - my $found; - for (@dirs) { - $found = $module =~ s!\Q$_\E/?auto/(.*)/.packlist!$1!s - and last; - } - unless ($found) { + my $found = $module =~ s!^.*?/auto/(.*)/.packlist!$1!s + or do { # warn "Woah! \$_=$_\n\$module=$module\n\$File::Find::dir=$File::Find::dir\n", # join ("\n",@dirs); return; - } + }; + my $modfile = "$module.pm"; $module =~ s!/!::!g; - # Find the top-level module file in @INC - $self->{$module}{version} = ''; - foreach my $dir (@{$self->{':private:'}{INC}}) { - my $p = File::Spec->catfile($dir, $modfile); - if (-r $p) { - $module = _module_name($p, $module) if $Is_VMS; - - $self->{$module}{version} = MM->parse_version($p); - last; - } - } - - # Read the .packlist - $self->{$module}{packlist} = - ExtUtils::Packlist->new($File::Find::name); + return if $self->{$module}; #shadowing? + $self->_make_entry($module,$File::Find::name,$modfile); }; - my %dupe; - @dirs= grep { -e $_ && !$dupe{$_}++ } @dirs; - $self->{':private:'}{LIBDIRS} = \@dirs; - find($sub, @dirs) if @dirs; + while (@dirs) { + $root= shift @dirs; + next if !-d $root; + find($sub,$root); + } - return(bless($self, $class)); + return $self; } # VMS's non-case preserving file-system means the package name can't @@ -213,10 +230,9 @@ sub _module_name { return $module; } - - sub modules { my ($self) = @_; + $self= $self->new(default=>1) if !ref $self; # Bug/feature of sort in scalar context requires this. return wantarray @@ -226,6 +242,7 @@ sub modules { sub files { my ($self, $module, $type, @under) = @_; + $self= $self->new(default=>1) if !ref $self; # Validate arguments Carp::croak("$module is not installed") if (! exists($self->{$module})); @@ -244,6 +261,7 @@ sub files { sub directories { my ($self, $module, $type, @under) = @_; + $self= $self->new(default=>1) if !ref $self; my (%dirs); foreach my $file ($self->files($module, $type, @under)) { $dirs{dirname($file)}++; @@ -253,6 +271,7 @@ sub directories { sub directory_tree { my ($self, $module, $type, @under) = @_; + $self= $self->new(default=>1) if !ref $self; my (%dirs); foreach my $dir ($self->directories($module, $type, @under)) { $dirs{$dir}++; @@ -269,22 +288,33 @@ sub directory_tree { sub validate { my ($self, $module, $remove) = @_; + $self= $self->new(default=>1) if !ref $self; Carp::croak("$module is not installed") if (! exists($self->{$module})); return($self->{$module}{packlist}->validate($remove)); } sub packlist { my ($self, $module) = @_; + $self= $self->new(default=>1) if !ref $self; Carp::croak("$module is not installed") if (! exists($self->{$module})); return($self->{$module}{packlist}); } sub version { my ($self, $module) = @_; + $self= $self->new(default=>1) if !ref $self; Carp::croak("$module is not installed") if (! exists($self->{$module})); return($self->{$module}{version}); } +sub debug_dump { + my ($self, $module) = @_; + $self= $self->new(default=>1) if !ref $self; + local $self->{":private:"}{Config}; + require Data::Dumper; + print Data::Dumper->new([$self])->Sortkeys(1)->Indent(1)->Dump(); +} + 1; @@ -321,7 +351,13 @@ stores their contents. The .packlists can be queried with the functions described below. Where it searches by default is determined by the settings found in C<%Config::Config>, and what the value is of the PERL5LIB environment variable. -=head1 FUNCTIONS +=head1 METHODS + +Unless specified otherwise all method can be called as class methods, or as object +methods. If called as class methods then the "default" object will be used, and if +necessary created using the current processes %Config and @INC. See the +'default' option to new() for details. + =over 4 @@ -344,19 +380,30 @@ pass that in. Similarly, the parameter C<inc_override> may be a reference to an array which is used in place of the default module search paths -from C<@INC>. +from C<@INC>. use Config; my @dirs = split(/\Q$Config{path_sep}\E/, $ENV{PERL5LIB}); my $p5libs = ExtUtils::Installed->new(inc_override=>\@dirs); -The parameter c<extra_libs> can be used to specify B<additional> paths to -search for installed modules. For instance +B<Note>: You probably do not want to use these options alone, almost always +you will want to set both together. + +The parameter c<extra_libs> can be used to specify B<additional> paths to +search for installed modules. For instance my $installed = ExtUtils::Installed->new(extra_libs=>["/my/lib/path"]); This should only be necessary if C</my/lib/path> is not in PERL5LIB. +Finally there is the 'default', and the related 'default_get' and 'default_set' +options. These options control the "default" object which is provided by the +class interface to the methods. Setting C<default_get> to true tells the constructor +to return the default object if it is defined. Setting C<default_set> to true tells +the constructor to make the default object the constructed object. Setting the +C<default> option is like setting both to true. This is used primarily internally +and probably isn't interesting to any real user. + =item modules() This returns a list of the names of all the installed modules. The perl 'core' diff --git a/gnu/usr.bin/perl/lib/ExtUtils/Liblist/Kid.pm b/gnu/usr.bin/perl/lib/ExtUtils/Liblist/Kid.pm index bef182b1bde..380d4f8a9ad 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/Liblist/Kid.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/Liblist/Kid.pm @@ -5,12 +5,11 @@ package ExtUtils::Liblist::Kid; # This kid package is to be used by MakeMaker. It will not work if # $self is not a Makemaker. -use 5.00503; +use 5.006; # Broken out of MakeMaker from version 4.11 use strict; -use vars qw($VERSION); -$VERSION = 6.42; +our $VERSION = 6.55_02; use Config; use Cwd 'cwd'; @@ -50,11 +49,11 @@ sub _unix_os2_ext { my(@libpath) = split " ", $Config{'libpth'}; my(@ldloadlibs, @bsloadlibs, @extralibs, @ld_run_path, %ld_run_path_seen); my(@libs, %libs_seen); - my($fullname, $thislib, $thispth, @fullname); + my($fullname, @fullname); my($pwd) = cwd(); # from Cwd.pm my($found) = 0; - foreach $thislib (split ' ', $potential_libs){ + foreach my $thislib (split ' ', $potential_libs) { # Handle possible linker path arguments. if ($thislib =~ s/^(-[LR]|-Wl,-R)//){ # save path flag type @@ -89,7 +88,7 @@ sub _unix_os2_ext { } my($found_lib)=0; - foreach $thispth (@searchpath, @libpath){ + foreach my $thispth (@searchpath, @libpath) { # Try to find the full name of the library. We need this to # determine whether it's a dynamically-loadable library or not. @@ -128,7 +127,7 @@ sub _unix_os2_ext { } elsif (-f ($fullname="$thispth/lib$thislib.$so") && (($Config{'dlsrc'} ne "dl_dld.xs") || ($thislib eq "m"))){ } elsif (-f ($fullname="$thispth/lib${thislib}_s$Config_libext") - && (! $Config{'archname'} =~ /RM\d\d\d-svr4/) + && ($Config{'archname'} !~ /RM\d\d\d-svr4/) && ($thislib .= "_s") ){ # we must explicitly use _s version } elsif (-f ($fullname="$thispth/lib$thislib$Config_libext")){ } elsif (-f ($fullname="$thispth/$thislib$Config_libext")){ @@ -259,7 +258,7 @@ sub _win32_ext { my $lib = ''; my $found = 0; my $search = 1; - my($fullname, $thislib, $thispth); + my($fullname); # add "$Config{installarchlib}/CORE" to default search path push @libpath, "$Config{installarchlib}/CORE"; @@ -270,7 +269,7 @@ sub _win32_ext { foreach (Text::ParseWords::quotewords('\s+', 0, $potential_libs)){ - $thislib = $_; + my $thislib = $_; # see if entry is a flag if (/^:\w+$/) { @@ -323,7 +322,7 @@ sub _win32_ext { } my $found_lib = 0; - foreach $thispth (@searchpath, @libpath){ + foreach my $thispth (@searchpath, @libpath){ unless (-f ($fullname="$thispth\\$_")) { warn "'$thislib' not found as '$fullname'\n" if $verbose; next; @@ -372,7 +371,7 @@ sub _win32_ext { sub _vms_ext { - my($self, $potential_libs,$verbose,$give_libs) = @_; + my($self, $potential_libs, $verbose, $give_libs) = @_; $verbose ||= 0; my(@crtls,$crtlstr); @@ -386,8 +385,8 @@ sub _vms_ext { # to insure that the copy in the local tree is used, rather than one to # which a system-wide logical may point. if ($self->{PERL_SRC}) { - my($lib,$locspec,$type); - foreach $lib (@crtls) { + my($locspec,$type); + foreach my $lib (@crtls) { 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'}; } @@ -404,7 +403,7 @@ sub _vms_ext { return ('', '', $crtlstr, '', ($give_libs ? [] : ())); } - my(@dirs,@libs,$dir,$lib,%found,@fndlibs,$ldlib); + my(%found,@fndlibs,$ldlib); my $cwd = cwd(); my($so,$lib_ext,$obj_ext) = @Config{'so','lib_ext','obj_ext'}; # List of common Unix library names and their VMS equivalents @@ -421,7 +420,8 @@ sub _vms_ext { warn "Potential libraries are '$potential_libs'\n" if $verbose; # First, sort out directories and library names in the input - foreach $lib (split ' ',$potential_libs) { + my(@dirs, @libs); + foreach my $lib (split ' ',$potential_libs) { push(@dirs,$1), next if $lib =~ /^-L(.*)/; push(@dirs,$lib), next if $lib =~ /[:>\]]$/; push(@dirs,$lib), next if -d $lib; @@ -433,7 +433,7 @@ sub _vms_ext { # Now make sure we've got VMS-syntax absolute directory specs # (We don't, however, check whether someone's hidden a relative # path in a logical name.) - foreach $dir (@dirs) { + foreach my $dir (@dirs) { unless (-d $dir) { warn "Skipping nonexistent Directory $dir\n" if $verbose > 1; $dir = ''; @@ -450,13 +450,13 @@ sub _vms_ext { @dirs = grep { length($_) } @dirs; unshift(@dirs,''); # Check each $lib without additions first - LIB: foreach $lib (@libs) { + LIB: foreach my $lib (@libs) { if (exists $libmap{$lib}) { next unless length $libmap{$lib}; $lib = $libmap{$lib}; } - my(@variants,$variant,$cand); + my(@variants,$cand); my($ctype) = ''; # If we don't have a file type, consider it a possibly abbreviated name and @@ -469,10 +469,10 @@ sub _vms_ext { } push(@variants,$lib); warn "Looking for $lib\n" if $verbose; - foreach $variant (@variants) { + foreach my $variant (@variants) { my($fullname, $name); - foreach $dir (@dirs) { + foreach my $dir (@dirs) { my($type); $name = "$dir$variant"; @@ -536,7 +536,7 @@ sub _vms_ext { push @fndlibs, @{$found{OBJ}} if exists $found{OBJ}; push @fndlibs, map { "$_/Library" } @{$found{OLB}} if exists $found{OLB}; push @fndlibs, map { "$_/Share" } @{$found{SHR}} if exists $found{SHR}; - $lib = join(' ',@fndlibs); + my $lib = join(' ',@fndlibs); $ldlib = $crtlstr ? "$lib $crtlstr" : $lib; warn "Result:\n\tEXTRALIBS: $lib\n\tLDLOADLIBS: $ldlib\n" if $verbose; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/MANIFEST.SKIP b/gnu/usr.bin/perl/lib/ExtUtils/MANIFEST.SKIP index 56686212a0d..885fedcedb6 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/MANIFEST.SKIP +++ b/gnu/usr.bin/perl/lib/ExtUtils/MANIFEST.SKIP @@ -4,6 +4,8 @@ \bSCCS\b ,v$ \B\.svn\b +\B\.git\b +\B\.gitignore\b \b_darcs\b # Avoid Makemaker generated and utility files. diff --git a/gnu/usr.bin/perl/lib/ExtUtils/MM.pm b/gnu/usr.bin/perl/lib/ExtUtils/MM.pm index 546b76dbcc1..4694f3f1c8d 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/MM.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/MM.pm @@ -2,13 +2,12 @@ package ExtUtils::MM; use strict; use ExtUtils::MakeMaker::Config; -use vars qw(@ISA $VERSION); -$VERSION = '6.42'; + +our $VERSION = '6.55_02'; require ExtUtils::Liblist; require ExtUtils::MakeMaker; - -@ISA = qw(ExtUtils::Liblist ExtUtils::MakeMaker); +our @ISA = qw(ExtUtils::Liblist ExtUtils::MakeMaker); =head1 NAME @@ -38,16 +37,16 @@ away. { # Convenient alias. package MM; - use vars qw(@ISA); - @ISA = qw(ExtUtils::MM); + our @ISA = qw(ExtUtils::MM); sub DESTROY {} } sub _is_win95 { # miniperl might not have the Win32 functions available and we need # to run in miniperl. - return defined &Win32::IsWin95 ? Win32::IsWin95() - : ! defined $ENV{SYSTEMROOT}; + my $have_win32 = eval { require Win32 }; + return $have_win32 && defined &Win32::IsWin95 ? Win32::IsWin95() + : ! defined $ENV{SYSTEMROOT}; } my %Is = (); @@ -60,7 +59,7 @@ if( $^O eq 'MSWin32' ) { $Is{UWIN} = $^O =~ /^uwin(-nt)?$/; $Is{Cygwin} = $^O eq 'cygwin'; $Is{NW5} = $Config{osname} eq 'NetWare'; # intentional -$Is{BeOS} = $^O =~ /beos/i; # XXX should this be that loose? +$Is{BeOS} = ($^O =~ /beos/i or $^O eq 'haiku'); $Is{DOS} = $^O eq 'dos'; if( $Is{NW5} ) { $^O = 'NetWare'; @@ -69,6 +68,7 @@ if( $Is{NW5} ) { $Is{VOS} = $^O eq 'vos'; $Is{QNX} = $^O eq 'qnx'; $Is{AIX} = $^O eq 'aix'; +$Is{Darwin} = $^O eq 'darwin'; $Is{Unix} = !grep { $_ } values %Is; @@ -78,7 +78,7 @@ my($OS) = keys %Is; my $class = "ExtUtils::MM_$OS"; -eval "require $class" unless $INC{"ExtUtils/MM_$OS.pm"}; +eval "require $class" unless $INC{"ExtUtils/MM_$OS.pm"}; ## no critic die $@ if $@; unshift @ISA, $class; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/MM_AIX.pm b/gnu/usr.bin/perl/lib/ExtUtils/MM_AIX.pm index f847303bae8..0f27d177c9b 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/MM_AIX.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/MM_AIX.pm @@ -1,11 +1,10 @@ package ExtUtils::MM_AIX; use strict; -use vars qw($VERSION @ISA); -$VERSION = '6.42'; +our $VERSION = '6.55_02'; require ExtUtils::MM_Unix; -@ISA = qw(ExtUtils::MM_Unix); +our @ISA = qw(ExtUtils::MM_Unix); use ExtUtils::MakeMaker qw(neatvalue); diff --git a/gnu/usr.bin/perl/lib/ExtUtils/MM_BeOS.pm b/gnu/usr.bin/perl/lib/ExtUtils/MM_BeOS.pm index d7812b3f91e..168d23dfd74 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/MM_BeOS.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/MM_BeOS.pm @@ -25,9 +25,8 @@ use File::Spec; require ExtUtils::MM_Any; require ExtUtils::MM_Unix; -use vars qw(@ISA $VERSION); -@ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); -$VERSION = '6.42'; +our @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); +our $VERSION = '6.55_02'; =item os_flavor diff --git a/gnu/usr.bin/perl/lib/ExtUtils/MM_Cygwin.pm b/gnu/usr.bin/perl/lib/ExtUtils/MM_Cygwin.pm index ca4d58d9ec6..9cc7522ac38 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/MM_Cygwin.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/MM_Cygwin.pm @@ -1,16 +1,15 @@ package ExtUtils::MM_Cygwin; use strict; -use vars qw($VERSION @ISA); use ExtUtils::MakeMaker::Config; use File::Spec; -require ExtUtils::MM_Any; require ExtUtils::MM_Unix; -@ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); +require ExtUtils::MM_Win32; +our @ISA = qw( ExtUtils::MM_Unix ); -$VERSION = '6.42'; +our $VERSION = '6.55_02'; =head1 NAME @@ -99,6 +98,24 @@ sub init_linker { $self->{EXPORT_LIST} ||= ''; } +=item maybe_command + +If our path begins with F</cygdrive/> then we use C<ExtUtils::MM_Win32> +to determine if it may be a command. Otherwise we use the tests +from C<ExtUtils::MM_Unix>. + +=cut + +sub maybe_command { + my ($self, $file) = @_; + + if ($file =~ m{^/cygdrive/}i) { + return ExtUtils::MM_Win32->maybe_command($file); + } + + return $self->SUPER::maybe_command($file); +} + =back =cut diff --git a/gnu/usr.bin/perl/lib/ExtUtils/MM_DOS.pm b/gnu/usr.bin/perl/lib/ExtUtils/MM_DOS.pm index f47a72d1eff..84bedeada82 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/MM_DOS.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/MM_DOS.pm @@ -1,13 +1,12 @@ package ExtUtils::MM_DOS; use strict; -use vars qw($VERSION @ISA); -$VERSION = 6.42; +our $VERSION = 6.55_02; require ExtUtils::MM_Any; require ExtUtils::MM_Unix; -@ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); +our @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); =head1 NAME diff --git a/gnu/usr.bin/perl/lib/ExtUtils/MM_Darwin.pm b/gnu/usr.bin/perl/lib/ExtUtils/MM_Darwin.pm new file mode 100644 index 00000000000..d26c0a10f24 --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/MM_Darwin.pm @@ -0,0 +1,47 @@ +package ExtUtils::MM_Darwin; + +use strict; + +BEGIN { + require ExtUtils::MM_Unix; + our @ISA = qw( ExtUtils::MM_Unix ); +} + +our $VERSION = '6.55_02'; + + +=head1 NAME + +ExtUtils::MM_Darwin - special behaviors for OS X + +=head1 SYNOPSIS + + For internal MakeMaker use only + +=head1 DESCRIPTION + +See L<ExtUtils::MM_Unix> for L<ExtUtils::MM_Any> for documention on the +methods overridden here. + +=head2 Overriden Methods + +=head3 init_dist + +Turn off Apple tar's tendency to copy resource forks as "._foo" files. + +=cut + +sub init_dist { + my $self = shift; + + # Thank you, Apple, for breaking tar and then breaking the work around. + # 10.4 wants COPY_EXTENDED_ATTRIBUTES_DISABLE while 10.5 wants + # COPYFILE_DISABLE. I'm not going to push my luck and instead just + # set both. + $self->{TAR} ||= + 'COPY_EXTENDED_ATTRIBUTES_DISABLE=1 COPYFILE_DISABLE=1 tar'; + + $self->SUPER::init_dist(@_); +} + +1; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/MM_MacOS.pm b/gnu/usr.bin/perl/lib/ExtUtils/MM_MacOS.pm index 32d5ffed5d1..bab7ab92bbf 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/MM_MacOS.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/MM_MacOS.pm @@ -2,8 +2,7 @@ package ExtUtils::MM_MacOS; use strict; -use vars qw($VERSION); -$VERSION = 6.42; +our $VERSION = 6.55_02; sub new { die <<'UNSUPPORTED'; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/MM_NW5.pm b/gnu/usr.bin/perl/lib/ExtUtils/MM_NW5.pm index 222008a7fb8..950f1759dd8 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/MM_NW5.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/MM_NW5.pm @@ -22,11 +22,10 @@ use strict; use ExtUtils::MakeMaker::Config; use File::Basename; -use vars qw(@ISA $VERSION); -$VERSION = '6.42'; +our $VERSION = '6.55_02'; require ExtUtils::MM_Win32; -@ISA = qw(ExtUtils::MM_Win32); +our @ISA = qw(ExtUtils::MM_Win32); use ExtUtils::MakeMaker qw( &neatvalue ); diff --git a/gnu/usr.bin/perl/lib/ExtUtils/MM_QNX.pm b/gnu/usr.bin/perl/lib/ExtUtils/MM_QNX.pm index 98009bfc3ec..df6e5719ad4 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/MM_QNX.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/MM_QNX.pm @@ -1,11 +1,10 @@ package ExtUtils::MM_QNX; use strict; -use vars qw($VERSION @ISA); -$VERSION = '6.42'; +our $VERSION = '6.55_02'; require ExtUtils::MM_Unix; -@ISA = qw(ExtUtils::MM_Unix); +our @ISA = qw(ExtUtils::MM_Unix); =head1 NAME diff --git a/gnu/usr.bin/perl/lib/ExtUtils/MM_UWIN.pm b/gnu/usr.bin/perl/lib/ExtUtils/MM_UWIN.pm index 6be793010f0..d3f2949e7d8 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/MM_UWIN.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/MM_UWIN.pm @@ -1,11 +1,10 @@ package ExtUtils::MM_UWIN; use strict; -use vars qw($VERSION @ISA); -$VERSION = 6.42; +our $VERSION = 6.55_02; require ExtUtils::MM_Unix; -@ISA = qw(ExtUtils::MM_Unix); +our @ISA = qw(ExtUtils::MM_Unix); =head1 NAME diff --git a/gnu/usr.bin/perl/lib/ExtUtils/MM_VOS.pm b/gnu/usr.bin/perl/lib/ExtUtils/MM_VOS.pm index 171a8b727eb..3a7ec87ec89 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/MM_VOS.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/MM_VOS.pm @@ -1,11 +1,10 @@ package ExtUtils::MM_VOS; use strict; -use vars qw($VERSION @ISA); -$VERSION = '6.42'; +our $VERSION = '6.55_02'; require ExtUtils::MM_Unix; -@ISA = qw(ExtUtils::MM_Unix); +our @ISA = qw(ExtUtils::MM_Unix); =head1 NAME diff --git a/gnu/usr.bin/perl/lib/ExtUtils/MM_Win95.pm b/gnu/usr.bin/perl/lib/ExtUtils/MM_Win95.pm index 7dbdee63324..0c04f830061 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/MM_Win95.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/MM_Win95.pm @@ -2,11 +2,10 @@ package ExtUtils::MM_Win95; use strict; -use vars qw($VERSION @ISA); -$VERSION = '6.42'; +our $VERSION = '6.55_02'; require ExtUtils::MM_Win32; -@ISA = qw(ExtUtils::MM_Win32); +our @ISA = qw(ExtUtils::MM_Win32); use ExtUtils::MakeMaker::Config; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/MY.pm b/gnu/usr.bin/perl/lib/ExtUtils/MY.pm index d8de9aa7507..c1a8c94a69b 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/MY.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/MY.pm @@ -3,14 +3,12 @@ package ExtUtils::MY; use strict; require ExtUtils::MM; -use vars qw(@ISA $VERSION); -$VERSION = 6.42; -@ISA = qw(ExtUtils::MM); +our $VERSION = 6.55_02; +our @ISA = qw(ExtUtils::MM); { package MY; - use vars qw(@ISA); - @ISA = qw(ExtUtils::MY); + our @ISA = qw(ExtUtils::MY); } sub DESTROY {} diff --git a/gnu/usr.bin/perl/lib/ExtUtils/MakeMaker/Config.pm b/gnu/usr.bin/perl/lib/ExtUtils/MakeMaker/Config.pm index 65f9d474750..9c99f7d1b28 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/MakeMaker/Config.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/MakeMaker/Config.pm @@ -1,18 +1,18 @@ package ExtUtils::MakeMaker::Config; -$VERSION = '6.42'; - use strict; + +our $VERSION = '6.55_02'; + use Config (); # Give us an overridable config. -use vars qw(%Config); -%Config = %Config::Config; +our %Config = %Config::Config; sub import { my $caller = caller; - no strict 'refs'; + no strict 'refs'; ## no critic *{$caller.'::Config'} = \%Config; } diff --git a/gnu/usr.bin/perl/lib/ExtUtils/MakeMaker/Tutorial.pod b/gnu/usr.bin/perl/lib/ExtUtils/MakeMaker/Tutorial.pod index a4aae73eb06..8ad72649b1a 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/MakeMaker/Tutorial.pod +++ b/gnu/usr.bin/perl/lib/ExtUtils/MakeMaker/Tutorial.pod @@ -1,7 +1,6 @@ package ExtUtils::MakeMaker::Tutorial; -use vars qw($VERSION); -$VERSION = 0.02; +our $VERSION = 0.02; =head1 NAME diff --git a/gnu/usr.bin/perl/lib/ExtUtils/ParseXS.pm b/gnu/usr.bin/perl/lib/ExtUtils/ParseXS.pm index 221d5a43b82..3fa4cc00f5f 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/ParseXS.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/ParseXS.pm @@ -18,7 +18,7 @@ my(@XSStack); # Stack of conditionals and INCLUDEs my($XSS_work_idx, $cpp_next_tmp); use vars qw($VERSION); -$VERSION = '2.18_02'; +$VERSION = '2.2002'; use vars qw(%input_expr %output_expr $ProtoUsed @InitFileCode $FH $proto_re $Overload $errors $Fallback $cplusplus $hiertype $WantPrototypes $WantVersionChk $except $WantLineNumbers @@ -76,7 +76,7 @@ sub process_file { $proto_re = "[" . quotemeta('\$%&*@;[]') . "]" ; $Overload = 0; $errors = 0; - $Fallback = 'PL_sv_undef'; + $Fallback = '&PL_sv_undef'; # Most of the 1500 lines below uses these globals. We'll have to # clean this up sometime, probably. For now, we just pull them out @@ -305,13 +305,56 @@ EOM exit 0; # Not a fatal error for the caller process } - print <<"EOF"; + print 'ExtUtils::ParseXS::CountLines'->end_marker, "\n" if $WantLineNumbers; + + print <<"EOF"; #ifndef PERL_UNUSED_VAR # define PERL_UNUSED_VAR(var) if (0) var = var #endif EOF + print <<"EOF"; +#ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE +#define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params) + +/* prototype to pass -Wmissing-prototypes */ +STATIC void +S_croak_xs_usage(pTHX_ const CV *const cv, const char *const params); + +STATIC void +S_croak_xs_usage(pTHX_ const CV *const cv, const char *const params) +{ + const GV *const gv = CvGV(cv); + + PERL_ARGS_ASSERT_CROAK_XS_USAGE; + + if (gv) { + const char *const gvname = GvNAME(gv); + const HV *const stash = GvSTASH(gv); + const char *const hvname = stash ? HvNAME(stash) : NULL; + + if (hvname) + Perl_croak(aTHX_ "Usage: %s::%s(%s)", hvname, gvname, params); + else + Perl_croak(aTHX_ "Usage: %s(%s)", gvname, params); + } else { + /* Pants. I don't think that it should be possible to get here. */ + Perl_croak(aTHX_ "Usage: CODE(0x%"UVxf")(%s)", PTR2UV(cv), params); + } +} +#undef PERL_ARGS_ASSERT_CROAK_XS_USAGE + +#ifdef PERL_IMPLICIT_CONTEXT +#define croak_xs_usage(a,b) S_croak_xs_usage(aTHX_ a,b) +#else +#define croak_xs_usage S_croak_xs_usage +#endif + +#endif + +EOF + print 'ExtUtils::ParseXS::CountLines'->end_marker, "\n" if $WantLineNumbers; $lastline = $_; @@ -597,22 +640,17 @@ EOF # *errbuf = '\0'; EOF - if ($ALIAS) - { print Q(<<"EOF") if $cond } -# if ($cond) -# Perl_croak(aTHX_ "Usage: %s(%s)", GvNAME(CvGV(cv)), "$report_args"); -EOF - else - { print Q(<<"EOF") if $cond } + if($cond) { + print Q(<<"EOF"); # if ($cond) -# Perl_croak(aTHX_ "Usage: %s(%s)", "$pname", "$report_args"); +# croak_xs_usage(cv, "$report_args"); EOF - - # cv doesn't seem to be used, in most cases unless we go in - # the if of this else - print Q(<<"EOF"); + } else { + # cv likely to be unused + print Q(<<"EOF"); # PERL_UNUSED_VAR(cv); /* -W */ EOF + } #gcc -Wall: if an xsub has PPCODE is used #it is possible none of ST, XSRETURN or XSprePUSH macros are used @@ -903,6 +941,7 @@ EOF #XS(XS_${Packid}_nil); /* prototype to pass -Wmissing-prototypes */ #XS(XS_${Packid}_nil) #{ +# dXSARGS; # XSRETURN_EMPTY; #} # @@ -940,7 +979,7 @@ EOF #-Wall: if there is no $Full_func_name there are no xsubs in this .xs #so `file' is unused print Q(<<"EOF") if $Full_func_name; -# char* file = __FILE__; +# const char* file = __FILE__; EOF print Q("#\n"); @@ -1325,9 +1364,9 @@ sub FALLBACK_handler() TrimWhitespace($_) ; my %map = ( - TRUE => "PL_sv_yes", 1 => "PL_sv_yes", - FALSE => "PL_sv_no", 0 => "PL_sv_no", - UNDEF => "PL_sv_undef", + TRUE => "&PL_sv_yes", 1 => "&PL_sv_yes", + FALSE => "&PL_sv_no", 0 => "&PL_sv_no", + UNDEF => "&PL_sv_undef", ) ; # check for valid FALLBACK value diff --git a/gnu/usr.bin/perl/lib/ExtUtils/ParseXS/Changes b/gnu/usr.bin/perl/lib/ExtUtils/ParseXS/Changes new file mode 100644 index 00000000000..b2568d02434 --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/ParseXS/Changes @@ -0,0 +1,231 @@ +Revision history for Perl extension ExtUtils::ParseXS. + +2.2002 - Sat Jul 18 17:22:27 EDT 2009 + + Bug fixes: + - Fix Makefile.PL installdirs for older perls + +2.20_01 - Wed Jul 8 12:12:47 EDT 2009 + + - Fix XSUsage prototypes for testing [Jan Dubois] + +2.20 - Wed Jul 1 13:42:11 EDT 2009 + + - No changes from 2.19_04 + +2.19_04 - Mon Jun 29 11:49:12 EDT 2009 + + - Changed tests to use Test::More and added it to prereqs + + - Some tests skip if no compiler or if no dynamic loading + + - INTERFACE keyword tests skipped for perl < 5.8 + +2.19_03 - Sat Jun 27 22:51:18 EDT 2009 + + - Released to see updated results from smoke testers + + - Fix minor doc typo pulled from blead + +2.19_02 - Wed Aug 6 22:18:33 2008 + + - Fix the usage reports to consistently report package name as well + as sub name across ALIAS, INTERFACE and regular XSUBS. [Robert May] + + - Cleaned up a warning with -Wwrite-strings that gets passed into + every parsed XS file. [Steve Peters] + + - Allow (pedantically correct) C pre-processor comments in the code + snippets of typemap files. [Nicholas Clark] + +2.19 - Sun Feb 17 14:27:40 2008 + + - Fixed the treatment of the OVERLOAD: keyword, which was causing a C + compile error. [Toshiyuki Yamato] + +2.18 - Mon Jan 29 20:56:36 2007 + + - Added some UNITCHECK stuff, which (I think) makes XS code able to + do UNITCHECK blocks. [Nicholas Clark] + + - Changed 'use re "eval";' to 'BEGIN { $^H |= 0x00200000 };' so we + can compile re.xs in bleadperl. [Yves Orton] + + - Fix an undefined-variable warning related to 'inout' parameter + processing. + +2.17 - Mon Nov 20 17:07:27 2006 + + - Stacked $filepathname to make #line directives in #INCLUDEs work. + [Nicholas Clark] + + - Sprinked dVAR in with dXSARGS, for God-(Jarkko)-knows-what + reason. [Jarkko Hietaniemi] + + - Use printf-style formats in Perl_croak() for some significant + savings in number of distinct constant strings in the linked + binaries we create. [Alexey Tourbin] + + - Don't use 'class' as a variable name in the t/XSTest.xs module, + since that's a keyword in C++. [Jarkko Hietaniemi] + +2.16 Fri Sep 15 22:33:24 CDT 2006 + + - Fix a problem with PREFIX not working inside INTERFACE + sections. [Salvador Fandin~o] + +2.15 Mon Oct 10 11:02:13 EDT 2005 + + - I accidentally left out a README from the distribution. Now it's + auto-created from the main documentation in ExtUtils/ParseXS.pm. + +2.14 Sat Oct 8 21:49:15 EDT 2005 + + - The filehandle for the .xs file was never being properly closed, + and now it is. This was causing some Win32 problems with + Module::Build's tests, which create a .xs file, process it with + ParseXS, and then try to remove it. [Spotted by Randy Sims] + +2.13 Mon Oct 3 21:59:06 CDT 2005 + + - Integrate a cleanup-related change from bleadperl that somehow + never got into this copy. [Steve Hay] + +2.12 Wed Aug 24 20:03:09 CDT 2005 + + - On Win32, there was a DLL file we create during testing that we + couldn't delete unless we closed it first, so testing failed when + the deletiong was attempted. This should now work (provided the + version of perl is high enough to have DynaLoader::dl_unload_file() + - I'm not sure what will happen otherwise). [Steve Hay] + + - Fix a spurious warning during testing about a variable that's used + before it's initialized. [Steve Hay] + +2.11 Mon Jun 13 23:00:23 CDT 2005 + + - Make some variables global, to avoid some "will not stay shared" + warnings at compile time. [Rafael Garcia-Suarez] + +2.10 Mon May 30 21:29:44 CDT 2005 + + - This module is being integrated into the perl core; the regression + tests will now work properly when run as part of the core build. + [Yitzchak Scott-Thoennes] + + - Added the ability to create output files with a suffix other than + ".c", via the new "csuffix" option. This gets the module working + on Symbian. [Jarkko Hietaniemi] + + - Added the ability to put 'extern "C"' declarations in front of + prototypes. [Jarkko Hietaniemi] + +2.09 Sun Mar 27 11:11:49 CST 2005 + + - Integrated change #18270 from the perl core, which fixed a problem + in which xsubpp can make nested comments in C code (which is + bad). [Nicholas Clark] + + - When no "MODULE ... PACKAGE ... PREFIX" line is found, it's now + still a fatal error for ParseXS, but we exit with status 0, which + is what the old xsubpp did and seems to work best with some modules + like Win32::NetAdmin. See RT ticket 11472. [Steve Hay] + +2.08 Fri Feb 20 21:41:22 CST 2004 + + - Fixed a problem with backslashes in file paths (e.g. C:\Foo\Bar.xs) + disappearing in error messages. [Randy Sims, Steve Hay] + + - Did a little minor internal code cleanup in the + ExtUtils::ParseXS::CountLines class, now other classes don't poke + around in its package variables. + +2.07 Sun Jan 25 17:01:52 CST 2004 + + - We now use ExtUtils::CBuilder for testing the compile/build phase + in the regression tests. It's not necessary to have it for runtime + usage, though. + + - Fixed a minor documentation error (look in 'Changes' for revision + history, not 'changes.pod'). [Scott R. Godin] + +2.06 Fri Dec 26 09:00:47 CST 2003 + + - Some fixes in the regression tests for the AIX platform. + +2.05 Mon Sep 29 10:33:39 CDT 2003 + + - We no longer trim the directory portions from the "#line " comments + in the generated C code. This helps cooperation with many editors' + auto-jump-to-error stuff. [Ross McFarland] + + - In some cases the PERL_UNUSED_VAR macro is needed to get rid of C + compile-time warnings in generated code. Since this eliminates so + many warnings, turning on "-Wall -W" (or your platform's + equivalent) can once again be helpful. [Ross McFarland] + + - Did a huge amount of variable-scoping cleanup, and it *still* + doesn't compile under 'use strict;'. Much progress was made + though, and many scoping issues were fixed. + +2.04 Thu Sep 4 13:10:59 CDT 2003 + + - Added a COPYRIGHT section to the documentation. [Spotted by Ville + Skytta] + +2.03 Sat Aug 16 17:49:03 CST 2003 + + - Fixed a warning that occurs if a regular expression (buried deep + within the bowels of the code here) fails. [Spotted by Michael + Schwern] + + - Fixed a testing error on Cygwin. [Reini Urban] + +2.02 Sun Mar 30 18:20:12 CST 2003 + + - Now that we know this module doesn't work (yet?) with perl 5.005, + put a couple 'use 5.006' statements in the module & Makefile.PL so + we're explicit about the dependency. [Richard Clamp] + +2.01 Thu Mar 20 08:22:36 CST 2003 + + - Allow -C++ flag for backward compatibility. It's a no-op, and has + been since perl5.003_07. [PodMaster] + +2.00 Sun Feb 23 16:40:17 CST 2003 + + - Tests now function under all three of the supported compilers on + Windows environments. [Randy W. Sims] + + - Will now install to the 'core' perl module directory instead of to + 'site_perl' or the like, because this is the only place MakeMaker + will look for the xsubpp script. + + - Explicitly untie and close the output file handle because ParseXS was + holding the file handle open, preventing the compiler from opening + it on Win32. [Randy W. Sims] + + - Added an '--output FILENAME' flag to xsubpp and changed ParseXS to use + the named file in the #line directives when the output file has an + extension other than '.c' (i.e. '.cpp'). [Randy W. Sims] + + - Added conditional definition of the PERL_UNUSED_VAR macro to the + output file in case it's not already defined for backwards + compatibility with pre-5.8 versions of perl. (Not sure if this is the + best solution.) [Randy W. Sims] + + +1.99 Wed Feb 5 10:07:47 PST 2003 + + - Version bump to 1.99 so it doesn't look like a 'beta release' to + CPAN.pm. No code changes, since I haven't had any bug reports. + + - Fixed a minor problem in the regression tests that was creating an + XSTest..o file instead of XSTest.o + + +1.98_01 Mon Dec 9 11:50:41 EST 2002 + + - Converted from ExtUtils::xsubpp in bleadperl + + - Basic set of regression tests written diff --git a/gnu/usr.bin/perl/lib/ExtUtils/ParseXS/t/XSUsage.pm b/gnu/usr.bin/perl/lib/ExtUtils/ParseXS/t/XSUsage.pm new file mode 100644 index 00000000000..a3754285b90 --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/ParseXS/t/XSUsage.pm @@ -0,0 +1,6 @@ +package XSUsage; + +require DynaLoader; +@ISA = qw(Exporter DynaLoader); +$VERSION = '0.01'; +bootstrap XSUsage $VERSION; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/ParseXS/t/XSUsage.xs b/gnu/usr.bin/perl/lib/ExtUtils/ParseXS/t/XSUsage.xs new file mode 100644 index 00000000000..ec663f8653c --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/ParseXS/t/XSUsage.xs @@ -0,0 +1,37 @@ +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +int xsusage_one() { return 1; } +int xsusage_two() { return 2; } +int xsusage_three() { return 3; } +int xsusage_four() { return 4; } +int xsusage_five(int i) { return 5; } +int xsusage_six(int i) { return 6; } + +MODULE = XSUsage PACKAGE = XSUsage PREFIX = xsusage_ + +PROTOTYPES: DISABLE + +int +xsusage_one() + +int +xsusage_two() + ALIAS: + two_x = 1 + FOO::two = 2 + +int +interface_v_i() + INTERFACE: + xsusage_three + +int +xsusage_four(...) + +int +xsusage_five(int i, ...) + +int +xsusage_six(int i = 0) diff --git a/gnu/usr.bin/perl/lib/ExtUtils/ParseXS/t/basic.t b/gnu/usr.bin/perl/lib/ExtUtils/ParseXS/t/basic.t index 9b5319e56a5..241ab19956f 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/ParseXS/t/basic.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/ParseXS/t/basic.t @@ -9,12 +9,17 @@ BEGIN { } } use strict; -use Test; -BEGIN { plan tests => 10 }; +use Test::More; +use Config; use DynaLoader; -use ExtUtils::ParseXS qw(process_file); use ExtUtils::CBuilder; -ok(1); # If we made it this far, we're loaded. + +plan tests => 10; + +my ($source_file, $obj_file, $lib_file); + +require_ok( 'ExtUtils::ParseXS' ); +ExtUtils::ParseXS->import('process_file'); chdir 't' or die "Can't chdir to t/, $!"; @@ -25,32 +30,35 @@ use Carp; $SIG{__WARN__} = \&Carp::cluck; # Try sending to filehandle tie *FH, 'Foo'; process_file( filename => 'XSTest.xs', output => \*FH, prototypes => 1 ); -ok tied(*FH)->content, '/is_even/', "Test that output contains some text"; +like tied(*FH)->content, '/is_even/', "Test that output contains some text"; -my $source_file = 'XSTest.c'; +$source_file = 'XSTest.c'; # Try sending to file process_file(filename => 'XSTest.xs', output => $source_file, prototypes => 0); -ok -e $source_file, 1, "Create an output file"; +ok -e $source_file, "Create an output file"; -# TEST doesn't like extraneous output my $quiet = $ENV{PERL_CORE} && !$ENV{HARNESS_ACTIVE}; - -# Try to compile the file! Don't get too fancy, though. my $b = ExtUtils::CBuilder->new(quiet => $quiet); -if ($b->have_compiler) { - my $module = 'XSTest'; - my $obj_file = $b->compile( source => $source_file ); +SKIP: { + skip "no compiler available", 2 + if ! $b->have_compiler; + $obj_file = $b->compile( source => $source_file ); ok $obj_file; - ok -e $obj_file, 1, "Make sure $obj_file exists"; + ok -e $obj_file, "Make sure $obj_file exists"; +} - my $lib_file = $b->link( objects => $obj_file, module_name => $module ); +SKIP: { + skip "no dynamic loading", 5 + if !$b->have_compiler || !$Config{usedl}; + my $module = 'XSTest'; + $lib_file = $b->link( objects => $obj_file, module_name => $module ); ok $lib_file; - ok -e $lib_file, 1, "Make sure $lib_file exists"; + ok -e $lib_file, "Make sure $lib_file exists"; eval {require XSTest}; - ok $@, ''; + is $@, ''; ok XSTest::is_even(8); ok !XSTest::is_even(9); @@ -64,13 +72,14 @@ if ($b->have_compiler) { } } } - 1 while unlink $obj_file; - 1 while unlink $lib_file; -} else { - skip "Skipped can't find a C compiler & linker", 1 for 1..7; } -1 while unlink $source_file; +unless ($ENV{PERL_NO_CLEANUP}) { + for ( $obj_file, $lib_file, $source_file) { + next unless defined $_; + 1 while unlink $_; + } +} ##################################################################### diff --git a/gnu/usr.bin/perl/lib/ExtUtils/ParseXS/t/usage.t b/gnu/usr.bin/perl/lib/ExtUtils/ParseXS/t/usage.t new file mode 100755 index 00000000000..39a6e4157f4 --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/ParseXS/t/usage.t @@ -0,0 +1,125 @@ +#!/usr/bin/perl + +BEGIN { + if ($ENV{PERL_CORE}) { + chdir 't' if -d 't'; + chdir '../lib/ExtUtils/ParseXS' + or die "Can't chdir to lib/ExtUtils/ParseXS: $!"; + @INC = qw(../.. ../../.. .); + } +} +use strict; +use Test::More; +use Config; +use DynaLoader; +use ExtUtils::CBuilder; + +if ( $] < 5.008 ) { + plan skip_all => "INTERFACE keyword support broken before 5.8"; +} +else { + plan tests => 24; +} + +my ($source_file, $obj_file, $lib_file, $module); + +require_ok( 'ExtUtils::ParseXS' ); +ExtUtils::ParseXS->import('process_file'); + +chdir 't' or die "Can't chdir to t/, $!"; + +use Carp; $SIG{__WARN__} = \&Carp::cluck; + +######################### + +$source_file = 'XSUsage.c'; + +# Try sending to file +process_file(filename => 'XSUsage.xs', output => $source_file); +ok -e $source_file, "Create an output file"; + +# TEST doesn't like extraneous output +my $quiet = $ENV{PERL_CORE} && !$ENV{HARNESS_ACTIVE}; + +# Try to compile the file! Don't get too fancy, though. +my $b = ExtUtils::CBuilder->new(quiet => $quiet); + +SKIP: { + skip "no compiler available", 2 + if ! $b->have_compiler; + $module = 'XSUsage'; + + $obj_file = $b->compile( source => $source_file ); + ok $obj_file; + ok -e $obj_file, "Make sure $obj_file exists"; +} +SKIP: { + skip "no dynamic loading", 20 + if !$b->have_compiler || !$Config{usedl}; + + $lib_file = $b->link( objects => $obj_file, module_name => $module ); + ok $lib_file; + ok -e $lib_file, "Make sure $lib_file exists"; + + eval {require XSUsage}; + is $@, ''; + + # The real tests here - for each way of calling the functions, call with the + # wrong number of arguments and check the Usage line is what we expect + + eval { XSUsage::one(1) }; + ok $@; + ok $@ =~ /^Usage: XSUsage::one/; + + eval { XSUsage::two(1) }; + ok $@; + ok $@ =~ /^Usage: XSUsage::two/; + + eval { XSUsage::two_x(1) }; + ok $@; + ok $@ =~ /^Usage: XSUsage::two_x/; + + eval { FOO::two(1) }; + ok $@; + ok $@ =~ /^Usage: FOO::two/; + + eval { XSUsage::three(1) }; + ok $@; + ok $@ =~ /^Usage: XSUsage::three/; + + eval { XSUsage::four(1) }; + ok !$@; + + eval { XSUsage::five() }; + ok $@; + ok $@ =~ /^Usage: XSUsage::five/; + + eval { XSUsage::six() }; + ok !$@; + + eval { XSUsage::six(1) }; + ok !$@; + + eval { XSUsage::six(1,2) }; + ok $@; + ok $@ =~ /^Usage: XSUsage::six/; + + # Win32 needs to close the DLL before it can unlink it, but unfortunately + # dl_unload_file was missing on Win32 prior to perl change #24679! + if ($^O eq 'MSWin32' and defined &DynaLoader::dl_unload_file) { + for (my $i = 0; $i < @DynaLoader::dl_modules; $i++) { + if ($DynaLoader::dl_modules[$i] eq $module) { + DynaLoader::dl_unload_file($DynaLoader::dl_librefs[$i]); + last; + } + } + } +} + +unless ($ENV{PERL_NO_CLEANUP}) { + for ( $obj_file, $lib_file, $source_file) { + next unless defined $_; + 1 while unlink $_; + } +} + diff --git a/gnu/usr.bin/perl/lib/ExtUtils/TODO b/gnu/usr.bin/perl/lib/ExtUtils/TODO index fe5a703a2bf..e5cd355e573 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/TODO +++ b/gnu/usr.bin/perl/lib/ExtUtils/TODO @@ -73,3 +73,6 @@ Make out of date check on 'make dist' more useful http://archive.develooper.com/makemaker@perl.org/msg01075.html Make maniadd() return a tied, case-insensitive hash on VMS. + + +TER
\ No newline at end of file diff --git a/gnu/usr.bin/perl/lib/ExtUtils/XSSymSet.pm b/gnu/usr.bin/perl/lib/ExtUtils/XSSymSet.pm new file mode 100644 index 00000000000..548c7ea5538 --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/XSSymSet.pm @@ -0,0 +1,237 @@ +package ExtUtils::XSSymSet; + +use strict; +use vars qw( $VERSION ); +$VERSION = '1.1'; + + +sub new { + my($pkg,$maxlen,$silent) = @_; + $maxlen ||= 31; + $silent ||= 0; + my($obj) = { '__M@xLen' => $maxlen, '__S!lent' => $silent }; + bless $obj, $pkg; +} + + +sub trimsym { + my($self,$name,$maxlen,$silent) = @_; + + unless (defined $maxlen) { + if (ref $self) { $maxlen ||= $self->{'__M@xLen'}; } + $maxlen ||= 31; + } + unless (defined $silent) { + if (ref $self) { $silent ||= $self->{'__S!lent'}; } + $silent ||= 0; + } + return $name if (length $name <= $maxlen); + + my $trimmed = $name; + # First, just try to remove duplicated delimiters + $trimmed =~ s/__/_/g; + if (length $trimmed > $maxlen) { + # Next, all duplicated chars + $trimmed =~ s/(.)\1+/$1/g; + if (length $trimmed > $maxlen) { + my $squeezed = $trimmed; + my($xs,$prefix,$func) = $trimmed =~ /^(XS_)?(.*)_([^_]*)$/; + $xs ||= ''; + my $frac = 3; # replaces broken length-based calculations but w/same result + my $pat = '([^_])'; + if (length $func <= 12) { # Try to preserve short function names + if ($frac > 1) { $pat .= '[^A-Z_]{' . ($frac - 1) . '}'; } + $prefix =~ s/$pat/$1/g; + $squeezed = "$xs$prefix" . "_$func"; + if (length $squeezed > $maxlen) { + $pat =~ s/A-Z//; + $prefix =~ s/$pat/$1/g; + $squeezed = "$xs$prefix" . "_$func"; + } + } + else { + if ($frac > 1) { $pat .= '[^A-Z_]{' . ($frac - 1) . '}'; } + $squeezed = "$prefix$func"; + $squeezed =~ s/$pat/$1/g; + if (length "$xs$squeezed" > $maxlen) { + $pat =~ s/A-Z//; + $squeezed =~ s/$pat/$1/g; + } + $squeezed = "$xs$squeezed"; + } + if (length $squeezed <= $maxlen) { $trimmed = $squeezed; } + else { + my $frac = int((length $trimmed - $maxlen) / length $trimmed + 0.5); + my $pat = '(.).{$frac}'; + $trimmed =~ s/$pat/$1/g; + } + } + } + warn "Warning: long symbol $name\n\ttrimmed to $trimmed\n\t" unless $silent; + return $trimmed; +} + + +sub addsym { + my($self,$sym,$maxlen,$silent) = @_; + my $trimmed = $self->get_trimmed($sym); + + return $trimmed if defined $trimmed; + + $maxlen ||= $self->{'__M@xLen'} || 31; + $silent ||= $self->{'__S!lent'} || 0; + $trimmed = $self->trimsym($sym,$maxlen,1); + if (exists $self->{$trimmed}) { + my($i) = "00"; + $trimmed = $self->trimsym($sym,$maxlen-3,$silent); + while (exists $self->{"${trimmed}_$i"}) { $i++; } + warn "Warning: duplicate symbol $trimmed\n\tchanged to ${trimmed}_$i\n\t(original was $sym)\n\t" + unless $silent; + $trimmed .= "_$i"; + } + elsif (not $silent and $trimmed ne $sym) { + warn "Warning: long symbol $sym\n\ttrimmed to $trimmed\n\t"; + } + $self->{$trimmed} = $sym; + $self->{'__N+Map'}->{$sym} = $trimmed; + $trimmed; +} + + +sub delsym { + my($self,$sym) = @_; + my $trimmed = $self->{'__N+Map'}->{$sym}; + if (defined $trimmed) { + delete $self->{'__N+Map'}->{$sym}; + delete $self->{$trimmed}; + } + $trimmed; +} + + +sub get_trimmed { + my($self,$sym) = @_; + $self->{'__N+Map'}->{$sym}; +} + + +sub get_orig { + my($self,$trimmed) = @_; + $self->{$trimmed}; +} + + +sub all_orig { (keys %{$_[0]->{'__N+Map'}}); } +sub all_trimmed { (grep { /^\w+$/ } keys %{$_[0]}); } + +__END__ + +=head1 NAME + +ExtUtils::XSSymSet - keep sets of symbol names palatable to the VMS linker + +=head1 SYNOPSIS + + use ExtUtils::XSSymSet; + + $set = new ExtUtils::XSSymSet; + while ($sym = make_symbol()) { $set->addsym($sym); } + foreach $safesym ($set->all_trimmed) { + print "Processing $safesym (derived from ",$self->get_orig($safesym),")\n"; + do_stuff($safesym); + } + + $safesym = ExtUtils::XSSymSet->trimsym($onesym); + +=head1 DESCRIPTION + +Since the VMS linker distinguishes symbols based only on the first 31 +characters of their names, it is occasionally necessary to shorten +symbol names in order to avoid collisions. (This is especially true of +names generated by xsubpp, since prefixes generated by nested package +names can become quite long.) C<ExtUtils::XSSymSet> provides functions to +shorten names in a consistent fashion, and to track a set of names to +insure that each is unique. While designed with F<xsubpp> in mind, it +may be used with any set of strings. + +This package supplies the following functions, all of which should be +called as methods. + +=over 4 + +=item new([$maxlen[,$silent]]) + +Creates an empty C<ExtUtils::XSSymset> set of symbols. This function may be +called as a static method or via an existing object. If C<$maxlen> or +C<$silent> are specified, they are used as the defaults for maximum +name length and warning behavior in future calls to addsym() or +trimsym() via this object. + +=item addsym($name[,$maxlen[,$silent]]) + +Creates a symbol name from C<$name>, using the methods described +under trimsym(), which is unique in this set of symbols, and returns +the new name. C<$name> and its resultant are added to the set, and +any future calls to addsym() specifying the same C<$name> will return +the same result, regardless of the value of C<$maxlen> specified. +Unless C<$silent> is true, warnings are output if C<$name> had to be +trimmed or changed in order to avoid collision with an existing symbol +name. C<$maxlen> and C<$silent> default to the values specified when +this set of symbols was created. This method must be called via an +existing object. + +=item trimsym($name[,$maxlen[,$silent]]) + +Creates a symbol name C<$maxlen> or fewer characters long from +C<$name> and returns it. If C<$name> is too long, it first tries to +shorten it by removing duplicate characters, then by periodically +removing non-underscore characters, and finally, if necessary, by +periodically removing characters of any type. C<$maxlen> defaults +to 31. Unless C<$silent> is true, a warning is output if C<$name> +is altered in any way. This function may be called either as a +static method or via an existing object, but in the latter case no +check is made to insure that the resulting name is unique in the +set of symbols. + +=item delsym($name) + +Removes C<$name> from the set of symbols, where C<$name> is the +original symbol name passed previously to addsym(). If C<$name> +existed in the set of symbols, returns its "trimmed" equivalent, +otherwise returns C<undef>. This method must be called via an +existing object. + +=item get_orig($trimmed) + +Returns the original name which was trimmed to C<$trimmed> by a +previous call to addsym(), or C<undef> if C<$trimmed> does not +correspond to a member of this set of symbols. This method must be +called via an existing object. + +=item get_trimmed($name) + +Returns the trimmed name which was generated from C<$name> by a +previous call to addsym(), or C<undef> if C<$name> is not a member +of this set of symbols. This method must be called via an +existing object. + +=item all_orig() + +Returns a list containing all of the original symbol names +from this set. + +=item all_trimmed() + +Returns a list containing all of the trimmed symbol names +from this set. + +=back + +=head1 AUTHOR + +Charles Bailey E<lt>I<bailey@newman.upenn.edu>E<gt> + +=head1 REVISION + +Last revised 14-Feb-1997, for Perl 5.004. + diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/00compile.t b/gnu/usr.bin/perl/lib/ExtUtils/t/00compile.t index e2995dc4a2e..20f7ded6f44 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/00compile.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/00compile.t @@ -10,8 +10,6 @@ BEGIN { } chdir 't'; -use File::Find; -use File::Spec; use Test::More; my $Has_Test_Pod; @@ -19,22 +17,23 @@ BEGIN { $Has_Test_Pod = eval 'use Test::Pod 0.95; 1'; } -chdir File::Spec->updir; -my $manifest = File::Spec->catfile('MANIFEST'); -open(MANIFEST, $manifest) or die "Can't open $manifest: $!"; +chdir ".."; +my $manifest = "MANIFEST"; +open(my $manifest_fh, "<", $manifest) or die "Can't open $manifest: $!"; my @modules = map { m{^lib/(\S+)}; $1 } grep { m{^lib/ExtUtils/\S*\.pm} } - grep { !m{/t/} } <MANIFEST>; + grep { !m{/t/} } <$manifest_fh>; chomp @modules; -close MANIFEST; +close $manifest_fh; chdir 'lib'; plan tests => scalar @modules * 2; foreach my $file (@modules) { - # 5.8.0 has a bug about require alone in an eval. Thus the extra - # statement. - eval { require($file); 1 }; - is( $@, '', "require $file" ); + # Make sure we look at the local files and do not reload them if + # they're already loaded. This avoids recompilation warnings. + local @INC = @INC; + unshift @INC, "."; + ok eval { require($file); 1 } or diag "require $file failed.\n$@"; SKIP: { skip "Test::Pod not installed", 1 unless $Has_Test_Pod; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/Constant.t b/gnu/usr.bin/perl/lib/ExtUtils/t/Constant.t index 7c997fe21ba..02b7528bcb4 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/Constant.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/Constant.t @@ -47,8 +47,29 @@ if ($^O eq 'MSWin32' && $make eq 'nmake') { $make .= " -nologo"; } # VMS may be using something other than MMS/MMK my $mms_or_mmk = 0; +my $vms_lc = 0; +my $vms_nodot = 0; if ($^O eq 'VMS') { - $mms_or_mmk = 1 if (($make eq 'MMK') || ($make eq 'MMS')); + $mms_or_mmk = 1 if (($make eq 'MMK') || ($make eq 'MMS')); + $vms_lc = 1; + $vms_nodot = 1; + my $vms_unix_rpt = 0; + my $vms_efs = 0; + my $vms_efs_case = 0; + if (eval 'require VMS::Feature') { + $vms_unix_rpt = VMS::Feature::current("filename_unix_report"); + $vms_efs = VMS::Feature::current("efs_case_preserve"); + $vms_efs_case = VMS::Feature::current("efs_charset"); + } else { + my $unix_rpt = $ENV{'DECC$FILENAME_UNIX_REPORT'} || ''; + my $efs_charset = $ENV{'DECC$EFS_CHARSET'} || ''; + my $efs_case = $ENV{'DECC$EFS_CASE_PRESERVE'} || ''; + $vms_unix_rpt = $unix_rpt =~ /^[ET1]/i; + $vms_efs = $efs_charset =~ /^[ET1]/i; + $vms_efs_case = $efs_case =~ /^[ET1]/i; + } + $vms_lc = 0 if $vms_efs_case; + $vms_nodot = 0 if $vms_unix_rpt; } # Renamed by make clean @@ -111,12 +132,12 @@ package main; sub check_for_bonus_files { my $dir = shift; - my %expect = map {($^O eq 'VMS' ? lc($_) : $_), 1} @_; + my %expect = map {($vms_lc ? lc($_) : $_), 1} @_; my $fail; opendir DIR, $dir or die "opendir '$dir': $!"; while (defined (my $entry = readdir DIR)) { - $entry =~ s/\.$// if $^O eq 'VMS'; # delete trailing dot that indicates no extension + $entry =~ s/\.$// if $vms_nodot; # delete trailing dot that indicates no extension next if $expect{$entry}; print "# Extra file '$entry'\n"; $fail = 1; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/Embed.t b/gnu/usr.bin/perl/lib/ExtUtils/t/Embed.t index e3321ecd471..2aece548bfb 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/Embed.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/Embed.t @@ -105,10 +105,8 @@ if ($^O eq 'VMS') { s!-bE:(\S+)!-bE:$perl_exp!; } } - elsif ($^O eq 'cygwin') { # Cygwin needs the shared libperl copied - my $v_e_r_s = $Config{version}; - $v_e_r_s =~ tr/./_/; - system("cp ../cygperl$v_e_r_s.dll ./"); # for test 1 + elsif ($^O eq 'cygwin') { # Cygwin needs no special treatment like below + ; } elsif ($Config{'libperl'} !~ /\Alibperl\./) { # Everyone needs libperl copied if it's not found by '-lperl'. @@ -137,7 +135,7 @@ print "# $_\n" foreach @out; if ($^O eq 'VMS' && !$status) { print "# @cmd2\n"; - $status = system(join(' ',@cmd2)); + $status = system(join(' ',@cmd2)); } print (($status? 'not ': '')."ok 1\n"); @@ -163,7 +161,7 @@ __END__ #define my_puts(a) if(puts(a) < 0) exit(666) -static char *cmds[] = { "perl","-e", "$|=1; print qq[ok 5\\n]", NULL }; +static const char * cmds [] = { "perl", "-e", "$|=1; print qq[ok 5\\n]", NULL }; #ifdef PERL_GLOBAL_STRUCT_PRIVATE static struct perl_vars *my_plvarsp; @@ -171,12 +169,11 @@ struct perl_vars* Perl_GetVarsPrivate(void) { return my_plvarsp; } #endif #ifdef NO_ENV_ARRAY_IN_MAIN -extern char **environ; -int main(int argc, char **argv) +int main(int argc, char **argv) { + char **env; #else -int main(int argc, char **argv, char **env) +int main(int argc, char **argv, char **env) { #endif -{ PerlInterpreter *my_perl; #ifdef PERL_GLOBAL_STRUCT dVAR; @@ -188,11 +185,7 @@ int main(int argc, char **argv, char **env) (void)argc; /* PERL_SYS_INIT3 may #define away their use */ (void)argv; -#ifdef NO_ENV_ARRAY_IN_MAIN - PERL_SYS_INIT3(&argc,&argv,&environ); -#else - PERL_SYS_INIT3(&argc,&argv,&env); -#endif + PERL_SYS_INIT3(&argc, &argv, &env); my_perl = perl_alloc(); @@ -202,11 +195,7 @@ int main(int argc, char **argv, char **env) my_puts("ok 3"); -#ifdef NO_ENV_ARRAY_IN_MAIN - perl_parse(my_perl, NULL, (sizeof(cmds)/sizeof(char *))-1, cmds, environ); -#else - perl_parse(my_perl, NULL, (sizeof(cmds)/sizeof(char *))-1, cmds, env); -#endif + perl_parse(my_perl, NULL, (sizeof(cmds)/sizeof(char *))-1, (char **)cmds, env); my_puts("ok 4"); diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/INSTALL_BASE.t b/gnu/usr.bin/perl/lib/ExtUtils/t/INSTALL_BASE.t index cac65f266f0..95c62cc060d 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/INSTALL_BASE.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/INSTALL_BASE.t @@ -16,7 +16,7 @@ use strict; use File::Path; use Config; -use Test::More tests => 21; +use Test::More tests => 20; use MakeMaker::Test::Utils; use MakeMaker::Test::Setup::BFD; @@ -51,7 +51,6 @@ 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; like( $install_out, qr/^Installing /m ); -like( $install_out, qr/^Writing /m ); ok( -r '../dummy-install', ' install dir created' ); diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/Install.t b/gnu/usr.bin/perl/lib/ExtUtils/t/Install.t index ae8d7811047..a30515ea949 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/Install.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/Install.t @@ -17,11 +17,14 @@ use TieOut; use File::Path; use File::Spec; -use Test::More tests => 38; +use Test::More tests => 52; use MakeMaker::Test::Setup::BFD; BEGIN { use_ok('ExtUtils::Install') } +# ensure the env doesnt pollute our tests +local $ENV{EU_INSTALL_ALWAYS_COPY}; +local $ENV{EU_ALWAYS_COPY}; # Check exports. foreach my $func (qw(install uninstall pm_to_blib install_default)) { @@ -122,6 +125,56 @@ close DUMMY; ' UNINST=0 left different' ); } +# Test UNINST=1 only warning when failing to remove an irrelevent shadow file +{ + my $tfile='install-test/lib/perl/Big/Dummy.pm'; + local $ExtUtils::Install::Testing = $tfile; + local @INC = ('install-test/other_lib/perl','install-test/lib/perl'); + local $ENV{PERL5LIB} = ''; + ok( -r $tfile, 'different install exists' ); + my @warn; + local $SIG{__WARN__}=sub { push @warn, @_; return }; + my $ok=eval { + install( { 'blib/lib' => 'install-test/other_lib/perl', + read => 'install-test/packlist', + write => 'install-test/packlist' + }, + 0, 0, 1); + 1 + }; + ok($ok,' we didnt die'); + ok(0+@warn," we did warn"); + ok( -d 'install-test/other_lib/perl', 'install made other dir' ); + ok( -r 'install-test/other_lib/perl/Big/Dummy.pm', ' .pm file installed' ); + ok( -r 'install-test/packlist', ' packlist exists' ); + ok( -r $tfile, ' UNINST=1 failed to remove different' ); + +} + +# Test UNINST=1 dieing when failing to remove an relevent shadow file +{ + my $tfile='install-test/lib/perl/Big/Dummy.pm'; + local $ExtUtils::Install::Testing = $tfile; + local @INC = ('install-test/lib/perl','install-test/other_lib/perl'); + local $ENV{PERL5LIB} = ''; + ok( -r $tfile, 'different install exists' ); + my @warn; + local $SIG{__WARN__}=sub { push @warn,@_; return }; + my $ok=eval { + install( { 'blib/lib' => 'install-test/other_lib/perl', + read => 'install-test/packlist', + write => 'install-test/packlist' + }, + 0, 0, 1); + 1 + }; + ok(!$ok,' we did die'); + ok(!@warn," we didnt warn"); + ok( -d 'install-test/other_lib/perl', 'install made other dir' ); + ok( -r 'install-test/other_lib/perl/Big/Dummy.pm', ' .pm file installed' ); + ok( -r 'install-test/packlist', ' packlist exists' ); + ok( -r $tfile,' UNINST=1 failed to remove different' ); +} # Test UNINST=1 removing other versions in other dirs. { @@ -138,3 +191,4 @@ close DUMMY; ok( !-r 'install-test/lib/perl/Big/Dummy.pm', ' UNINST=1 removed different' ); } + diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/InstallWithMM.t b/gnu/usr.bin/perl/lib/ExtUtils/t/InstallWithMM.t new file mode 100755 index 00000000000..354b8f4d352 --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/InstallWithMM.t @@ -0,0 +1,95 @@ +#!/usr/bin/perl -w + +# Make sure EUI works with MakeMaker + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = ('../lib', 'lib'); + } + else { + unshift @INC, 't/lib'; + } +} + +use strict; +use Config; +use ExtUtils::MakeMaker; + +use Test::More tests => 15; +use MakeMaker::Test::Utils; +use MakeMaker::Test::Setup::BFD; +use File::Find; +use File::Spec; +use File::Path; + +my $make = make_run(); + +# Environment variables which interfere with our testing. +delete @ENV{qw(PREFIX LIB MAKEFLAGS)}; + +# Run Makefile.PL +{ + my $perl = which_perl(); + my $Is_VMS = $^O eq '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); + + END { unlink makefile_name(), makefile_backup() } +} + + +# make +{ + my $make_out = run($make); + is( $?, 0, 'make ran ok' ) || + diag($make_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' ); +} diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/Installapi2.t b/gnu/usr.bin/perl/lib/ExtUtils/t/Installapi2.t new file mode 100755 index 00000000000..c59b8abb389 --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/Installapi2.t @@ -0,0 +1,238 @@ +#!/usr/bin/perl -w + +# Test ExtUtils::Install. + +BEGIN { + if( $ENV{PERL_CORE} ) { + @INC = ('../../lib', '../lib', 'lib'); + } + else { + unshift @INC, 't/lib'; + } +} +chdir 't'; + +use strict; +use TieOut; +use File::Path; +use File::Spec; + +use Test::More tests => 70; + +use MakeMaker::Test::Setup::BFD; + +BEGIN { use_ok('ExtUtils::Install') } + +# Check exports. +foreach my $func (qw(install uninstall pm_to_blib install_default)) { + can_ok(__PACKAGE__, $func); +} + + +ok( setup_recurs(), 'setup' ); +END { + ok( chdir File::Spec->updir ); + ok( teardown_recurs(), 'teardown' ); +} +# ensure the env doesnt pollute our tests +local $ENV{EU_INSTALL_ALWAYS_COPY}; +local $ENV{EU_ALWAYS_COPY}; + +chdir 'Big-Dummy'; + +my $stdout = tie *STDOUT, 'TieOut'; +pm_to_blib( { 'lib/Big/Dummy.pm' => 'blib/lib/Big/Dummy.pm' }, + 'blib/lib/auto' + ); +END { rmtree 'blib' } + +ok( -d 'blib/lib', 'pm_to_blib created blib dir' ); +ok( -r 'blib/lib/Big/Dummy.pm', ' copied .pm file' ); +ok( -r 'blib/lib/auto', ' created autosplit dir' ); +is( $stdout->read, "cp lib/Big/Dummy.pm blib/lib/Big/Dummy.pm\n" ); + +pm_to_blib( { 'lib/Big/Dummy.pm' => 'blib/lib/Big/Dummy.pm' }, + 'blib/lib/auto' + ); +ok( -d 'blib/lib', 'second run, blib dir still there' ); +ok( -r 'blib/lib/Big/Dummy.pm', ' .pm file still there' ); +ok( -r 'blib/lib/auto', ' autosplit still there' ); +is( $stdout->read, "Skip blib/lib/Big/Dummy.pm (unchanged)\n" ); + +install( [ + from_to=>{ 'blib/lib' => 'install-test/lib/perl', + read => 'install-test/packlist', + write => 'install-test/packlist' + }, + dry_run=>1]); +ok( ! -d 'install-test/lib/perl', 'install made dir (dry run)'); +ok( ! -r 'install-test/lib/perl/Big/Dummy.pm', + ' .pm file installed (dry run)'); +ok( ! -r 'install-test/packlist', ' packlist exists (dry run)'); + +install([ from_to=> { 'blib/lib' => 'install-test/lib/perl', + read => 'install-test/packlist', + write => 'install-test/packlist' + } ]); +ok( -d 'install-test/lib/perl', 'install made dir' ); +ok( -r 'install-test/lib/perl/Big/Dummy.pm', ' .pm file installed' ); +ok(!-r 'install-test/lib/perl/Big/Dummy.SKIP', ' ignored .SKIP file' ); +ok( -r 'install-test/packlist', ' packlist exists' ); + +open(PACKLIST, 'install-test/packlist' ); +my %packlist = map { chomp; ($_ => 1) } <PACKLIST>; +close PACKLIST; + +# On case-insensitive filesystems (ie. VMS), the keys of the packlist might +# be lowercase. :( +my $native_dummy = File::Spec->catfile(qw(install-test lib perl Big Dummy.pm)); +is( keys %packlist, 1 ); +is( lc((keys %packlist)[0]), lc $native_dummy, 'packlist written' ); + + +# Test UNINST=1 preserving same versions in other dirs. +install([from_to=> { 'blib/lib' => 'install-test/other_lib/perl', + read => 'install-test/packlist', + write => 'install-test/packlist' + },uninstall_shadows=>1]); +ok( -d 'install-test/other_lib/perl', 'install made other dir' ); +ok( -r 'install-test/other_lib/perl/Big/Dummy.pm', ' .pm file installed' ); +ok( -r 'install-test/packlist', ' packlist exists' ); +ok( -r 'install-test/lib/perl/Big/Dummy.pm', ' UNINST=1 preserved same' ); + + +chmod 0644, 'blib/lib/Big/Dummy.pm' or die $!; +open(DUMMY, ">>blib/lib/Big/Dummy.pm") or die $!; +print DUMMY "Extra stuff\n"; +close DUMMY; + + +# Test UNINST=0 does not remove other versions in other dirs. +{ + ok( -r 'install-test/lib/perl/Big/Dummy.pm', 'different install exists' ); + + local @INC = ('install-test/lib/perl'); + local $ENV{PERL5LIB} = ''; + install([from_to=> { 'blib/lib' => 'install-test/other_lib/perl', + read => 'install-test/packlist', + write => 'install-test/packlist' + }]); + ok( -d 'install-test/other_lib/perl', 'install made other dir' ); + ok( -r 'install-test/other_lib/perl/Big/Dummy.pm', ' .pm file installed' ); + ok( -r 'install-test/packlist', ' packlist exists' ); + ok( -r 'install-test/lib/perl/Big/Dummy.pm', + ' UNINST=0 left different' ); +} + +# Test UNINST=1 only warning when failing to remove an irrelevent shadow file +{ + my $tfile='install-test/lib/perl/Big/Dummy.pm'; + local $ExtUtils::Install::Testing = $tfile; + local @INC = ('install-test/other_lib/perl','install-test/lib/perl'); + local $ENV{PERL5LIB} = ''; + ok( -r $tfile, 'different install exists' ); + my @warn; + local $SIG{__WARN__}=sub { push @warn, @_; return }; + my $ok=eval { + install([from_to=> { 'blib/lib' => 'install-test/other_lib/perl', + read => 'install-test/packlist', + write => 'install-test/packlist' + }, + uninstall_shadows=>1]); + 1 + }; + ok($ok,' we didnt die'); + ok(0+@warn," we did warn"); + ok( -d 'install-test/other_lib/perl', 'install made other dir' ); + ok( -r 'install-test/other_lib/perl/Big/Dummy.pm', ' .pm file installed' ); + ok( -r 'install-test/packlist', ' packlist exists' ); + ok( -r $tfile, ' UNINST=1 failed to remove different' ); + +} + +# Test UNINST=1 dieing when failing to remove an relevent shadow file +{ + my $tfile='install-test/lib/perl/Big/Dummy.pm'; + local $ExtUtils::Install::Testing = $tfile; + local @INC = ('install-test/lib/perl','install-test/other_lib/perl'); + local $ENV{PERL5LIB} = ''; + ok( -r $tfile, 'different install exists' ); + my @warn; + local $SIG{__WARN__}=sub { push @warn,@_; return }; + my $ok=eval { + install([from_to=> { 'blib/lib' => 'install-test/other_lib/perl', + read => 'install-test/packlist', + write => 'install-test/packlist' + },uninstall_shadows=>1]); + 1 + }; + ok(!$ok,' we did die'); + ok(!@warn," we didnt warn"); + ok( -d 'install-test/other_lib/perl', 'install made other dir' ); + ok( -r 'install-test/other_lib/perl/Big/Dummy.pm', ' .pm file installed' ); + ok( -r 'install-test/packlist', ' packlist exists' ); + ok( -r $tfile,' UNINST=1 failed to remove different' ); +} + +# Test UNINST=1 removing other versions in other dirs. +{ + local @INC = ('install-test/lib/perl'); + local $ENV{PERL5LIB} = ''; + ok( -r 'install-test/lib/perl/Big/Dummy.pm','different install exists' ); + install([from_to=>{ 'blib/lib' => 'install-test/other_lib/perl', + read => 'install-test/packlist', + write => 'install-test/packlist' + },uninstall_shadows=>1]); + ok( -d 'install-test/other_lib/perl', 'install made other dir' ); + ok( -r 'install-test/other_lib/perl/Big/Dummy.pm', ' .pm file installed' ); + ok( -r 'install-test/packlist', ' packlist exists' ); + ok( !-r 'install-test/lib/perl/Big/Dummy.pm', + ' UNINST=1 removed different' ); +} + +# Test EU_ALWAYS_COPY triggers copy. +{ + local @INC = ('install-test/lib/perl'); + local $ENV{PERL5LIB} = ''; + local $ENV{EU_INSTALL_ALWAYS_COPY}=1; + my $tfile='install-test/other_lib/perl/Big/Dummy.pm'; + my $sfile='blib/lib/Big/Dummy.pm'; + ok(-r $tfile,"install file already exists"); + ok(-r $sfile,"source file already exists"); + utime time-600, time-600, $sfile or die "utime '$sfile' failed:$!"; + ok( (stat $tfile)[9]!=(stat $sfile)[9],' Times are different'); + install([from_to=>{ 'blib/lib' => 'install-test/other_lib/perl', + read => 'install-test/packlist', + write => 'install-test/packlist' + },result=>\my %result]); + ok( -d 'install-test/other_lib/perl', 'install made other dir' ); + ok( -r 'install-test/other_lib/perl/Big/Dummy.pm', ' .pm file installed' ); + ok( -r 'install-test/packlist', ' packlist exists' ); +SKIP: { + skip "Times not preserved during copy by default", 1 if $^O eq 'VMS'; + ok( (stat $tfile)[9]==(stat $sfile)[9],' Times are same'); +} + ok( !$result{install_unchanged},' $result{install_unchanged} should be empty'); +} +# Test nothing is copied. +{ + local @INC = ('install-test/lib/perl'); + local $ENV{PERL5LIB} = ''; + local $ENV{EU_INSTALL_ALWAYS_COPY}=0; + my $tfile='install-test/other_lib/perl/Big/Dummy.pm'; + my $sfile='blib/lib/Big/Dummy.pm'; + ok(-r $tfile,"install file already exists"); + ok(-r $sfile,"source file already exists"); + utime time-1200, time-1200, $sfile or die "utime '$sfile' failed:$!"; + ok( (stat $tfile)[9]!=(stat $sfile)[9],' Times are different'); + install([from_to=>{ 'blib/lib' => 'install-test/other_lib/perl', + read => 'install-test/packlist', + write => 'install-test/packlist' + },result=>\my %result]); + ok( -d 'install-test/other_lib/perl', 'install made other dir' ); + ok( -r 'install-test/other_lib/perl/Big/Dummy.pm', ' .pm file installed' ); + ok( -r 'install-test/packlist', ' packlist exists' ); + ok( (stat $tfile)[9]!=(stat$sfile)[9],' Times are different'); + ok( !$result{install},' nothing should have been installed'); + ok( $result{install_unchanged},' install_unchanged should be populated'); +} diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/Installed.t b/gnu/usr.bin/perl/lib/ExtUtils/t/Installed.t index f820ef49c61..dd492c2d1d9 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/Installed.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/Installed.t @@ -45,7 +45,7 @@ ok( $ei->_is_type(0, 'all'), '_is_type() should be true for type of "all"' ); foreach my $path (qw( man1dir man3dir )) { SKIP: { - my $dir = $Config{$path.'exp'}; + my $dir = File::Spec->canonpath($Config{$path.'exp'}); skip("no man directory $path on this system", 2 ) unless $dir; my $file = $dir . '/foo'; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_BeOS.t b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_BeOS.t index 6587ced6e5e..bb9583d51b8 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_BeOS.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_BeOS.t @@ -14,7 +14,7 @@ chdir 't'; use Test::More; BEGIN { - if ($^O =~ /beos/i) { + if ($^O =~ /beos/i or $^O eq 'haiku') { plan tests => 4; } else { plan skip_all => 'This is not BeOS'; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Cygwin.t b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Cygwin.t index 266c4659400..d952188c442 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Cygwin.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Cygwin.t @@ -16,7 +16,7 @@ use Test::More; BEGIN { if ($^O =~ /cygwin/i) { - plan tests => 11; + plan tests => 14; } else { plan skip_all => "This is not cygwin"; } @@ -25,6 +25,7 @@ BEGIN { use Config; use File::Spec; use ExtUtils::MM; +use Config; use_ok( 'ExtUtils::MM_Cygwin' ); @@ -97,6 +98,30 @@ like( $res, qr/pure_all.*foo.*foo.1/s, '... should add MAN3PODS targets' ); is( $MM->{EXPORT_LIST}, $export, 'EXPORT_LIST' ); } +# Tests for correct handling of maybe_command in /cygdrive/* +# and c:/*. $ENV{COMSPEC}, if it exists, should always be executable. +SKIP: { + skip "Needs Cygwin::win_to_posix_path()", 2 unless defined &Cygwin::win_to_posix_path; + + SKIP: { + my $comspec = $ENV{COMSPEC}; + skip(q[$ENV{COMSPEC} does not exist], 1) unless $comspec; + + $comspec = Cygwin::win_to_posix_path($comspec); + + ok(MM->maybe_command($comspec), qq{'$comspec' should be executable"}); + } + + # 'C:/' should *never* be executable, it's a directory. + { + my $cdrive = Cygwin::win_to_posix_path("C:/"); + + ok(!MM->maybe_command($cdrive), qq{'$cdrive' should never be executable}); + } +} + +# Our copy of Perl (with a unix-path) should always be executable. +ok(MM->maybe_command($Config{perlpath}), qq{'$Config{perlpath}' should be executable}); package FakeOut; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Unix.t b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Unix.t index ffcfd295de3..ed23d60bdfd 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Unix.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Unix.t @@ -18,7 +18,7 @@ BEGIN { plan skip_all => 'Non-Unix platform'; } else { - plan tests => 109; + plan tests => 110; } } @@ -31,21 +31,20 @@ my $class = 'ExtUtils::MM_Unix'; # only one of the following can be true # test should be removed if MM_Unix ever stops handling other OS than Unix -my $os = ($ExtUtils::MM_Unix::Is_OS2 || 0) - + ($ExtUtils::MM_Unix::Is_Win32 || 0) - + ($ExtUtils::MM_Unix::Is_Dos || 0) - + ($ExtUtils::MM_Unix::Is_VMS || 0); -ok ( $os <= 1, 'There can be only one (or none)'); +my $os = ($ExtUtils::MM_Unix::Is{OS2} || 0) + + ($ExtUtils::MM_Unix::Is{Win32} || 0) + + ($ExtUtils::MM_Unix::Is{Dos} || 0) + + ($ExtUtils::MM_Unix::Is{VMS} || 0); +cmp_ok ( $os, '<=', 1, 'There can be only one (or none)'); -cmp_ok ($ExtUtils::MM_Unix::VERSION, '>=', '1.12606', 'Should be at least version 1.12606'); +is($ExtUtils::MM_Unix::VERSION, $ExtUtils::MakeMaker::VERSION, 'MM_Unix has a $VERSION'); # when the following calls like canonpath, catdir etc are replaced by # File::Spec calls, the test's become a bit pointless -foreach ( qw( xx/ ./xx/ xx/././xx xx///xx) ) - { - is ($class->canonpath($_), File::Spec->canonpath($_), "canonpath $_"); - } +foreach ( qw( xx/ ./xx/ xx/././xx xx///xx) ) { + is ($class->canonpath($_), File::Spec->canonpath($_), "canonpath $_"); +} is ($class->catdir('xx','xx'), File::Spec->catdir('xx','xx'), 'catdir(xx, xx) => xx/xx'); @@ -171,9 +170,14 @@ is ($t->libscan('Fatty'), 'Fatty', 'libscan on something not a VC file' ); # maybe_command open(FILE, ">command"); print FILE "foo"; close FILE; -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"); +SKIP: { + 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"); +} unlink "command"; @@ -185,19 +189,20 @@ my $self_name = $ENV{PERL_CORE} ? '../lib/ExtUtils/t/MM_Unix.t' is ($t->perl_script($self_name),$self_name, 'we pass as a perl_script()'); ############################################################################### -# perm_rw perm_rwx +# PERM_RW and PERM_RWX $t->init_PERM; -is ($t->perm_rw(),'644', 'perm_rw() is 644'); -is ($t->perm_rwx(),'755', 'perm_rwx() is 755'); +is ($t->{PERM_RW},'644', 'PERM_RW is 644'); +is ($t->{PERM_RWX},'755', 'PERM_RWX is 755'); +is ($t->{PERM_DIR},'755', 'PERM_DIR is 755'); + ############################################################################### # post_constants, postamble, post_initialize -foreach (qw/ post_constants postamble post_initialize/) - { +foreach (qw/ post_constants postamble post_initialize/) { is ($t->$_(),'', "$_() is an empty string"); - } +} ############################################################################### # replace_manpage_separator diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Win32.t b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Win32.t index 866c135bc56..c779da2c4e9 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Win32.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Win32.t @@ -16,7 +16,7 @@ use Test::More; BEGIN { if ($^O =~ /MSWin32/i) { - plan tests => 41; + plan tests => 49; } else { plan skip_all => 'This is not Win32'; } @@ -234,6 +234,37 @@ EOSCRIPT } unlink "${script_name}$script_ext" if -f "${script_name}$script_ext"; +# is_make_type() +{ + # Check for literal nmake + SKIP: { + skip("Not using 'nmake'", 2) unless $Config{make} eq 'nmake'; + ok( $MM->is_make_type('nmake'), '->is_make_type(nmake) true' ); + ok( ! $MM->is_make_type('dmake'), '->is_make_type(dmake) false' ); + } + + # Check for literal nmake + SKIP: { + skip("Not using /nmake/", 2) unless $Config{make} =~ /nmake/; + ok( $MM->is_make_type('nmake'), '->is_make_type(nmake) true' ); + ok( ! $MM->is_make_type('dmake'), '->is_make_type(dmake) false' ); + } + + # Check for literal dmake + SKIP: { + skip("Not using 'dmake'", 2) unless $Config{make} eq 'dmake'; + ok( $MM->is_make_type('dmake'), '->is_make_type(dmake) true' ); + ok( ! $MM->is_make_type('nmake'), '->is_make_type(nmake) false' ); + } + + # Check for literal dmake + SKIP: { + skip("Not using /dmake/", 2) unless $Config{make} =~ /dmake/; + ok( $MM->is_make_type('dmake'), '->is_make_type(dmake) true' ); + ok( ! $MM->is_make_type('nmake'), '->is_make_type(nmake) false' ); + } + +} # xs_o() should look into that # top_targets() should look into that diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/MakeMaker_Parameters.t b/gnu/usr.bin/perl/lib/ExtUtils/t/MakeMaker_Parameters.t new file mode 100755 index 00000000000..3518d584653 --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/MakeMaker_Parameters.t @@ -0,0 +1,74 @@ +#!/usr/bin/perl -w + +# Things like the CPAN shell rely on the "MakeMaker Parameters" section of the +# Makefile to learn a module's dependencies so we'd damn well better test it. + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = ('../lib', 'lib'); + } + else { + unshift @INC, 't/lib'; + } +} + +use strict; +use warnings; + +use ExtUtils::MakeMaker; +use Test::More; + +my $mm = bless {}, "MM"; + +sub extract_params { + my $text = join "\n", @_; + + $text =~ s{^\s* \# \s+ MakeMaker\ Parameters: \s*\n}{}x; + $text =~ s{^#}{}gms; + $text =~ s{\n}{,\n}g; + + no strict 'subs'; + return { eval "$text" }; +} + +sub test_round_trip { + my $args = shift; + my $want = @_ ? shift : $args; + + my $have = extract_params($mm->_MakeMaker_Parameters_section($args)); + + local $Test::Builder::Level = $Test::Builder::Level + 1; + is_deeply $have, $want or diag explain $have, "\n", $want; +} + +is join("", $mm->_MakeMaker_Parameters_section()), <<'EXPECT', "nothing"; +# MakeMaker Parameters: +EXPECT + +test_round_trip({ NAME => "Foo" }); +test_round_trip({ NAME => "Foo", PREREQ_PM => { "Foo::Bar" => 0 } }); +test_round_trip({ NAME => "Foo", PREREQ_PM => { "Foo::Bar" => 1.23 } }); + +# Test the special case for BUILD_REQUIRES +{ + my $have = { + NAME => "Foo", + PREREQ_PM => { "Foo::Bar" => 1.23 }, + BUILD_REQUIRES => { "Baz" => 0.12 }, + }; + + my $want = { + NAME => "Foo", + PREREQ_PM => { + "Foo::Bar" => 1.23, + "Baz" => 0.12, + }, + BUILD_REQUIRES => { "Baz" => 0.12 }, + }; + + test_round_trip( $have, $want ); +} + +done_testing(); + diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/Manifest.t b/gnu/usr.bin/perl/lib/ExtUtils/t/Manifest.t index e8732ad9fc1..3aca61dfbf2 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/Manifest.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/Manifest.t @@ -13,7 +13,7 @@ chdir 't'; use strict; -use Test::More tests => 66; +use Test::More tests => 94; use Cwd; use File::Spec; @@ -22,6 +22,18 @@ use File::Find; use Config; my $Is_VMS = $^O eq 'VMS'; +my $Is_VMS_noefs = $Is_VMS; +if ($Is_VMS) { + my $vms_efs = 0; + if (eval 'require VMS::Feature') { + $vms_efs = VMS::Feature::current("efs_charset"); + } else { + my $efs_charset = $ENV{'DECC$EFS_CHARSET'} || ''; + $vms_efs = $efs_charset =~ /^[ET1]/i; + } + $Is_VMS_noefs = 0 if $vms_efs; +} + # We're going to be chdir'ing and modules are sometimes loaded on the # fly in this test, so we need an absolute @INC. @@ -33,10 +45,11 @@ sub add_file { my ($file, $data) = @_; $data ||= 'foo'; 1 while unlink $file; # or else we'll get multiple versions on VMS - open( T, '>'.$file) or return; + open( T, '> '.$file) or return; print T $data; - ++$Files{$file}; close T; + return 0 unless -e $file; # exists under the name we gave it ? + ++$Files{$file}; } sub read_manifest { @@ -60,7 +73,7 @@ sub remove_dir { BEGIN { use_ok( 'ExtUtils::Manifest', qw( mkmanifest manicheck filecheck fullcheck - maniread manicopy skipcheck maniadd) ); + maniread manicopy skipcheck maniadd maniskip) ); } my $cwd = Cwd::getcwd(); @@ -173,12 +186,12 @@ $files = maniread(); eval { (undef, $warn) = catch_warning( sub { manicopy( $files, 'copy', 'cp' ) }) }; -like( $@, qr/^Can't read none: /, 'croaked about none' ); # a newline comes through, so get rid of it chomp($warn); - -# the copy should have given one warning and one error +# the copy should have given a warning +like($warn, qr/^none not found/, 'carped about none' ); +($res, $warn) = catch_warning( \&skipcheck ); like($warn, qr/^Skipping MANIFEST.SKIP/i, 'warned about MANIFEST.SKIP' ); # tell ExtUtils::Manifest to use a different file @@ -218,13 +231,67 @@ is( $files->{wibble}, '', 'maniadd() with undef comment' ); is( $files->{yarrow}, 'hock',' with comment' ); is( $files->{foobar}, '', ' preserved old entries' ); +my %funky_files; +# test including a filename with a space +SKIP: { + add_file( 'foo bar' => "space" ) + or skip "couldn't create spaced test file", 2; + local $ExtUtils::Manifest::MANIFEST = "albatross"; + maniadd({ 'foo bar' => "contains space"}); + is( maniread()->{'foo bar'}, "contains space", + 'spaced manifest filename' ); + add_file( 'albatross.bak', '' ); + ($res, $warn) = catch_warning( \&mkmanifest ); + like( $warn, qr/\A(Added to.*\n)+\z/m, + 'no warnings about funky filename' ); + $funky_files{'space'} = 'foo bar'; +} + +# test including a filename with a space and a quote +SKIP: { + add_file( 'foo\' baz\'quux' => "quote" ) + or skip "couldn't create quoted test file", 1; + local $ExtUtils::Manifest::MANIFEST = "albatross"; + maniadd({ 'foo\' baz\'quux' => "contains quote"}); + is( maniread()->{'foo\' baz\'quux'}, "contains quote", + 'quoted manifest filename' ); + $funky_files{'space_quote'} = 'foo\' baz\'quux'; +} + +# test including a filename with a space and a backslash +SKIP: { + add_file( 'foo bar\\baz' => "backslash" ) + or skip "couldn't create backslash test file", 1; + local $ExtUtils::Manifest::MANIFEST = "albatross"; + maniadd({ 'foo bar\\baz' => "contains backslash"}); + is( maniread()->{'foo bar\\baz'}, "contains backslash", + 'backslashed manifest filename' ); + $funky_files{'space_backslash'} = 'foo bar\\baz'; +} + +# test including a filename with a space, quote, and a backslash +SKIP: { + add_file( 'foo bar\\baz\'quux' => "backslash/quote" ) + or skip "couldn't create backslash/quote test file", 1; + local $ExtUtils::Manifest::MANIFEST = "albatross"; + maniadd({ 'foo bar\\baz\'quux' => "backslash and quote"}); + is( maniread()->{'foo bar\\baz\'quux'}, "backslash and quote", + 'backslashed and quoted manifest filename' ); + $funky_files{'space_quote_backslash'} = 'foo bar\\baz\'quux'; +} + +my @funky_keys = qw(space space_quote space_backslash space_quote_backslash); # test including an external manifest.skip file in MANIFEST.SKIP { maniadd({ foo => undef , albatross => undef, 'mymanifest.skip' => undef, 'mydefault.skip' => undef}); + for (@funky_keys) { + maniadd( {$funky_files{$_} => $_} ) if defined $funky_files{$_}; + } + add_file('mymanifest.skip' => "^foo\n"); add_file('mydefault.skip' => "^my\n"); - $ExtUtils::Manifest::DEFAULT_MSKIP = + local $ExtUtils::Manifest::DEFAULT_MSKIP = File::Spec->catfile($cwd, qw(mantest mydefault.skip)); my $skip = File::Spec->catfile($cwd, qw(mantest mymanifest.skip)); add_file('MANIFEST.SKIP' => @@ -234,11 +301,27 @@ is( $files->{foobar}, '', ' preserved old entries' ); like( $warn, qr/Skipping \b$_\b/, "Skipping $_" ); } + for my $funky_key (@funky_keys) { + SKIP: { + my $funky_file = $funky_files{$funky_key}; + skip "'$funky_key' not created", 1 unless $funky_file; + like( $warn, qr/Skipping \b\Q$funky_file\E\b/, + "Skipping $funky_file"); + } + } ($res, $warn) = catch_warning( \&mkmanifest ); for (qw(albatross foo foobar mymanifest.skip mydefault.skip)) { like( $warn, qr/Removed from MANIFEST: \b$_\b/, "Removed $_ from MANIFEST" ); } + for my $funky_key (@funky_keys) { + SKIP: { + my $funky_file = $funky_files{$funky_key}; + skip "'$funky_key' not created", 1 unless $funky_file; + like( $warn, qr/Removed from MANIFEST: \b\Q$funky_file\E\b/, + "Removed $funky_file from MANIFEST"); + } + } my $files = maniread; ok( ! exists $files->{albatross}, 'albatross excluded via MANIFEST.SKIP' ); ok( exists $files->{yarrow}, 'yarrow included in MANIFEST' ); @@ -249,7 +332,45 @@ is( $files->{foobar}, '', ' preserved old entries' ); 'mymanifest.skip excluded via mydefault.skip' ); ok( ! exists $files->{'mydefault.skip'}, 'mydefault.skip excluded via mydefault.skip' ); - my $extsep = $Is_VMS ? '_' : '.'; + + # test exclusion of funky files + for my $funky_key (@funky_keys) { + SKIP: { + my $funky_file = $funky_files{$funky_key}; + skip "'$funky_key' not created", 1 unless $funky_file; + ok( ! exists $files->{$funky_file}, + "'$funky_file' excluded via mymanifest.skip" ); + } + } + + # tests for maniskip + my $skipchk = maniskip(); + is ( $skipchk->('albatross'), 1, + 'albatross excluded via MANIFEST.SKIP' ); + is( $skipchk->('yarrow'), '', + 'yarrow included in MANIFEST' ); + is( $skipchk->('bar'), '', + 'bar included in MANIFEST' ); + $skipchk = maniskip('mymanifest.skip'); + is( $skipchk->('foobar'), 1, + 'foobar excluded via mymanifest.skip' ); + is( $skipchk->('foo'), 1, + 'foo excluded via mymanifest.skip' ); + is( $skipchk->('mymanifest.skip'), '', + 'mymanifest.skip included via mydefault.skip' ); + is( $skipchk->('mydefault.skip'), '', + 'mydefault.skip included via mydefault.skip' ); + $skipchk = maniskip('mydefault.skip'); + is( $skipchk->('foobar'), '', + 'foobar included via mydefault.skip' ); + is( $skipchk->('foo'), '', + 'foo included via mydefault.skip' ); + is( $skipchk->('mymanifest.skip'), 1, + 'mymanifest.skip excluded via mydefault.skip' ); + is( $skipchk->('mydefault.skip'), 1, + 'mydefault.skip excluded via mydefault.skip' ); + + my $extsep = $Is_VMS_noefs ? '_' : '.'; $Files{"$_.bak"}++ for ('MANIFEST', "MANIFEST${extsep}SKIP"); } diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/arch_check.t b/gnu/usr.bin/perl/lib/ExtUtils/t/arch_check.t new file mode 100755 index 00000000000..deb289a1ad3 --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/arch_check.t @@ -0,0 +1,89 @@ +#!/usr/bin/perl -w + +BEGIN { + if ($ENV{PERL_CORE}) { + chdir 't' if -d 't'; + @INC = qw(../lib lib); + } +} + +use strict; +use lib 't/lib'; + +use TieOut; +use Test::More 'no_plan'; + +use Config; +use ExtUtils::MakeMaker; + +ok( my $stdout = tie *STDOUT, 'TieOut' ); + +# Create a normalized MM object to test with +my $mm = bless {}, "MM"; +$mm->{PERL_SRC} = 0; +$mm->{UNINSTALLED_PERL} = 0; + +my $rel2abs = sub { $mm->rel2abs($mm->catfile(@_)) }; + +ok $mm->arch_check( + $rel2abs->(qw(. t testdata reallylongdirectoryname arch1 Config.pm)), + $rel2abs->(qw(. t testdata reallylongdirectoryname arch1 Config.pm)), +); + + +# Different architecures. +{ + ok !$mm->arch_check( + $rel2abs->(qw(. t testdata reallylongdirectoryname arch1 Config.pm)), + $rel2abs->(qw(. t testdata reallylongdirectoryname arch2 Config.pm)), + ); + + like $stdout->read, qr{\Q +Your perl and your Config.pm seem to have different ideas about the +architecture they are running on. +Perl thinks: [arch1] +Config says: [$Config{archname}] +This may or may not cause problems. Please check your installation of perl +if you have problems building this extension. +}; + +} + + +# Different file path separators [rt.cpan.org 46416] +SKIP: { + require File::Spec; + skip "Win32 test", 1 unless File::Spec->isa("File::Spec::Win32"); + + ok $mm->arch_check( + "/_64/perl1004/lib/Config.pm", + '\\_64\\perl1004\\lib\\Config.pm', + ); +} + + +# PERL_SRC is set, no check is done +{ + # Clear our log + $stdout->read; + + local $mm->{PERL_SRC} = 1; + ok $mm->arch_check( + $rel2abs->(qw(. t testdata reallylongdirectoryname arch1 Config.pm)), + $rel2abs->(qw(. t testdata reallylongdirectoryname arch2 Config.pm)), + ); + + is $stdout->read, ''; +} + + +# UNINSTALLED_PERL is set, no message is sent +{ + local $mm->{UNINSTALLED_PERL} = 1; + ok !$mm->arch_check( + $rel2abs->(qw(. t testdata reallylongdirectoryname arch1 Config.pm)), + $rel2abs->(qw(. t testdata reallylongdirectoryname arch2 Config.pm)), + ); + + like $stdout->read, qr{^Have .*\nWant .*$}; +} diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/basic.t b/gnu/usr.bin/perl/lib/ExtUtils/t/basic.t index 64352d85cbd..67d39f578d3 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/basic.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/basic.t @@ -17,23 +17,16 @@ use strict; use Config; use ExtUtils::MakeMaker; -use Test::More tests => 83; +use Test::More tests => 79; 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; @@ -93,21 +86,21 @@ 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, +like( $ppd_html, qr{^<SOFTPKG NAME="Big-Dummy" VERSION="0.01">}m, ' <SOFTPKG>' ); -like( $ppd_html, qr{^\s*<TITLE>Big-Dummy</TITLE>}m, ' <TITLE>' ); 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>' ); +like( $ppd_html, qr{^\s*<REQUIRE NAME="strict::" />}m, ' <REQUIRE>' ); + my $archname = $Config{archname}; -$archname .= "-". substr($Config{version},0,3) if $] >= 5.008; +if( $] >= 5.008 ) { + # XXX This is a copy of the internal logic, so it's not a great test + $archname .= "-$Config{PERL_REVISION}.$Config{PERL_VERSION}"; +} like( $ppd_html, qr{^\s*<ARCHITECTURE NAME="$archname" />}m, ' <ARCHITECTURE>'); like( $ppd_html, qr{^\s*<CODEBASE HREF="" />}m, ' <CODEBASE>'); @@ -133,7 +126,6 @@ is( $?, 0, ' exited normally' ) || 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 = (); @@ -154,12 +146,11 @@ ok( $files{'perllocal.pod'},' perllocal.pod created' ); SKIP: { - skip 'VMS install targets do not preserve $(PREFIX)', 9 if $Is_VMS; + skip 'VMS install targets do not preserve $(PREFIX)', 8 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 = (); @@ -174,13 +165,12 @@ SKIP: { SKIP: { - skip 'VMS install targets do not preserve $(DESTDIR)', 11 if $Is_VMS; + skip 'VMS install targets do not preserve $(DESTDIR)', 10 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 = (); @@ -215,13 +205,12 @@ SKIP: { SKIP: { - skip 'VMS install targets do not preserve $(PREFIX)', 10 if $Is_VMS; + skip 'VMS install targets do not preserve $(PREFIX)', 9 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' ); @@ -250,25 +239,42 @@ 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 -license: ~ -author: +name: Big-Dummy +version: 0.01 +abstract: Try "our" hot dog's +author: - Michael G Schwern <schwern\@pobox.com> -generated_by: ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION -distribution_type: module -requires: - strict: 0 +license: unknown +distribution_type: module +configure_requires: + ExtUtils::MakeMaker: 0 +build_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.3.html - version: 1.3 + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: 1.4 END my $manifest = maniread("$distdir/MANIFEST"); @@ -300,7 +306,7 @@ ok( grep(/^Writing $makefile for Big::Dummy/, @mpl_out) == 1, # 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 $!; +open(STDERR, ">",File::Spec->devnull) or die $!; my $realclean_out = run("$make realclean"); is( $?, 0, 'realclean' ) || diag($realclean_out); diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/build_man.t b/gnu/usr.bin/perl/lib/ExtUtils/t/build_man.t index 4a544fbb53d..9732c3806f2 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/build_man.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/build_man.t @@ -60,7 +60,7 @@ ok( my $stdout = tie *STDOUT, 'TieOut' ); INSTALLMAN3DIR => 'none' ); - ok( !keys %{ $mm->{MAN3PODS} } ); + is_deeply( $mm->{MAN3PODS}, {} ); } diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/can_write_dir.t b/gnu/usr.bin/perl/lib/ExtUtils/t/can_write_dir.t new file mode 100755 index 00000000000..be6fb1896db --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/can_write_dir.t @@ -0,0 +1,61 @@ +#!/usr/bin/perl -w + +# Test the private _can_write_dir() function. + +use strict; +use ExtUtils::Install; +use File::Spec; +{ package FS; our @ISA = qw(File::Spec); } + +# Alias it for easier access +*can_write_dir = \&ExtUtils::Install::_can_write_dir; + +use Test::More 'no_plan'; + + +my $dne = FS->catdir(qw(does not exist)); +ok ! -e $dne; +is_deeply [can_write_dir($dne)], + [1, + FS->curdir, + FS->catdir('does'), + FS->catdir('does', 'not'), + FS->catdir('does', 'not', 'exist') + ]; + + +my $abs_dne = FS->rel2abs($dne); +ok ! -e $abs_dne; +is_deeply [can_write_dir($abs_dne)], + [1, + FS->rel2abs(FS->curdir), + FS->rel2abs(FS->catdir('does')), + FS->rel2abs(FS->catdir('does', 'not')), + FS->rel2abs(FS->catdir('does', 'not', 'exist')), + ]; + +SKIP: { + my $exists = FS->catdir(qw(exists)); + my $subdir = FS->catdir(qw(exists subdir)); + + + ok mkdir $exists; + END { rmdir $exists } + + ok chmod 0555, $exists, 'make read only'; + + skip "Current user or OS cannot create directories that they cannot read", 6 + if -w $exists; # these tests require a directory we cant read + + is_deeply [can_write_dir($exists)], [0, $exists]; + is_deeply [can_write_dir($subdir)], [0, $exists, $subdir]; + + ok chmod 0777, $exists, 'make writable'; + ok -w $exists; + is_deeply [can_write_dir($exists)], [1, $exists]; + is_deeply [can_write_dir($subdir)], + [1, + $exists, + $subdir + ]; +}
\ No newline at end of file diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/cd.t b/gnu/usr.bin/perl/lib/ExtUtils/t/cd.t index 9d62d139e7c..dfd3ce44e4a 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/cd.t +++ b/gnu/usr.bin/perl/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/gnu/usr.bin/perl/lib/ExtUtils/t/cp.t b/gnu/usr.bin/perl/lib/ExtUtils/t/cp.t new file mode 100755 index 00000000000..3d7ba6e2886 --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/cp.t @@ -0,0 +1,33 @@ +#!/usr/bin/perl -w + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't'; + @INC = ('../lib', 'lib/'); + } + else { + unshift @INC, 't/lib/'; + } +} +chdir 't'; + +use ExtUtils::Command; +use Test::More tests => 1; + +open FILE, ">source" or die $!; +print FILE "stuff\n"; +close FILE; + +# Instead of sleeping to make the file time older +utime time - 900, time - 900, "source"; + +END { 1 while unlink "source", "dest"; } + +# Win32 bug, cp wouldn't update mtime. +{ + local @ARGV = qw(source dest); + cp(); + my $mtime = (stat("dest"))[9]; + my $now = time; + cmp_ok( abs($mtime - $now), '<=', 1, 'cp updated mtime' ); +} diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/eu_command.t b/gnu/usr.bin/perl/lib/ExtUtils/t/eu_command.t index 2d2fdbae223..99e45aa9595 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/eu_command.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/eu_command.t @@ -22,10 +22,8 @@ BEGIN { File::Path::rmtree( 'ecmddir' ); } -BEGIN { - use Test::More tests => 41; - use File::Spec; -} +use Test::More tests => 40; +use File::Spec; BEGIN { # bad neighbor, but test_f() uses exit() @@ -57,9 +55,6 @@ BEGIN { @ARGV = ( $Testfile ); is( test_f(), 1, 'testing non-existent file' ); - @ARGV = ( $Testfile ); - is( ! test_f(), '', 'testing non-existent file' ); - # these are destructive, have to keep setting @ARGV @ARGV = ( $Testfile ); touch(); diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/fix_libs.t b/gnu/usr.bin/perl/lib/ExtUtils/t/fix_libs.t new file mode 100755 index 00000000000..2a9bf0cf463 --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/fix_libs.t @@ -0,0 +1,36 @@ +#!/usr/bin/perl -w + +# Unit test the code which fixes up $self->{LIBS} + +BEGIN { + chdir 't' if -d 't'; + + if( $ENV{PERL_CORE} ) { + @INC = '../lib'; + } +} + +use strict; +use lib './lib'; +use Test::More 'no_plan'; + +use ExtUtils::MakeMaker; + +my @tests = ( + # arg # want + [ undef, [''] ], + [ "foo", ['foo'] ], + [ [], [''] ], + [ ["foo"], ['foo'] ], + [ [1, 2, 3], [1, 2, 3] ], + [ [0], [0] ], + [ [''], [''] ], + [ " ", [' '] ], +); + +for my $test (@tests) { + my($arg, $want) = @$test; + + my $display = defined $arg ? $arg : "undef"; + is_deeply( MM->_fix_libs($arg), $want, "fix_libs($display)" ); +} diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/fixin.t b/gnu/usr.bin/perl/lib/ExtUtils/t/fixin.t index 69c0ac722b8..e0291e600f7 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/fixin.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/fixin.t @@ -1,5 +1,8 @@ #!/usr/bin/perl -w +# Try to test fixin. I say "try" because what fixin will actually do +# is highly variable from system to system. + BEGIN { if( $ENV{PERL_CORE} ) { chdir 't'; @@ -13,8 +16,9 @@ chdir 't'; use File::Spec; -use Test::More tests => 6; +use Test::More tests => 22; +use Config; use TieOut; use MakeMaker::Test::Utils; use MakeMaker::Test::Setup::BFD; @@ -43,3 +47,77 @@ ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) || is $\, "bar", '$\ not clobbered'; } + +sub test_fixin { + my($code, $test) = @_; + + my $file = "fixin_test"; + ok(open(my $fh, ">", $file), "write $file") or diag "Can't write $file: $!"; + print $fh $code; + close $fh; + + MY->fixin($file); + + ok(open($fh, "<", $file), "read $file") or diag "Can't read $file: $!"; + my @lines = <$fh>; + close $fh; + + $test->(@lines); + + 1 while unlink $file; + ok !-e $file, "cleaned up $file"; +} + + +# A simple test of fixin +test_fixin(<<END, +#!/foo/bar/perl -w + +blah blah blah +END + sub { + my @lines = @_; + unlike $lines[0], qr[/foo/bar/perl], "#! replaced"; + like $lines[0], qr[ -w\b], "switch retained"; + + # In between might be that "not running under some shell" madness. + + is $lines[-1], "blah blah blah\n", "Program text retained"; + } +); + + +# [rt.cpan.org 29442] +test_fixin(<<END, +#!/foo/bar/perl5.8.8 -w + +blah blah blah +END + + sub { + my @lines = @_; + unlike $lines[0], qr[/foo/bar/perl5.8.8], "#! replaced"; + like $lines[0], qr[ -w\b], "switch retained"; + + # In between might be that "not running under some shell" madness. + + is $lines[-1], "blah blah blah\n", "Program text retained"; + } +); + + +# fixin shouldn't pick this up. +test_fixin(<<END, +#!/foo/bar/perly -w + +blah blah blah +END + + sub { + is join("", @_), <<END; +#!/foo/bar/perly -w + +blah blah blah +END + } +); diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/installed_file.t b/gnu/usr.bin/perl/lib/ExtUtils/t/installed_file.t new file mode 100755 index 00000000000..c2dfce734a2 --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/installed_file.t @@ -0,0 +1,51 @@ +#!/usr/bin/perl -w + +# Test MM->_installed_file_for_module() + +BEGIN { + chdir 't' if -d 't'; + + if( $ENV{PERL_CORE} ) { + @INC = '../lib'; + } +} + +use strict; +use warnings; + +use lib './lib'; +use ExtUtils::MakeMaker; +use Test::More; +use File::Spec; + + +sub path_is { + my($have, $want, $name) = @_; + + $have = File::Spec->canonpath($have); + $want = File::Spec->canonpath($want); + + my $builder = Test::More->builder; + return $builder->is_eq( $have, $want, $name ); +} + +# Test when a module is not installed +{ + ok !MM->_installed_file_for_module("aaldkfjaldj"), "Module not installed"; + ok !MM->_installed_file_for_module("aaldkfjaldj::dlajldkj"); +} + +# Try a single name module +{ + my $want = $INC{'strict.pm'}; + path_is( MM->_installed_file_for_module("strict"), $want, "single name module" ); +} + +# And a tuple +{ + my $want = $INC{"Test/More.pm"}; + path_is( MM->_installed_file_for_module("Test::More"), $want, "Foo::Bar style" ); +} + + +done_testing(4); diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/is_of_type.t b/gnu/usr.bin/perl/lib/ExtUtils/t/is_of_type.t new file mode 100755 index 00000000000..8a95d0d6a0f --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/is_of_type.t @@ -0,0 +1,40 @@ +#!/usr/bin/perl -w + +# Test _is_of_type() + +BEGIN { + chdir 't' if -d 't'; + + if( $ENV{PERL_CORE} ) { + @INC = '../lib'; + } +} + +use lib './lib'; +use strict; +use ExtUtils::MakeMaker; + +use Test::More "no_plan"; + +my $is_of_type = \&ExtUtils::MakeMaker::_is_of_type; + +my @tests = ( + [23, "", 1], + [[], "", 0], + [{}, "", 0], + [[], "HASH", 0], + [{}, "HASH", 1], + [bless({}, "Foo"), "Foo", 1], + [bless({}, "Bar"), "Foo", 0], + [bless([], "Foo"), "", 0], + [bless([], "Foo"), "HASH", 0], + [bless([], "Foo"), "ARRAY", 1], +); + +for my $test (@tests) { + my($thing, $type, $want) = @$test; + + # [rt.cpan.org 41060] + local $SIG{__DIE__} = sub { fail("sigdie should be ignored") }; + is !!$is_of_type->($thing, $type), !!$want, qq[_is_of_type($thing, '$type'): $want]; +} diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/metafile_data.t b/gnu/usr.bin/perl/lib/ExtUtils/t/metafile_data.t new file mode 100755 index 00000000000..29d271cfce7 --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/metafile_data.t @@ -0,0 +1,315 @@ +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = ('../lib', 'lib'); + } + else { + unshift @INC, 't/lib'; + } +} + +use strict; +use Test::More tests => 7; + +use Data::Dumper; + +require ExtUtils::MM_Any; + +my $new_mm = sub { + return bless { ARGS => {@_}, @_ }, 'ExtUtils::MM_Any'; +}; + +{ + my $mm = $new_mm->( + DISTNAME => 'Foo-Bar', + VERSION => 1.23, + PM => { + "Foo::Bar" => 'lib/Foo/Bar.pm', + }, + ); + + is_deeply [$mm->metafile_data], [ + name => 'Foo-Bar', + version => 1.23, + abstract => undef, + author => [], + license => 'unknown', + distribution_type => 'module', + + configure_requires => { + 'ExtUtils::MakeMaker' => 0, + }, + build_requires => { + 'ExtUtils::MakeMaker' => 0, + }, + + 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 + }, + ]; + + + is_deeply [$mm->metafile_data({}, { no_index => { directory => [qw(foo)] } })], [ + name => 'Foo-Bar', + version => 1.23, + abstract => undef, + author => [], + license => 'unknown', + distribution_type => 'module', + + configure_requires => { + 'ExtUtils::MakeMaker' => 0, + }, + build_requires => { + 'ExtUtils::MakeMaker' => 0, + }, + + no_index => { + directory => [qw(t inc foo)], + }, + + generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION", + 'meta-spec' => { + url => 'http://module-build.sourceforge.net/META-spec-v1.4.html', + version => 1.4 + }, + ], 'rt.cpan.org 39348'; +} + + +{ + my $mm = $new_mm->( + DISTNAME => 'Foo-Bar', + VERSION => 1.23, + AUTHOR => 'Some Guy', + PREREQ_PM => { + Foo => 2.34, + Bar => 4.56, + }, + ); + + is_deeply [$mm->metafile_data( + { + configure_requires => { + Stuff => 2.34 + }, + wobble => 42 + }, + { + no_index => { + package => "Thing" + }, + wibble => 23 + }, + )], + [ + name => 'Foo-Bar', + version => 1.23, + abstract => undef, + author => ['Some Guy'], + license => 'unknown', + distribution_type => 'script', + + configure_requires => { + Stuff => 2.34, + }, + build_requires => { + 'ExtUtils::MakeMaker' => 0, + }, + + requires => { + Foo => 2.34, + Bar => 4.56, + }, + + no_index => { + directory => [qw(t inc)], + package => 'Thing', + }, + + generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION", + 'meta-spec' => { + url => 'http://module-build.sourceforge.net/META-spec-v1.4.html', + version => 1.4 + }, + + wibble => 23, + 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, + }, + build_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, + }, + build_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 + }, + ]; +} + +# Test CONFIGURE_REQUIRES +{ + my $mm = $new_mm->( + DISTNAME => 'Foo-Bar', + VERSION => 1.23, + CONFIGURE_REQUIRES => { + "Fake::Module1" => 1.01, + }, + PM => { + "Foo::Bar" => 'lib/Foo/Bar.pm', + }, + ); + + is_deeply [$mm->metafile_data], [ + name => 'Foo-Bar', + version => 1.23, + abstract => undef, + author => [], + license => 'unknown', + distribution_type => 'module', + + configure_requires => { + 'Fake::Module1' => 1.01, + }, + build_requires => { + 'ExtUtils::MakeMaker' => 0, + }, + + 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 + }, + ],'CONFIGURE_REQUIRES'; +} + +# Test BUILD_REQUIRES +{ + my $mm = $new_mm->( + DISTNAME => 'Foo-Bar', + VERSION => 1.23, + BUILD_REQUIRES => { + "Fake::Module1" => 1.01, + }, + PM => { + "Foo::Bar" => 'lib/Foo/Bar.pm', + }, + ); + + is_deeply [$mm->metafile_data], [ + name => 'Foo-Bar', + version => 1.23, + abstract => undef, + author => [], + license => 'unknown', + distribution_type => 'module', + + configure_requires => { + 'ExtUtils::MakeMaker' => 0, + }, + build_requires => { + 'Fake::Module1' => 1.01, + }, + + 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 + }, + ],'CONFIGURE_REQUIRES'; +} diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/metafile_file.t b/gnu/usr.bin/perl/lib/ExtUtils/t/metafile_file.t new file mode 100755 index 00000000000..842a249717e --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/metafile_file.t @@ -0,0 +1,314 @@ +#!/usr/bin/perl -w + +# This is a test of the fake YAML dumper implemented by EUMM: +# ExtUtils::MM_Any::metafile_file + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = ('../lib', 'lib'); + } + else { + unshift @INC, 't/lib'; + } +} + +use strict; +use Test::More tests => 16; + +require ExtUtils::MM_Any; + +my $mm = bless {}, 'ExtUtils::MM_Any'; + +{ + my @meta = ( a => 1, b => 2 ); + my $expected = <<YAML; +--- #YAML:1.0 +a: 1 +b: 2 +YAML + + is($mm->metafile_file(@meta), $expected, "dump for flat hashes works ok"); +} + +{ + my @meta = ( k1 => 'some key and value', k2 => undef, k3 => 1 ); + my $expected = <<YAML; +--- #YAML:1.0 +k1: some key and value +k2: ~ +k3: 1 +YAML + + is($mm->metafile_file(@meta), $expected, "dumping strings and undefs is ok"); +} + +{ + my @meta = ( a => 1, b => 2, h => { hh => 1 } ); + my $expected = <<YAML; +--- #YAML:1.0 +a: 1 +b: 2 +h: + hh: 1 +YAML + + is($mm->metafile_file(@meta), $expected, "dump for nested hashes works ok"); +} + +{ + my @meta = ( a => 1, b => 2, h => { h1 => 'x', h2 => 'z' } ); + my $expected = <<YAML; +--- #YAML:1.0 +a: 1 +b: 2 +h: + h1: x + h2: z +YAML + + is($mm->metafile_file(@meta), $expected, "nested hashes sort ascii-betically"); + # to tell the truth, they sort case-insensitively + # that's hard to test for Perl with unstable sort's +} + +{ + my @meta = ( a => 1, b => 2, h => { hh => { hhh => 1 } } ); + my $expected = <<YAML; +--- #YAML:1.0 +a: 1 +b: 2 +h: + hh: + hhh: 1 +YAML + + is($mm->metafile_file(@meta), $expected, "dump for hashes (with more nesting) works ok"); +} + +{ + my @meta = ( a => 1, k => [ qw(w y z) ] ); + my $expected = <<YAML; +--- #YAML:1.0 +a: 1 +k: + - w + - y + - z +YAML + + is($mm->metafile_file(@meta), $expected, "array of strings are handled ok"); +} + +is($mm->metafile_file( a => {}, b => [], c => undef ), <<'YAML', 'empty hashes and arrays'); +--- #YAML:1.0 +a: {} +b: [] +c: ~ +YAML + + +{ + my @meta = ( + name => 'My-Module', + version => '0.1', + version_from => 'lib/My/Module.pm', + installdirs => 'site', + abstract => 'A does-it-all module', + license => 'perl', + generated_by => 'myself', + author => 'John Doe <doe@doeland.org>', + distribution_type => 'module', + requires => { + 'My::Module::Helper' => 0, + 'Your::Module' => '1.5', + }, + 'meta-spec' => { + version => '1.1', + url => 'http://module-build.sourceforge.net/META-spec-new.html', + }, + ); + my $expected = <<'YAML'; +--- #YAML:1.0 +name: My-Module +version: 0.1 +version_from: lib/My/Module.pm +installdirs: site +abstract: A does-it-all module +license: perl +generated_by: myself +author: John Doe <doe@doeland.org> +distribution_type: module +requires: + My::Module::Helper: 0 + Your::Module: 1.5 +meta-spec: + url: http://module-build.sourceforge.net/META-spec-new.html + version: 1.1 +YAML + + is($mm->metafile_file(@meta), $expected, "dump for something like META.yml works"); +} + +{ + my @meta = ( + name => 'My-Module', + version => '0.1', + version_from => 'lib/My/Module.pm', + installdirs => 'site', + abstract => 'A does-it-all module', + license => 'perl', + generated_by => 'myself', + author => 'John Doe <doe@doeland.org>', + distribution_type => 'module', + requires => { + 'My::Module::Helper' => 0, + 'Your::Module' => '1.5', + }, + recommends => { + 'Test::More' => 0, + 'Test::Pod' => 1.18, + 'Test::Pod::Coverage' => 1 + }, + 'meta-spec' => { + version => '1.1', + url => 'http://module-build.sourceforge.net/META-spec-new.html', + }, + ); + my $expected = <<'YAML'; +--- #YAML:1.0 +name: My-Module +version: 0.1 +version_from: lib/My/Module.pm +installdirs: site +abstract: A does-it-all module +license: perl +generated_by: myself +author: John Doe <doe@doeland.org> +distribution_type: module +requires: + My::Module::Helper: 0 + Your::Module: 1.5 +recommends: + Test::More: 0 + Test::Pod: 1.18 + Test::Pod::Coverage: 1 +meta-spec: + url: http://module-build.sourceforge.net/META-spec-new.html + version: 1.1 +YAML + + is($mm->metafile_file(@meta), $expected, "META.yml with extra 'recommends' works"); +} + +{ + my @meta = ( + name => 'My-Module', + version => '0.1', + version_from => 'lib/My/Module.pm', + installdirs => 'site', + abstract => 'A does-it-all module', + license => 'perl', + generated_by => 'myself', + author => 'John Doe <doe@doeland.org>', + distribution_type => 'module', + requires => { + 'My::Module::Helper' => 0, + 'Your::Module' => '1.5', + }, + recommends => { + 'Test::More' => 0, + 'Test::Pod' => 1.18, + 'Test::Pod::Coverage' => 1 + }, + no_index => { + dir => [ qw(inc) ], + file => [ qw(TODO NOTES) ], + }, + 'meta-spec' => { + version => '1.1', + url => 'http://module-build.sourceforge.net/META-spec-new.html', + }, + ); + my $expected = <<'YAML'; +--- #YAML:1.0 +name: My-Module +version: 0.1 +version_from: lib/My/Module.pm +installdirs: site +abstract: A does-it-all module +license: perl +generated_by: myself +author: John Doe <doe@doeland.org> +distribution_type: module +requires: + My::Module::Helper: 0 + Your::Module: 1.5 +recommends: + Test::More: 0 + Test::Pod: 1.18 + Test::Pod::Coverage: 1 +no_index: + dir: + - inc + file: + - TODO + - NOTES +meta-spec: + url: http://module-build.sourceforge.net/META-spec-new.html + version: 1.1 +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; +--- #YAML:1.0 +k: a : b +x : y: 1 +YAML + # NOTE: the output is not YAML-equivalent to the input + + is($mm->metafile_file(@meta), $expected, "no quoting is done"); +} + +{ + my @meta = ( k => \*STDOUT ); + eval { $mm->metafile_file(@meta) }; + + like($@, qr/^only nested hashes, arrays and objects are supported/, + "we don't like but hash/array refs"); +} + +{ + my @meta = ( k => [ [] ] ); + eval { $mm->metafile_file(@meta) }; + + like($@, qr/^only nested arrays of non-refs are supported/, + "we also don't like but array of strings"); +} + +# recursive data structures: don't even think about it - endless recursion diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/min_perl_version.t b/gnu/usr.bin/perl/lib/ExtUtils/t/min_perl_version.t new file mode 100755 index 00000000000..9dc6088bf3e --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/min_perl_version.t @@ -0,0 +1,201 @@ +#!/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 + our($PREREQ_PM, $BUILD_REQUIRES, $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'; + $distdir =~ s{\.}{_}g if $Is_VMS; + + 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/gnu/usr.bin/perl/lib/ExtUtils/t/miniperl.t b/gnu/usr.bin/perl/lib/ExtUtils/t/miniperl.t new file mode 100755 index 00000000000..fbd801cd346 --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/miniperl.t @@ -0,0 +1,57 @@ +#!/usr/bin/perl -w + +# Test that we can build modules as miniperl. +# This mostly means no XS modules. + +BEGIN { + if ($ENV{PERL_CORE}) { + chdir 't' if -d 't'; + @INC = qw(../lib lib); + } +} + +use strict; +use lib 't/lib'; + +use Test::More 'no_plan'; + +BEGIN { + ok !$INC{"ExtUtils/MakeMaker.pm"}, "MakeMaker is not yet loaded"; +} + +# Disable all XS from here on +use MakeMaker::Test::NoXS; + +use ExtUtils::MakeMaker; + +use MakeMaker::Test::Utils; +use MakeMaker::Test::Setup::BFD; + + +my $perl = which_perl(); +my $makefile = makefile_name(); +my $make = make_run(); + + +# Setup our test environment +{ + 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: $!"); +} + + +# Run make once +{ + run_ok(qq{$perl Makefile.PL}); + run_ok($make); +} diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/pm_to_blib.t b/gnu/usr.bin/perl/lib/ExtUtils/t/pm_to_blib.t new file mode 100755 index 00000000000..7c28781b7d5 --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/pm_to_blib.t @@ -0,0 +1,77 @@ +#!/usr/bin/perl -w + +# Ensure pm_to_blib runs at the right times. + +BEGIN { + if ($ENV{PERL_CORE}) { + chdir 't' if -d 't'; + @INC = qw(../lib lib); + } +} + +use strict; +use lib 't/lib'; + +use Test::More 'no_plan'; + +use ExtUtils::MakeMaker; + +use MakeMaker::Test::Utils; +use MakeMaker::Test::Setup::BFD; + + +my $perl = which_perl(); +my $makefile = makefile_name(); +my $make = make_run(); + + +# Setup our test environment +{ + 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: $!"); +} + + +# Run make once +{ + run_ok(qq{$perl Makefile.PL}); + run_ok($make); + + ok( -e "blib/lib/Big/Dummy.pm", "blib copied pm file" ); +} + + +# Change a pm file, it should be copied. +{ + # Wait a couple seconds else our changed file will have the same timestamp + # as the blib file + sleep 2; + + ok( open my $fh, ">>", "lib/Big/Dummy.pm" ) or die $!; + print $fh "Something else\n"; + close $fh; + + run_ok($make); + like slurp("blib/lib/Big/Dummy.pm"), qr/Something else\n$/; +} + + +# Rerun the Makefile.PL, pm_to_blib should rerun +{ + run_ok(qq{$perl Makefile.PL}); + + # XXX This is a fragile way to check that it reran. + like run_ok($make), qr/^Skip /ms; + + ok( -e "blib/lib/Big/Dummy.pm", "blib copied pm file" ); +} diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/pod2man.t b/gnu/usr.bin/perl/lib/ExtUtils/t/pod2man.t new file mode 100755 index 00000000000..c3dd2e23e15 --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/pod2man.t @@ -0,0 +1,54 @@ +#!/usr/bin/perl -w + +# Test our simulation of pod2man + +BEGIN { + if ($ENV{PERL_CORE}) { + chdir 't' if -d 't'; + @INC = qw(../lib lib); + } +} + +use strict; +use lib 't/lib'; + +use ExtUtils::Command::MM; + +use Test::More tests => 3; + +# The argument to perm_rw was optional. +# [rt.cpan.org 35190] +{ + my $warnings; + local $SIG{__WARN__} = sub { + $warnings .= join '', @_; + }; + + pod2man("--perm_rw"); + + like $warnings, qr/^Option perm_rw requires an argument/; +}; + + +# Simulate the failure of Pod::Man loading. +# pod2man() should react gracefully. +{ + local @INC = @INC; + unshift @INC, sub { + die "Simulated Pod::Man failure\n" if $_[1] eq 'Pod/Man.pm'; + }; + local %INC = %INC; + delete $INC{"Pod/Man.pm"}; + + my $warnings; + local $SIG{__WARN__} = sub { + $warnings .= join '', @_; + }; + + is pod2man(), undef; + is $warnings, <<'END' +Pod::Man is not available: Simulated Pod::Man failure +Man pages will not be generated during this install. +END + +} diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/prefixify.t b/gnu/usr.bin/perl/lib/ExtUtils/t/prefixify.t index b5bf139a748..011b77cb3c2 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/prefixify.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/prefixify.t @@ -17,7 +17,7 @@ if( $^O eq 'VMS' ) { plan skip_all => 'prefixify works differently on VMS'; } else { - plan tests => 3; + plan tests => 4; } use ExtUtils::MakeMaker::Config; use File::Spec; @@ -38,6 +38,10 @@ $mm->prefixify('installbin', 'wibble', 'something', $default); is( $mm->{INSTALLBIN}, File::Spec->catdir('something', $default), 'prefixify w/defaults and PREFIX'); +$mm->prefixify('installbin', '../wibble', 'something', $default); +is( $mm->{INSTALLBIN}, File::Spec->catdir('something', $default), + 'relative paths + PREFIX'); + SKIP: { skip "Test for DOSish prefixification", 1 unless $Is_Dosish; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/prereq.t b/gnu/usr.bin/perl/lib/ExtUtils/t/prereq.t index c690a55a02e..e92e5a01c46 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/prereq.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/prereq.t @@ -59,7 +59,7 @@ ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) || ); is $warnings, sprintf("Warning: prerequisite strict 99999 not found. We have %s.\n", - strict->VERSION); + $strict::VERSION); $warnings = ''; WriteMakefile( @@ -82,7 +82,7 @@ ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) || is $warnings, "Warning: prerequisite I::Do::Not::Exist 0 not found.\n". sprintf("Warning: prerequisite strict 99999 not found. We have %s.\n", - strict->VERSION); + $strict::VERSION); $warnings = ''; eval { diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/test_boilerplate.t b/gnu/usr.bin/perl/lib/ExtUtils/t/test_boilerplate.t new file mode 100755 index 00000000000..899ad575082 --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/test_boilerplate.t @@ -0,0 +1,26 @@ +#!/usr/bin/perl -w + +# <<<Fill in with what this test does.>>> +# Copy this when writing new tests to avoid forgetting the core boilerplate + +# Magic for core +BEGIN { + # Always run in t to unify behavor with core + chdir 't' if -d 't'; + + # Only use the about to be installed modules + if( $ENV{PERL_CORE} ) { + @INC = '../lib'; + } +} + +# Use things from t/lib/ +use lib './lib'; +use strict; +use ExtUtils::MakeMaker; + +use Test::More; + +pass("Your test code goes here"); + +done_testing(); diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/testdata/reallylongdirectoryname/arch1/Config.pm b/gnu/usr.bin/perl/lib/ExtUtils/t/testdata/reallylongdirectoryname/arch1/Config.pm new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/testdata/reallylongdirectoryname/arch1/Config.pm diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/testdata/reallylongdirectoryname/arch2/Config.pm b/gnu/usr.bin/perl/lib/ExtUtils/t/testdata/reallylongdirectoryname/arch2/Config.pm new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/testdata/reallylongdirectoryname/arch2/Config.pm diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/writemakefile_args.t b/gnu/usr.bin/perl/lib/ExtUtils/t/writemakefile_args.t index da274d6cc7c..a0774a8d6b1 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/writemakefile_args.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/writemakefile_args.t @@ -14,7 +14,7 @@ BEGIN { } use strict; -use Test::More tests => 28; +use Test::More tests => 35; use TieOut; use MakeMaker::Test::Utils; @@ -126,8 +126,8 @@ VERIFY $warnings = ''; eval { $mm = WriteMakefile( - NAME => 'Big::Dummy', - VERSION => [1,2,3], + NAME => 'Big::Dummy', + VERSION => [1,2,3], ); }; like( $warnings, qr{^WARNING: VERSION takes a version object or string/number} ); @@ -135,8 +135,8 @@ VERIFY $warnings = ''; eval { $mm = WriteMakefile( - NAME => 'Big::Dummy', - VERSION => 1.002_003, + NAME => 'Big::Dummy', + VERSION => 1.002_003, ); }; is( $warnings, '' ); @@ -145,8 +145,8 @@ VERIFY $warnings = ''; eval { $mm = WriteMakefile( - NAME => 'Big::Dummy', - VERSION => '1.002_003', + NAME => 'Big::Dummy', + VERSION => '1.002_003', ); }; is( $warnings, '' ); @@ -156,39 +156,66 @@ VERIFY $warnings = ''; eval { $mm = WriteMakefile( - NAME => 'Big::Dummy', - VERSION => bless {}, "Some::Class", + 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",6) unless eval { require version }; + skip("Can't test version objects", 8) unless eval { require version }; version->import; my $version = version->new("1.2.3"); $warnings = ''; - eval { + ok eval { $mm = WriteMakefile( - NAME => 'Big::Dummy', - VERSION => $version, + NAME => 'Big::Dummy', + VERSION => $version, ); - }; + } || diag $@; is( $warnings, '' ); isa_ok( $mm->{VERSION}, 'version' ); is( $mm->{VERSION}, $version ); $warnings = ''; $version = qv('1.2.3'); - eval { + ok eval { $mm = WriteMakefile( - NAME => 'Big::Dummy', - VERSION => $version, + NAME => 'Big::Dummy', + VERSION => $version, ); - }; + } || diag $@; is( $warnings, '' ); isa_ok( $mm->{VERSION}, 'version' ); is( $mm->{VERSION}, $version ); } -}
\ No newline at end of file + + + # DISTNAME + $warnings = ''; + eval { + $mm = WriteMakefile( + NAME => 'Big::Dummy', + VERSION => '1.00', + DISTNAME => "Hooballa", + ); + }; + is( $warnings, '' ); + is( $mm->{DISTNAME}, "Hooballa" ); + is( $mm->{DISTVNAME}, $Is_VMS ? "Hooballa-1_00" : "Hooballa-1.00" ); + + + # DISTVNAME (rt.cpan.org 43217) + $warnings = ''; + eval { + $mm = WriteMakefile( + NAME => 'Big::Dummy', + VERSION => 1.00, + DISTVNAME => "Hooballoo", + ); + }; + is( $warnings, '' ); + is( $mm->{DISTVNAME}, 'Hooballoo' ); +} diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/xs.t b/gnu/usr.bin/perl/lib/ExtUtils/t/xs.t index 1cadc109b77..5a15190d3eb 100755 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/xs.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/xs.t @@ -11,6 +11,8 @@ BEGIN { } chdir 't'; +use strict; + use Test::More; use MakeMaker::Test::Utils; use MakeMaker::Test::Setup::XS; @@ -18,19 +20,18 @@ use File::Find; use File::Spec; use File::Path; +my $Skipped = 0; if( have_compiler() ) { - plan tests => 7; + plan tests => 5; } else { + $Skipped = 1; plan skip_all => "ExtUtils::CBuilder not installed or couldn't find a compiler"; } my $Is_VMS = $^O eq 'VMS'; my $perl = which_perl(); -# GNV logical interferes with testing -$ENV{'bin'} = '[.bin]' if $Is_VMS; - chdir 't'; perl_lib; @@ -39,8 +40,10 @@ $| = 1; ok( setup_xs(), 'setup' ); END { - ok( chdir File::Spec->updir ); - ok( teardown_xs(), 'teardown' ); + unless( $Skipped ) { + chdir File::Spec->updir or die; + teardown_xs(), 'teardown' or die; + } } ok( chdir('XS-Test'), "chdir'd to XS-Test" ) || |