This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Porting/bump-perl-version: No need to try other maps after one has worked
[perl5.git] / Porting / bump-perl-version
index b867414..b60e8e3 100644 (file)
@@ -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;
@@ -194,14 +197,13 @@ my @maps =  (
         qr/uconfig/,
     ],
 
-    # rename perl-5^.15^.1.dirperl-5_15_1.dir in README.vms
+    # win32/Makefile.ce
     [
-       qr{\sperl-(\d+)_(\d+)_(\d+)\.dir}x,
-       sub { " perl-${1}_${2}_${3}.dir", " perl-${newx}_${newy}_${newz}.dir" },
-       " perl-${oldx}_${oldy}_{$oldz}.dir",
-       qr/README.vms/,
+        qr/(PV\s*=\s*)(\d\d{2})\b$/,
+        sub { $2, "$1$newx$newy" },
+        "$oldx$oldy",
+        qr/Makefile\.ce/,
     ],
-
 );
 
 
@@ -212,6 +214,7 @@ my %SKIP_FILES = map { ($_ => 1) } qw(
     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
@@ -220,6 +223,7 @@ my %SKIP_FILES = map { ($_ => 1) } qw(
     pp_ctl.c
 );
 my @SKIP_DIRS = qw(
+    dist
     ext
     lib
     pod
@@ -247,7 +251,7 @@ exit 0;
 
 sub do_scan {
     for my $file (@mani_files) {
-       next if grep $file =~ m{$_/}, @SKIP_DIRS;
+       next if grep $file =~ m{^$_/}, @SKIP_DIRS;
        if ($SKIP_FILES{$file}) {
            warn "(skipping $file)\n";
            next;
@@ -261,6 +265,7 @@ sub do_scan {
 
        while (my $line = <$fh>) {
            my $oldline = $line;
+           my $line_changed = 0;
            for my $map (@maps) {
                my ($pat, $sub, $expected, $file_pat) = @$map;
 
@@ -274,9 +279,13 @@ sub do_scan {
                }
                $line =~ s/$pat/$replacement/
                    or die "Internal error: substitution failed: [$pat]\n";
+               if ($line ne $oldline) {
+                   $line_changed = 1;
+                   last;
+               }
            }
            $new_contents .= $line if $opts{i};
-           if ($line ne $oldline) {
+           if ($line_changed) {
                $file_changed = 1;
                if ($opts{s}) {
                    print "\n$file\n" unless $header;