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 Text
::CSV
::Encoded
;
28 use open ':encoding(utf8)';
33 $str =~ s/"/\"/g;
34 $str =~ s/'/\'/g;
42 # update a file if changed
46 if (!(-f
$file) || system "cmp $file $file.new >/dev/null")
48 rename "$file.new", "$file";
49 print "$file updated\n";
57 # determine the current version number
58 sub get_current_version
()
62 open VERSION
, "<VERSION" or die "cannot open VERSION";
63 if (<VERSION
> =~ /Wine version (\S+)/) { $version = $1; }
65 die "failed to parse VERSION" unless $version;
69 # retrieve a list of bugs with the specified filter
73 my $csv = Text
::CSV
::Encoded
->new({ encoding_in
=> "utf-8", encoding_out
=> "utf-8" });
76 open QUERY
, "-|" or exec "wget", "-qO-", "https://bugs.winehq.org/buglist.cgi?columnlist=short_desc&query_format=advanced&ctype=csv&$filter"
77 or die "cannot query bug list";
78 <QUERY
>; # skip header line
81 next unless $csv->parse($_);
82 my ($id, $descr) = $csv->fields();
89 # retrieve the current list of authors
94 open AUTHORS
, "<AUTHORS" or die "cannot open AUTHORS";
95 <AUTHORS
>; # skip header line
106 # determine the version number
108 my $old = get_current_version
();
112 if ($old =~ /^([0-9]+)\.([0-9]+)$/) { $new = "$1.$2.1"; }
113 elsif ($old =~ /^([0-9]+)\.([0-9]+)\.([0-9]+)$/) { $new = "$1.$2." . ($3 + 1); }
114 elsif ($old =~ /^([0-9]+)\.([0-9]+)-rc([0-9]+)$/) { $new = "$1.$2-rc" . ($3 + 1); }
115 else { die "unknown version format $old"; }
118 print "Updating files for release $new\n";
120 (my $reldir = $new) =~ s/^([0-9]+\.[0-9]+).*/$1/;
121 my $is_stable = ($new =~ /^([0-9]+)\.([0-9]+)\.([0-9]+)$/) && !($2 % 2); # stable releases have an even minor number
122 my $filter = "product=Wine&resolution=FIXED&" . ($is_stable ?
"target_milestone=$reldir.x" : "bug_status=RESOLVED");
124 my %bugs = get_bugs
( $filter );
125 my %authors = get_authors
();
127 # update the ANNOUNCE file
129 open ANNOUNCE
, "<ANNOUNCE" or die "cannot open ANNOUNCE";
130 open NEW
, ">ANNOUNCE.new" or die "cannot create ANNOUNCE.new";
133 last if /^------------------/;
134 s!http://mirrors.ibiblio.org/wine/source/.*!http://mirrors.ibiblio.org/wine/source/$reldir/wine-$new.tar.bz2!;
135 s!http://dl.winehq.org/wine/source/.*!http://dl.winehq.org/wine/source/$reldir/wine-$new.tar.bz2!;
139 print NEW
"----------------------------------------------------------------\n\n";
140 printf NEW
"Bugs fixed in %s (total %u):\n\n", $new, scalar( keys %bugs );
141 foreach my $id (sort {$a <=> $b} keys %bugs)
143 printf NEW
" %6d %s\n", $id, unescape
( $bugs{$id} );
146 print NEW
"\n----------------------------------------------------------------\n\n";
147 print NEW
"Changes since $old:\n\n";
149 open LOG
, "-|" or exec "git", "shortlog", "wine-$old..HEAD" or die "cannot run git shortlog";
152 if (/^(\S.*)\s\(\d+\):$/) { $authors{$1} = 1; }
157 while (<ANNOUNCE
>) { last if /^--$/; }
159 while (<ANNOUNCE
>) { print NEW
$_; }
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" );