X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/dc40e4976a788b09d14895f13b26823be4d28994..8b5692380409165c56f3858735141b00875ff0f1:/Porting/bump-perl-version diff --git a/Porting/bump-perl-version b/Porting/bump-perl-version index 63cb5ae..f2f5bcc 100644 --- a/Porting/bump-perl-version +++ b/Porting/bump-perl-version @@ -26,6 +26,9 @@ # $ Porting/bump-perl-version -u < /tmp/scan # # (so line 52 of Porting/config.sh is now updated) +# +# The -i option can be used to combine these two steps (if you prefer to make +# all of the changes at once and then edit the results via git). # This utility 'knows' about certain files and formats, and so can spot # 'hidden' version numbers, like PERL_SUBVERSION=9. @@ -40,7 +43,7 @@ # # Note there are various files and directories that it skips; these are # ones that are unlikely to contain anything needing bumping, but which -# will generate lots fo false positives (eg pod/*). These are listed on +# will generate lots of false positives (eg pod/*). These are listed on # STDERR as they are skipped. use strict; @@ -183,7 +186,7 @@ my @maps = ( qr{\b ((?:lib)?) perl (\d\d\d) (s?) \b }x, sub {$2, "$1perl$newx$newy$3" }, "$oldx$oldy", - qr/makedef|win32|hints/, # makedef.pl, README.win32, win32/*, hints/* + qr/win32|hints/, # README.win32, win32/*, hints/* ], # microperl locations should be bumped for major versions @@ -202,12 +205,14 @@ my @maps = ( my %SKIP_FILES = map { ($_ => 1) } qw( Changes MANIFEST + Porting/Maintainers.pl + Porting/acknowledgements.pl + Porting/corelist-perldelta.pl Porting/epigraphs.pod Porting/how_to_write_a_perldelta.pod Porting/release_managers_guide.pod Porting/release_schedule.pod Porting/bump-perl-version - pod.lst pp_ctl.c ); my @SKIP_DIRS = qw( @@ -250,35 +255,31 @@ sub do_scan { my $file_changed = 0; my $new_contents = ''; - while (<$fh>) { - my $line_changed; + while (my $line = <$fh>) { + my $oldline = $line; for my $map (@maps) { my ($pat, $sub, $expected, $file_pat) = @$map; next if defined $file_pat and $file !~ $file_pat; - next unless $_ =~ $pat; + next unless $line =~ $pat; my ($got, $replacement) = $sub->(); if ($opts{c}) { # only report unexpected next unless defined $expected and $got ne $expected; } - my $newstr = $_; - $newstr =~ s/$pat/$replacement/ + $line =~ s/$pat/$replacement/ or die "Internal error: substitution failed: [$pat]\n"; - $new_contents .= $newstr if $opts{i}; - if ($_ ne $newstr) { - $file_changed = 1; - $line_changed = 1; - if ($opts{s}) { - print "\n$file\n" unless $header; - $header=1; - printf "\n%5d: -%s +%s", $., $_, $newstr; - } + } + $new_contents .= $line if $opts{i}; + if ($line ne $oldline) { + $file_changed = 1; + if ($opts{s}) { + print "\n$file\n" unless $header; + $header=1; + printf "\n%5d: -%s +%s", $., $oldline, $line; } - last; } - $new_contents .= $_ if $opts{i} && !$line_changed ; } if ($opts{i} && $file_changed) { warn "Updating $file inplace\n";