[svn:Module-Build] r12740 - Module-Build/trunk/t

[email protected]
Newsgroups perl.module.build.checkins
Message-ID <[email protected]>
Author: schwern
Date: Mon May  4 10:51:18 2009
New Revision: 12740

Modified:
   Module-Build/trunk/t/compat.t

Log:
Fix t/compat.t for HP/UX make.  [rt.cpan.org 45700]

Modified: Module-Build/trunk/t/compat.t
==============================================================================
--- Module-Build/trunk/t/compat.t	(original)
+++ Module-Build/trunk/t/compat.t	Mon May  4 10:51:18 2009
@@ -135,8 +135,7 @@
     $foo_builder = Foo::Builder->new_from_context;
   });
   foreach my $style ('passthrough', 'small') {
-    Module::Build::Compat->create_makefile_pl($style, $foo_builder);
-    ok -e 'Makefile.PL', "$style Makefile.PL created";
+    create_makefile_pl($style, $foo_builder);
     
     # Should fail with "can't find Foo/Builder.pm"
     my $result;
@@ -153,8 +152,7 @@
     $bar_builder = Module::Build->subclass( class => 'Bar::Builder' )->new_from_context;
   });
   foreach my $style ('passthrough', 'small') {
-    Module::Build::Compat->create_makefile_pl($style, $bar_builder);
-    ok -e 'Makefile.PL', "$style Makefile.PL created via subclass";
+    create_makefile_pl($style, $bar_builder);
     my $result;
     stdout_of( sub {
       $result = $mb->run_perl_script('Makefile.PL');
@@ -165,7 +163,7 @@
 
 {
   # Make sure various Makefile.PL arguments are supported
-  Module::Build::Compat->create_makefile_pl('passthrough', $mb);
+  create_makefile_pl('passthrough', $mb);
 
   my $libdir = File::Spec->catdir( $tmp, 'libdir' );
   my $result;
@@ -255,7 +253,7 @@
   # C<glob> on MSWin32 uses $ENV{HOME} if defined to do tilde-expansion
   local $ENV{HOME} = 'C:/' if $^O =~ /MSWin/ && !exists( $ENV{HOME} );
 
-  Module::Build::Compat->create_makefile_pl('passthrough', $mb);
+  create_makefile_pl('passthrough', $mb);
 
   stdout_of( sub {
     $mb->run_perl_script('Makefile.PL', [], ['INSTALL_BASE=~/foo']);
@@ -290,8 +288,8 @@
     ok $mb, "Module::Build->new_from_context";
 
     # Create and test Makefile.PL
-    Module::Build::Compat->create_makefile_pl($type, $mb);
-    ok -e 'Makefile.PL', "$type Makefile.PL created";
+    create_makefile_pl($type, $mb);
+
     test_makefile_pl_requires_perl( $opts{requires}{perl} );
     test_makefile_creation($mb);
     test_makefile_prereq_pm( $opts{requires} );
@@ -430,3 +428,16 @@
   }
 }
 
+sub create_makefile_pl {
+    Module::Build::Compat->create_makefile_pl(@_);
+    my $ok = ok -e 'Makefile.PL', "$_[0] Makefile.PL created";
+
+    # Some really conservative make's, like HP/UX, assume files with the same
+    # timestamp are out of date.  Send the Makefile.PL one second into the past
+    # so its older than the Makefile it will generate.
+    # See [rt.cpan.org 45700]
+    my $mtime = (stat("Makefile.PL"))[9];
+    utime $mtime, $mtime - 1, "Makefile.PL";
+
+    return $ok;
+}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.