Author: randys
Date: Sat Apr 8 21:15:13 2006
New Revision: 5878
Modified:
Module-Build/trunk/Changes
Module-Build/trunk/lib/Module/Build/Authoring.pod
Module-Build/trunk/lib/Module/Build/Base.pm
Log:
copy_if_modified() now preserves file mode and timestamps.
Modified: Module-Build/trunk/Changes
==============================================================================
--- Module-Build/trunk/Changes (original)
+++ Module-Build/trunk/Changes Sat Apr 8 21:15:13 2006
@@ -2,6 +2,9 @@
0.27_11
+ - copy_if_modified() now preserves the file mode and timestamps for
+ files that are copied.
+
- Backing out a requirement added in 0.27_06 on the method y_n()
to always include a default. This behavior would cause existing
build scripts to start failing. We now fail with a missing default
Modified: Module-Build/trunk/lib/Module/Build/Authoring.pod
==============================================================================
--- Module-Build/trunk/lib/Module/Build/Authoring.pod (original)
+++ Module-Build/trunk/lib/Module/Build/Authoring.pod Sat Apr 8 21:15:13 2006
@@ -1034,6 +1034,8 @@
Any directories that need to be created in order to perform the
copying will be automatically created.
+File mode and timestamps are preserved.
+
=item create_build_script()
[version 0.05]
Modified: Module-Build/trunk/lib/Module/Build/Base.pm
==============================================================================
--- Module-Build/trunk/lib/Module/Build/Base.pm (original)
+++ Module-Build/trunk/lib/Module/Build/Base.pm Sat Apr 8 21:15:13 2006
@@ -2927,8 +2927,6 @@
foreach my $file (keys %$dist_files) {
my $new = $self->copy_if_modified(from => $file, to_dir => $dist_dir, verbose => 0);
- chmod +(stat $file)[2], $new
- or $self->log_warn("Couldn't set permissions on $new: $!");
}
$self->_sign_dir($dist_dir) if $self->{properties}{sign};
@@ -3931,6 +3929,13 @@
$self->log_info("$file -> $to_path\n") if $args{verbose};
File::Copy::copy($file, $to_path) or die "Can't copy('$file', '$to_path'): $!";
+ # preserve mode & timestamps; copied from ExtUtils::Install::pm_to_blib
+ my($mode, $atime, $mtime) = (stat $file)[2,8,9];
+ my $mtime_adj = ($self->os_type eq 'VMS') ? 1 : 0;
+ utime($atime, $mtime + $mtime_adj, $to_path);
+ $mode = 0444 | ( $mode & 0111 ? 0111 : 0 );
+ chmod($mode, $to_path);
+
return $to_path;
}
|