File: get_release_notes.pl

package info (click to toggle)
splash 3.11.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,068 kB
  • sloc: f90: 55,119; ansic: 2,435; python: 828; makefile: 601; cpp: 529; perl: 219; sh: 152
file content (65 lines) | stat: -rwxr-xr-x 1,686 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/perl
#
# @(#) Perl script to extract release notes from src/splash.f90
#
my $start = 0;
my $out = "";
my $do_all = 0;
my $file='src/splash.f90'; # default filename if no arguments given
# handle command line arguments
if ($#ARGV==0) {
  # can give ./get_release_notes all [with default file name]
  # or ./get_release_notes src/splash.f90 [to specify file name]
  if ( @ARGV[0] =~ m/all/ ) {
    $do_all = 1;
  } else {
    $file = @ARGV[0];
  };
} elsif ($#ARGV==1) {
  # or ./get_release_notes src/splash.f90 all [to specify file name AND all option]
  $file = @ARGV[0];
  if ( @ARGV[1] =~ m/all/ ) {
    $do_all = 1;
  };
} elsif ($#ARGV > 1) {
   die "Usage: $0 src/file.f90 [all] \n";
}
my @eqns = [];
open(FILE,$file);
while (<FILE>) {
  my $line = $_;
  if ( m/(\d+\.\d+\.\d+\s*:\s*\(\d+\/\d+\/\d+\))\s+(.*)$/ or m/(\d+\.\d+\.\d+\s*:)\s+$/) {
     my $version=$1;
     $version =~ s/\s+:\s+/: /g;
     if ($start == 1) {
        # print release notes as bullet points
        foreach (split /\;/, $out) {
           print "-$_\n";
        }
        if ($do_all==1) {
           $out = "";
           print "\n**$version**\n\n";
        } else {
           close(FILE);
           exit()
        };
     } else {
        if ($do_all==1) {
           print "\n**$version**\n\n";
        }
        $start = 1;
        $out = "";
     }
  } elsif ($start == 1) {
     # last entry, close on matching ---- line
     if (m/----/) {
        foreach (split /\;/, $out) {
           print "-$_\n";
        }
        close(FILE);
        exit()
     }
     $line =~ m/\!\s+(.*)$/;  # match '!  some text' and get rid of ! and spaces
     $out = "${out} $1";      # append
  }
}