1#! /usr/bin/env perl -pi
2
3BEGIN {
4    our $count = 1;              # Only the first one
5    our $RELEASE = $ENV{RELEASE};
6    our $RELEASE_TEXT = $ENV{RELEASE_TEXT};
7    our $PREV_RELEASE_DATE = $ENV{PREV_RELEASE_DATE} || 'under development';
8    our $PREV_RELEASE_TEXT = $ENV{PREV_RELEASE_TEXT};
9
10    $RELEASE =~ s/-dev//;
11}
12
13if (/^### Major changes between OpenSSL (\S+) and OpenSSL (\S+) \[under development\]/
14    && $count-- > 0) {
15    my $v1 = $1;
16    my $v2 = $PREV_RELEASE_TEXT || $2;
17
18    # If this is a pre-release, we do nothing
19    if ($RELEASE !~ /^\d+\.\d+\.\d+-(?:alpha|beta)/) {
20        $_ = <<_____
21### Major changes between OpenSSL $v2 and OpenSSL $RELEASE_TEXT [under development]
22
23  * none
24
25### Major changes between OpenSSL $v1 and OpenSSL $v2 [$PREV_RELEASE_DATE]
26_____
27    }
28}
29