From 8bdaab24c0cb1d12d386655647a8b10ea78c34ba Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Sat, 25 Oct 2008 15:06:56 +0000 Subject: [PATCH] Upgrade to ExtUtils::Command 1.15 p4raw-id: //depot/perl@34590 --- MANIFEST | 1 + lib/ExtUtils/Command.pm | 10 ++++++++-- lib/ExtUtils/t/cp.t | 33 +++++++++++++++++++++++++++++++++ lib/ExtUtils/t/eu_command.t | 11 +++-------- 4 files changed, 45 insertions(+), 10 deletions(-) create mode 100644 lib/ExtUtils/t/cp.t diff --git a/MANIFEST b/MANIFEST index 85d8b32..71715c4 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2014,6 +2014,7 @@ lib/ExtUtils/t/Constant.t See if ExtUtils::Constant works lib/ExtUtils/t/dir_target.t Verify if dir_target() is supported lib/ExtUtils/t/Embed.t See if ExtUtils::Embed and embedding works lib/ExtUtils/testlib.pm Fixes up @INC to use just-built extension +lib/ExtUtils/t/cp.t See if ExtUtils::Command works lib/ExtUtils/t/eu_command.t See if ExtUtils::Command works lib/ExtUtils/t/FIRST_MAKEFILE.t See if FIRST_MAKEFILE works lib/ExtUtils/t/fixin.t See if ExtUtils::MakeMaker works diff --git a/lib/ExtUtils/Command.pm b/lib/ExtUtils/Command.pm index fbb7d13..63fbfd6 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 0000000..3d7ba6e --- /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 30fb38e..99e45aa 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); } -- 1.8.3.1