Mercurial > octave
changeset 25545:d068c71d4eed stable
build: Work around bug in perl 5.28.0 (bug #54202).
* build-aux/inplace_edit.pl: New Perl script to replace using 'perl -i -pe'
* doc/interpreter/module.mk: Replace instance of 'perl -i -pe' with call to
inplace_edit.pl.
author | Rik <rik@octave.org> |
---|---|
date | Sun, 01 Jul 2018 21:29:09 -0700 |
parents | e5208e98ab92 |
children | 93b564c789aa 8925207dbc26 |
files | build-aux/inplace_edit.pl doc/interpreter/module.mk |
diffstat | 2 files changed, 34 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build-aux/inplace_edit.pl Sun Jul 01 21:29:09 2018 -0700 @@ -0,0 +1,33 @@ +#!/usr/bin/perl -w + +################################################################################ +## File: inplace_edit.pl +## Usage: perl inplace_edit.pl 'PERL_CODE' file1 [file2] [...] +## Purpose: Run snippet of PERL_CODE on each line in a file and replace +## existing line with the results of running the code. +## This replaces perl -i -pe 'PERL_CODE' file1 [file2] ... +## due to a problem in Perl 5.28 which restricts the number of files +################################################################################ + +## Create Perl code from first argument (-e CODE) +eval "sub per_line_code { $ARGV[0]; }"; +shift @ARGV; + +## Loop over each file +foreach $fname (@ARGV) +{ + rename ($fname, "$fname.$$") or die "Rename failed:$fname:$!"; + open (my $FHI, "<", "$fname.$$") or die "Open failed:$fname.$$:$!"; + open (my $FHO, ">", "$fname") or die "Open failed:$fname:$!"; + + ## Loop over each line + while (<$FHI>) + { + per_line_code (); + print $FHO $_; + } + + close ($FHI); + close ($FHO); + unlink "$fname.$$" or die "Delete failed:$fname.$$:$!"; +}
--- a/doc/interpreter/module.mk Mon Jul 02 12:21:32 2018 -0700 +++ b/doc/interpreter/module.mk Sun Jul 01 21:29:09 2018 -0700 @@ -300,7 +300,7 @@ --css-ref=octave.css \ -o $(OCTAVE_HTML_TMP_DIR) `test -f '%reldir%/octave.texi' || echo '$(abs_top_srcdir)/'`%reldir%/octave.texi; \ then \ - $(PERL) -i -pe 's|(?<=</a>): ||g' $(OCTAVE_HTML_TMP_DIR)/* && \ + $(PERL) $(srcdir)/build-aux/inplace_edit.pl 's|(?<=</a>): ||g' $(OCTAVE_HTML_TMP_DIR)/* && \ rm -rf $(OCTAVE_HTML_DIR) && \ mv $(OCTAVE_HTML_TMP_DIR) $(OCTAVE_HTML_DIR) && \ touch $@; \