diff options
author | Tony Cook <tony@develop-help.com> | 2015-12-01 16:10:55 +1100 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2016-06-13 10:56:13 +1000 |
commit | 31b6f23ed55c460d17977de41cb3e9cb766fd414 (patch) | |
tree | c54d306c67522f7bfb0e44b3327f2304a5a0d711 /make_ext.pl | |
parent | 33a10326b09f0725eabc08dc590a6c35764f20a4 (diff) | |
download | perl-31b6f23ed55c460d17977de41cb3e9cb766fd414.tar.gz |
[perl #126710] only touch pm_to_blib if files are copied
Add checks similar to what the Makefile would do: only copy the
files if the source file is newer than pm_to_blib
Diffstat (limited to 'make_ext.pl')
-rw-r--r-- | make_ext.pl | 45 |
1 files changed, 31 insertions, 14 deletions
diff --git a/make_ext.pl b/make_ext.pl index 64263bd818..8270092d7d 100644 --- a/make_ext.pl +++ b/make_ext.pl @@ -699,20 +699,37 @@ sub just_pm_to_blib { } # This is running under miniperl, so no autodie if ($target eq 'all') { - local $ENV{PERL_INSTALL_QUIET} = 1; - require ExtUtils::Install; - ExtUtils::Install::pm_to_blib(\%pm, '../../lib/auto'); - open my $fh, '>', $pm_to_blib - or die "Can't open '$pm_to_blib': $!"; - print $fh "$0 has handled pm_to_blib directly\n"; - close $fh - or die "Can't close '$pm_to_blib': $!"; - if (IS_UNIX) { - # Fake the fallback cleanup - my $fallback - = join '', map {s!^\.\./\.\./!!; "rm -f $_\n"} sort values %pm; - foreach my $clean_target ('realclean', 'veryclean') { - fallback_cleanup($return_dir, $clean_target, $fallback); + my $need_update = 1; + if (-f $pm_to_blib) { + # avoid touching pm_to_blib unless there's something that + # needs updating, see #126710 + $need_update = 0; + my $test_at = -M _; + while (my $from = each(%pm)) { + if (-M $from < $test_at) { + ++$need_update; + last; + } + } + keys %pm; # reset iterator + } + + if ($need_update) { + local $ENV{PERL_INSTALL_QUIET} = 1; + require ExtUtils::Install; + ExtUtils::Install::pm_to_blib(\%pm, '../../lib/auto'); + open my $fh, '>', $pm_to_blib + or die "Can't open '$pm_to_blib': $!"; + print $fh "$0 has handled pm_to_blib directly\n"; + close $fh + or die "Can't close '$pm_to_blib': $!"; + if (IS_UNIX) { + # Fake the fallback cleanup + my $fallback + = join '', map {s!^\.\./\.\./!!; "rm -f $_\n"} sort values %pm; + foreach my $clean_target ('realclean', 'veryclean') { + fallback_cleanup($return_dir, $clean_target, $fallback); + } } } } else { |