diff options
author | Nicholas Clark <nick@ccl4.org> | 2014-02-27 10:21:52 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2014-03-02 07:08:54 +0100 |
commit | a5bd6593733644fa5dea102b5dc5660137543b0f (patch) | |
tree | 55c2bb6ec8371a2b1a3e9970cb15a0fbe11167f6 /make_ext.pl | |
parent | 3fbff3ec9773b4a8b8ccfc97a1829b2435cc1a7d (diff) | |
download | perl-a5bd6593733644fa5dea102b5dc5660137543b0f.tar.gz |
Extract fallback_cleanup() to hold the code that writes cleanup shell scripts.
Diffstat (limited to 'make_ext.pl')
-rw-r--r-- | make_ext.pl | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/make_ext.pl b/make_ext.pl index 0c877fc9ea..3f8dad2732 100644 --- a/make_ext.pl +++ b/make_ext.pl @@ -468,14 +468,8 @@ EOM # But this always used to be a problem with the old /bin/sh version of # this. if ($is_Unix) { - my $suffix = '.sh'; foreach my $clean_target ('realclean', 'veryclean') { - my $file = "$return_dir/$clean_target$suffix"; - open my $fh, '>>', $file or die "open $file: $!"; - # Quite possible that we're being run in parallel here. - # Can't use Fcntl this early to get the LOCK_EX - flock $fh, 2 or warn "flock $file: $!"; - print $fh <<"EOS"; + fallback_cleanup($return_dir, $clean_target, <<"EOS"); cd $ext_dir if test ! -f Makefile -a -f Makefile.old; then echo "Note: Using Makefile.old" @@ -488,7 +482,6 @@ else fi cd $return_dir EOS - close $fh or die "close $file: $!"; } } } @@ -538,3 +531,14 @@ sub _unlink { my $err = $!; die "Can't unlink $_[0]: $err" if -f $_[0]; } + +sub fallback_cleanup { + my ($dir, $clean_target, $contents) = @_; + my $file = "$dir/$clean_target.sh"; + open my $fh, '>>', $file or die "open $file: $!"; + # Quite possible that we're being run in parallel here. + # Can't use Fcntl this early to get the LOCK_EX + flock $fh, 2 or warn "flock $file: $!"; + print $fh $contents or die "print $file: $!"; + close $fh or die "close $file: $!"; +} |