diff --git a/lib/Module/Build/Base.pm b/lib/Module/Build/Base.pm index 00c5e01e..f9bd18be 100644 --- a/lib/Module/Build/Base.pm +++ b/lib/Module/Build/Base.pm @@ -4032,9 +4032,17 @@ sub ACTION_distdir { my $dist_files = $self->_read_manifest('MANIFEST') or die "Can't create distdir without a MANIFEST file - run 'manifest' action first.\n"; + delete $dist_files->{SIGNATURE}; # Don't copy, create a fresh one + + # Double check that we skip MYMETA.* + foreach my $file (keys %$dist_files) { + delete $dist_files->{$file} if $file =~ m{^MYMETA\.}; + } + die "No files found in MANIFEST - try running 'manifest' action?\n" unless ($dist_files and keys %$dist_files); + my $metafile = $self->metafile; $self->log_warn("*** Did you forget to add $metafile to the MANIFEST?\n") unless exists $dist_files->{$metafile}; @@ -4044,10 +4052,8 @@ sub ACTION_distdir { $self->log_info("Creating $dist_dir\n"); $self->add_to_cleanup($dist_dir); - foreach my $file (keys %$dist_files) { - next if $file =~ m{^MYMETA\.}; # Double check that we skip MYMETA.* - my $new = $self->copy_if_modified(from => $file, to_dir => $dist_dir, verbose => 0); - } + local $ExtUtils::Manifest::Quiet = 1; + ExtUtils::Manifest::manicopy($dist_files, $dist_dir); $self->do_create_bundle_inc if @{$self->bundle_inc}; diff --git a/t/runthrough.t b/t/runthrough.t index 1f6730e3..0d86f363 100644 --- a/t/runthrough.t +++ b/t/runthrough.t @@ -2,7 +2,9 @@ use strict; use lib 't/lib'; -use MBTest tests => 29; +use MBTest tests => 32; + +my $BuildPL_MTime = 1410291386; blib_load('Module::Build'); blib_load('Module::Build::ConfigData'); @@ -37,7 +39,6 @@ print FH "Contents: $filename\n"; close FH; --- $dist->regen; - $dist->chdir_in; @@ -54,6 +55,10 @@ eval {$mb->create_build_script}; is $@, ''; ok -e $mb->build_script; +# Set the mtime on Build.PL for use in testing later. +ok utime $BuildPL_MTime, $BuildPL_MTime, "Build.PL", "set time on Build.PL"; +is [stat("Build.PL")]->[9], $BuildPL_MTime; + my $dist_dir = 'Simple-0.01'; # VMS in traditional mode needs the $dist_dir name to not have a '.' in it @@ -117,6 +122,9 @@ ok grep {$_ eq 'save_out' } $mb->cleanup; stdout_stderr_of ( sub { eval {$mb->dispatch('distdir')} } ); is $@, ''; + is [stat(File::Spec->catfile("Simple-0.01", "Build.PL"))]->[9], + [stat("Build.PL")]->[9], "mtimes preserved by distdir"; + # The 'distdir' should contain a lib/ directory ok -e File::Spec->catdir('Simple-0.01', 'lib');