This is a live mirror of the Perl 5 development currently hosted at
https://github.com/perl/perl5
https://perl5.git.perl.org
/
perl5.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
charnames.t: Indent newly formed block
[perl5.git]
/
Porting
/
bump-perl-version
diff --git
a/Porting/bump-perl-version
b/Porting/bump-perl-version
index
2023ff8
..
b867414
100644
(file)
--- a/
Porting/bump-perl-version
+++ b/
Porting/bump-perl-version
@@
-57,6
+57,7
@@
sub usage { die <<EOF }
usage: $0 -c <C.C.C>
-s <C.C.C> <N.N.N>
-u
usage: $0 -c <C.C.C>
-s <C.C.C> <N.N.N>
-u
+ -i <C.C.C> <N.N.N>
-c check files and warn if any known string values (eg
PERL_SUBVERSION) don't match the specified version
-c check files and warn if any known string values (eg
PERL_SUBVERSION) don't match the specified version
@@
-65,12
+66,14
@@
usage: $0 -c <C.C.C>
-u read in the scan file from stdin, and change all the lines specified
-u read in the scan file from stdin, and change all the lines specified
+ -i scan files and make changes inplace
+
C.C.C the current perl version, eg 5.10.0
N.N.N the new perl version, eg 5.10.1
EOF
my %opts;
C.C.C the current perl version, eg 5.10.0
N.N.N the new perl version, eg 5.10.1
EOF
my %opts;
-getopts('csu', \%opts) or usage;
+getopts('csu
i
', \%opts) or usage;
if ($opts{u}) {
@ARGV == 0 or usage('no version version numbers should be specified');
# fake to stop warnings when calculating $oldx etc
if ($opts{u}) {
@ARGV == 0 or usage('no version version numbers should be specified');
# fake to stop warnings when calculating $oldx etc
@@
-83,7
+86,7
@@
elsif ($opts{c}) {
else {
@ARGV == 2 or usage('require two version numbers');
}
else {
@ARGV == 2 or usage('require two version numbers');
}
-usage('only one of -c, -s
and -u
') if keys %opts > 1;
+usage('only one of -c, -s
, -u and -i
') if keys %opts > 1;
my ($oldx, $oldy, $oldz) = $ARGV[0] =~ /^(\d+)\.(\d+)\.(\d+)$/
or usage("bad version: $ARGV[0]");
my ($oldx, $oldy, $oldz) = $ARGV[0] =~ /^(\d+)\.(\d+)\.(\d+)$/
or usage("bad version: $ARGV[0]");
@@
-180,7
+183,7
@@
my @maps = (
qr{\b ((?:lib)?) perl (\d\d\d) (s?) \b }x,
sub {$2, "$1perl$newx$newy$3" },
"$oldx$oldy",
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
],
# microperl locations should be bumped for major versions
@@
-191,6
+194,14
@@
my @maps = (
qr/uconfig/,
],
qr/uconfig/,
],
+ # rename perl-5^.15^.1.dirperl-5_15_1.dir in README.vms
+ [
+ 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/,
+ ],
+
);
);
@@
-199,12
+210,13
@@
my @maps = (
my %SKIP_FILES = map { ($_ => 1) } qw(
Changes
MANIFEST
my %SKIP_FILES = map { ($_ => 1) } qw(
Changes
MANIFEST
+ Porting/Maintainers.pl
+ Porting/acknowledgements.pl
Porting/epigraphs.pod
Porting/how_to_write_a_perldelta.pod
Porting/release_managers_guide.pod
Porting/release_schedule.pod
Porting/bump-perl-version
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(
pp_ctl.c
);
my @SKIP_DIRS = qw(
@@
-219,7
+231,7
@@
my @mani_files = sort keys %{ExtUtils::Manifest::maniread('MANIFEST')};
my %mani_files = map { ($_ => 1) } @mani_files;
die "No entries found in MANIFEST; aborting\n" unless @mani_files;
my %mani_files = map { ($_ => 1) } @mani_files;
die "No entries found in MANIFEST; aborting\n" unless @mani_files;
-if ($opts{c} or $opts{s}) {
+if ($opts{c} or $opts{s}
or $opts{i}
) {
do_scan();
}
elsif ($opts{u}) {
do_scan();
}
elsif ($opts{u}) {
@@
-242,30
+254,45
@@
sub do_scan {
}
open my $fh, '<', $file;
my $header = 0;
}
open my $fh, '<', $file;
my $header = 0;
+ my @stat = stat $file;
+ my $mode = $stat[2];
+ my $file_changed = 0;
+ my $new_contents = '';
- while (<$fh>) {
+ 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;
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 ($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";
or die "Internal error: substitution failed: [$pat]\n";
- if ($_ ne $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;
print "\n$file\n" unless $header;
$header=1;
- printf "\n%5d: -%s +%s", $., $
_, $newstr
;
+ printf "\n%5d: -%s +%s", $., $
oldline, $line
;
}
}
- last;
}
}
}
}
+ if ($opts{i} && $file_changed) {
+ warn "Updating $file inplace\n";
+ open my $fh, '>', $file;
+ binmode $fh;
+ print $fh $new_contents;
+ close $fh;
+ chmod $mode & 0777, $file;
+ }
}
warn "(skipped $_/*)\n" for @SKIP_DIRS;
}
}
warn "(skipped $_/*)\n" for @SKIP_DIRS;
}