This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Changes.
[perl5.git] / fix_pl
1 #!perl
2 # Not fixing perl, but fixing the patchlevel if this perl comes
3 # from the repository rather than an official release
4 exit unless -e ".patch";
5 open PATCH, ".patch" or die "Couldn't open .patch: $!";
6 open PLIN, "patchlevel.h" or die "Couldn't open patchlevel.h : $!";
7 open PLOUT, ">patchlevel.new" or die "Couldn't write on patchlevel.new : $!";
8 my $pl = <PATCH>;
9 chomp ($pl);
10 $pl =~ s/\D//g;
11 my $seen=0;
12 while (<PLIN>) {
13     if (/\t,NULL/ and $seen) {
14         print PLOUT "\t,\"devel-$pl\"\n";
15     }
16     $seen++ if /local_patches\[\]/;
17     print PLOUT;
18 }
19 close PLOUT; close PLIN;
20 rename "patchlevel.new", "patchlevel.h" or die "Couldn't rename: $!";
21 unlink ".patch";