This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix a CPANPLUS test that fails when run on a read-only source tree
authorSteve Hay <SteveHay@planit.com>
Thu, 3 May 2007 07:51:17 +0000 (07:51 +0000)
committerSteve Hay <SteveHay@planit.com>
Thu, 3 May 2007 07:51:17 +0000 (07:51 +0000)
(such as a p4 client repository)

p4raw-id: //depot/perl@31121

lib/CPANPLUS/Internals.pm
lib/CPANPLUS/Internals/Source.pm

index 17760cb..897a4a7 100644 (file)
@@ -40,7 +40,7 @@ use vars qw[@ISA $VERSION];
             CPANPLUS::Internals::Report
         ];
 
-$VERSION = "0.79_01";
+$VERSION = "0.79_02";
 
 =pod
 
index c58632b..f527618 100644 (file)
@@ -318,8 +318,11 @@ sub _update_source {
 
         ### `touch` the file, so windoze knows it's new -jmb
         ### works on *nix too, good fix -Kane
-        utime ( $now, $now, File::Spec->catfile($path, $file) ) or
+        ### make sure it is writable first, otherwise the `touch` will fail
+        unless (chmod ( 0644, File::Spec->catfile($path, $file) ) &&
+                utime ( $now, $now, File::Spec->catfile($path, $file) )) {
             error( loc("Couldn't touch %1", $file) );
+        }
 
     }
     return 1;