summaryrefslogtreecommitdiff
path: root/fix_pl
blob: 44c3f521700a9e42ba6bcdaef3e6a288c3097da8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!perl
# Not fixing perl, but fixing the patchlevel if this perl comes
# from the repository rather than an official release
exit unless -e ".patch";
open PATCH, ".patch" or die "Couldn't open .patch: $!";
open PLIN, "patchlevel.h" or die "Couldn't open patchlevel.h : $!";
open PLOUT, ">patchlevel.new" or die "Couldn't write on patchlevel.new : $!";
my $pl = <PATCH>;
chomp ($pl);
$pl =~ s/\D//g;
my $seen=0;
while (<PLIN>) {
    if (/\t,NULL/ and $seen) {
        print PLOUT "\t,\"devel-$pl\"\n";
    }
    $seen++ if /local_patches\[\]/;
    print PLOUT;
}
close PLOUT; close PLIN;
rename "patchlevel.new", "patchlevel.h" or die "Couldn't rename: $!";
unlink ".patch";