diff options
author | Nicholas Clark <nick@ccl4.org> | 2008-10-25 15:06:56 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2008-10-25 15:06:56 +0000 |
commit | 8bdaab24c0cb1d12d386655647a8b10ea78c34ba (patch) | |
tree | a6a14186984a12a002820a6ea926702226d0e331 /lib | |
parent | 1b1b430b4d658ee40231cae220ed89179cf49c29 (diff) | |
download | perl-8bdaab24c0cb1d12d386655647a8b10ea78c34ba.tar.gz |
Upgrade to ExtUtils::Command 1.15
p4raw-id: //depot/perl@34590
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ExtUtils/Command.pm | 10 | ||||
-rw-r--r-- | lib/ExtUtils/t/cp.t | 33 | ||||
-rw-r--r-- | lib/ExtUtils/t/eu_command.t | 11 |
3 files changed, 44 insertions, 10 deletions
diff --git a/lib/ExtUtils/Command.pm b/lib/ExtUtils/Command.pm index fbb7d1380c..63fbfd6b9e 100644 --- a/lib/ExtUtils/Command.pm +++ b/lib/ExtUtils/Command.pm @@ -12,9 +12,11 @@ use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION); @ISA = qw(Exporter); @EXPORT = qw(cp rm_f rm_rf mv cat eqtime mkpath touch test_f test_d chmod dos2unix); -$VERSION = '1.14'; +$VERSION = '1.15'; + +my $Is_VMS = $^O eq 'VMS'; +my $Is_Win32 = $^O eq 'MSWin32'; -my $Is_VMS = $^O eq 'VMS'; =head1 NAME @@ -210,6 +212,10 @@ sub cp { my $nok = 0; foreach my $src (@src) { $nok ||= !copy($src,$dst); + + # Win32 does not update the mod time of a copied file, just the + # created time which make does not look at. + utime(time, time, $dst) if $Is_Win32; } return $nok; } diff --git a/lib/ExtUtils/t/cp.t b/lib/ExtUtils/t/cp.t new file mode 100644 index 0000000000..3d7ba6e288 --- /dev/null +++ b/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/lib/ExtUtils/t/eu_command.t b/lib/ExtUtils/t/eu_command.t index 30fb38e933..99e45aa959 100644 --- a/lib/ExtUtils/t/eu_command.t +++ b/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(); @@ -146,7 +141,7 @@ BEGIN { SKIP: { if ($^O eq 'amigaos' || $^O eq 'os2' || $^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'dos' || $^O eq 'cygwin' || - $^O eq 'MacOS' || $^O eq 'vos' + $^O eq 'MacOS' ) { skip( "different file permission semantics on $^O", 5); } |