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-2020 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 16use strict; 17use Cwd; 18 19if (! -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 26open VERSION, '<', 'VERSION' 27 or die "$!\n$0: can't open VERSION file\n"; 28my $version = do { local $/; <VERSION> }; 29close VERSION or die "$!\n$0: can't close VERSION file\n"; 30 31my ($base,$mv,$pl,$suf) = $version =~ /^((\d+\.\d+)\.(\d+))(-\S+)?/ 32 or die "$0: bad VERSION format\n"; 33 34my $r1 = qr/^Changes from version/; 35my $r2 = qr/ to version \Q$base\E:/; 36my $rx = $pl ? qr/$r1 \Q$mv\E\.@{[$pl-1]}$r2/ : qr/${r1}s? \S+\.[0*]$r2/; 37 38open NEWS, '<', 'NEWS' 39 or die "$!\n$0: can't open NEWS file\n"; 40my $ok; 41while (<NEWS>) 42 { 43 /$rx/ and $ok = 1; 44 # If this is a release or a release candidate, check that 45 # the NEWS file does not contain FIXME or TODO. 46 $suf =~ /^(-rc.*)?$/ && /FIXME|TODO/ 47 and $! = 2, die "$0: $& in NEWS file"; 48 } 49close NEWS or die "$!\n$0: can't close NEWS file\n"; 50 51$ok or $! = 1, die "$0: missing or bad change log in NEWS file\n"; 52