3 # Update the ANNOUNCE file for a new release.
5 # Usage: make_announce [new_version]
7 # Copyright 2016 Alexandre Julliard
9 # This library is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public
11 # License as published by the Free Software Foundation; either
12 # version 2.1 of the License, or (at your option) any later version.
14 # This library is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # Lesser General Public License for more details.
19 # You should have received a copy of the GNU Lesser General Public
20 # License along with this library; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
27 use open ':encoding(utf8)';
32 $str =~ s/"/\"/g;
33 $str =~ s/'/\'/g;
41 # update a file if changed
45 if (!(-f
$file) || system "cmp $file $file.new >/dev/null")
47 rename "$file.new", "$file";
48 print "$file updated\n";
56 # determine the current version number
57 sub get_current_version
()
61 open VERSION
, "<VERSION" or die "cannot open VERSION";
62 if (<VERSION
> =~ /Wine version (\S+)/) { $version = $1; }
64 die "failed to parse VERSION" unless $version;
68 # retrieve a list of bugs with the specified filter
73 open QUERY
, "-|" or exec "git", "log", "--notes=stable-notes", "--format=%N", "wine-" . get_current_version
() . ".."
74 or die "cannot query bug list";
77 next unless /^Fixes: \[(\d+)\] (.*)/;
84 # retrieve the current list of authors
89 open AUTHORS
, "<AUTHORS" or die "cannot open AUTHORS";
90 <AUTHORS
>; # skip header line
101 # determine the version number
103 my $old = get_current_version
();
107 if ($old =~ /^([0-9]+)\.([0-9]+)$/) { $new = "$1." . ($2 + 1); }
108 elsif ($old =~ /^([0-9]+)\.([0-9]+)\.([0-9]+)$/) { $new = "$1.$2." . ($3 + 1); }
109 elsif ($old =~ /^([0-9]+)\.([0-9]+)-rc([0-9]+)$/) { $new = "$1.$2-rc" . ($3 + 1); }
110 else { die "unknown version format $old"; }
113 print "Updating files for release $new\n";
116 if ($reldir =~ /^([0-9]+\.0)/) { $reldir = $1; }
117 elsif ($reldir =~ /^([0-9]+)\./) { $reldir = "$1.x"; }
118 else { die "unknown version format $reldir"; }
120 my $is_stable = ($new =~ /^([0-9]+)\.0\.([0-9]+)$/); # stable releases have a 0 minor number
121 my $filter = "product=Wine&resolution=FIXED&" . ($is_stable ?
"target_milestone=$reldir.x" : "bug_status=RESOLVED");
123 my %bugs = get_bugs
( $filter );
124 my %authors = get_authors
();
126 # update the ANNOUNCE file
128 open ANNOUNCE
, "<ANNOUNCE" or die "cannot open ANNOUNCE";
129 open NEW
, ">ANNOUNCE.new" or die "cannot create ANNOUNCE.new";
131 # replace version number in first line
133 s/(([0-9]+)\.)+[0-9]+(-rc[0-9]+)?/$new/;
138 last if /^------------------/;
139 s!(https?://.*/wine/source/).*\.tar!$1$reldir/wine-$new.tar!;
143 print NEW
"----------------------------------------------------------------\n\n";
144 printf NEW
"Bugs fixed in %s (total %u):\n\n", $new, scalar( keys %bugs );
145 foreach my $id (sort {$a <=> $b} keys %bugs)
147 printf NEW
" - #%-6d %s\n", $id, unescape
( $bugs{$id} );
150 print NEW
"\n----------------------------------------------------------------\n\n";
151 print NEW
"Changes since $old:\n";
153 open LOG
, "-|" or exec "git", "shortlog", "wine-$old..HEAD" or die "cannot run git shortlog";
157 if (/^(\S.*)\s\(\d+\):$/) { $authors{$1} = 1; print NEW
"\n"; }
163 update_file
( "ANNOUNCE" );
165 # update the AUTHORS file
167 setlocale
( LC_COLLATE
, "en_US.UTF-8" );
169 open AUTHORS
, ">AUTHORS.new" or die "cannot create AUTHORS.new";
170 print AUTHORS
"Wine is available thanks to the work of:\n\n", join( "\n", sort keys %authors ), "\n";
172 update_file
( "AUTHORS" );