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";
121 if ($reldir =~ /^([0-9]+\.0)/) { $reldir = $1; }
122 elsif ($reldir =~ /^([0-9]+)\./) { $reldir = "$1.x"; }
123 else { die "unknown version format $reldir"; }
125 my $is_stable = ($new =~ /^([0-9]+)\.0\.([0-9]+)$/); # stable releases have a 0 minor number
126 my $filter = "product=Wine&resolution=FIXED&" . ($is_stable ?
"target_milestone=$reldir.x" : "bug_status=RESOLVED");
128 my %bugs = get_bugs
( $filter );
129 my %authors = get_authors
();
131 # update the ANNOUNCE file
133 open ANNOUNCE
, "<ANNOUNCE" or die "cannot open ANNOUNCE";
134 open NEW
, ">ANNOUNCE.new" or die "cannot create ANNOUNCE.new";
136 # replace version number in first line
138 s/(([0-9]+)\.)+[0-9]+(-rc[0-9]+)?/$new/;
143 last if /^------------------/;
144 s!(https?://.*/wine/source/).*\.tar!$1$reldir/wine-$new.tar!;
148 print NEW
"----------------------------------------------------------------\n\n";
149 printf NEW
"Bugs fixed in %s (total %u):\n\n", $new, scalar( keys %bugs );
150 foreach my $id (sort {$a <=> $b} keys %bugs)
152 printf NEW
" %6d %s\n", $id, unescape
( $bugs{$id} );
155 print NEW
"\n----------------------------------------------------------------\n\n";
156 print NEW
"Changes since $old:\n\n";
158 open LOG
, "-|" or exec "git", "shortlog", "wine-$old..HEAD" or die "cannot run git shortlog";
161 if (/^(\S.*)\s\(\d+\):$/) { $authors{$1} = 1; }
166 while (<ANNOUNCE
>) { last if /^--$/; }
168 while (<ANNOUNCE
>) { print NEW
$_; }
172 update_file
( "ANNOUNCE" );
174 # update the AUTHORS file
176 setlocale
( LC_COLLATE
, "en_US.UTF-8" );
178 open AUTHORS
, ">AUTHORS.new" or die "cannot create AUTHORS.new";
179 print AUTHORS
"Wine is available thanks to the work of:\n\n", join( "\n", sort keys %authors ), "\n";
181 update_file
( "AUTHORS" );