ck-news revision 1.1.1.1.2.1 1 #!/usr/bin/env perl
2
3 # Note: this script must not be used to build MPFR due to the
4 # dependency on perl, but this is OK for "make dist".
5
6 # Copyright 2016-2018 Free Software Foundation, Inc.
7 # This script is free software; the Free Software Foundation
8 # gives unlimited permission to copy and/or distribute it,
9 # with or without modifications, as long as this notice is preserved.
10
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14 # PARTICULAR PURPOSE.
15
16 use strict;
17 use Cwd;
18
19 if (! -d 'src')
20 {
21 getcwd() =~ m,/tools$,
22 or die "Execute $0 from the MPFR source directory\n";
23 chdir '..' or die "$!\n$0: can't change cwd\n";
24 }
25
26 open VERSION, '<', 'VERSION'
27 or die "$!\n$0: can't open VERSION file\n";
28 my $version = do { local $/; <VERSION> };
29 close VERSION or die "$!\n$0: can't close VERSION file\n";
30
31 my ($base,$mv,$pl,$suf) = $version =~ /^((\d+\.\d+)\.(\d+))(-\S+)?/
32 or die "$0: bad VERSION format\n";
33
34 my $r1 = qr/^Changes from version/;
35 my $r2 = qr/ to version \Q$base\E:/;
36 my $rx = $pl ? qr/$r1 \Q$mv\E\.@{[$pl-1]}$r2/ : qr/${r1}s? \S+\.[0*]$r2/;
37
38 open NEWS, '<', 'NEWS'
39 or die "$!\n$0: can't open NEWS file\n";
40 my $ok;
41 while (<NEWS>)
42 {
43 /$rx/ and $ok = 1;
44 $suf ne '-dev' && /FIXME|TODO/ and $! = 2, die "$0: $& in NEWS file";
45 }
46 close NEWS or die "$!\n$0: can't close NEWS file\n";
47
48 $ok or $! = 1, die "$0: missing or bad change log in NEWS file\n";
49