| 1 |
#!/bin/sh |
| 2 |
#! -*-perl-*- |
| 3 |
|
| 4 |
# Generate a release announcement message. |
| 5 |
|
| 6 |
# Copyright (C) 2002-2026 Free Software Foundation, Inc. |
| 7 |
# |
| 8 |
# This program is free software: you can redistribute it and/or modify |
| 9 |
# it under the terms of the GNU General Public License as published by |
| 10 |
# the Free Software Foundation, either version 3 of the License, or |
| 11 |
# (at your option) any later version. |
| 12 |
# |
| 13 |
# This program is distributed in the hope that it will be useful, |
| 14 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
# GNU General Public License for more details. |
| 17 |
# |
| 18 |
# You should have received a copy of the GNU General Public License |
| 19 |
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 20 |
# |
| 21 |
# Written by Jim Meyering |
| 22 |
|
| 23 |
# This prologue allows running a perl script as an executable |
| 24 |
# on systems that are compliant to a POSIX version before POSIX:2017. |
| 25 |
# On such systems, the usual invocation of an executable through execlp() |
| 26 |
# or execvp() fails with ENOEXEC if it is a script that does not start |
| 27 |
# with a #! line. The script interpreter mentioned in the #! line has |
| 28 |
# to be /bin/sh, because on GuixSD systems that is the only program that |
| 29 |
# has a fixed file name. The second line is essential for perl and is |
| 30 |
# also useful for editing this file in Emacs. The next two lines below |
| 31 |
# are valid code in both sh and perl. When executed by sh, they re-execute |
| 32 |
# the script through the perl program found in $PATH. The '-x' option |
| 33 |
# is essential as well; without it, perl would re-execute the script |
| 34 |
# through /bin/sh. When executed by perl, the next two lines are a no-op. |
| 35 |
eval 'exec perl -wSx "$0" "$@"' |
| 36 |
if 0; |
| 37 |
|
| 38 |
my $VERSION = '2025-11-26 21:27'; # UTC |
| 39 |
# The definition above must lie within the first 8 lines in order |
| 40 |
# for the Emacs time-stamp write hook (at end) to update it. |
| 41 |
# If you change this file with Emacs, please let the write hook |
| 42 |
# do its job. Otherwise, update this string manually. |
| 43 |
|
| 44 |
(my $copyright_year = $VERSION) =~ s/^(\d*)-.*$/$1/; |
| 45 |
|
| 46 |
use strict; |
| 47 |
use Getopt::Long; |
| 48 |
use POSIX qw(strftime); |
| 49 |
|
| 50 |
(my $ME = $0) =~ s|.*/||; |
| 51 |
|
| 52 |
my %valid_release_types = map {$_ => 1} qw (alpha beta stable); |
| 53 |
my @archive_suffixes = qw (tar.gz tar.bz2 tar.bz3 tar.lz tar.lzma tar.xz |
| 54 |
tar.zst zip); |
| 55 |
my $srcdir = '.'; |
| 56 |
|
| 57 |
sub usage ($) |
| 58 |
{ |
| 59 |
my ($exit_code) = @_; |
| 60 |
my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR); |
| 61 |
if ($exit_code != 0) |
| 62 |
{ |
| 63 |
print $STREAM "Try '$ME --help' for more information.\n"; |
| 64 |
} |
| 65 |
else |
| 66 |
{ |
| 67 |
my @types = sort keys %valid_release_types; |
| 68 |
print $STREAM <<EOF; |
| 69 |
Usage: $ME [OPTIONS] |
| 70 |
Generate an announcement message. Run this from builddir. |
| 71 |
|
| 72 |
OPTIONS: |
| 73 |
|
| 74 |
These options must be specified: |
| 75 |
|
| 76 |
--release-type=TYPE TYPE must be one of @types |
| 77 |
--package-name=PACKAGE_NAME |
| 78 |
--previous-version=VER |
| 79 |
--current-version=VER |
| 80 |
--gpg-key-id=ID The GnuPG ID of the key used to sign the tarballs |
| 81 |
--url-directory=URL_DIR |
| 82 |
|
| 83 |
The following are optional: |
| 84 |
|
| 85 |
--news=NEWS_FILE include the NEWS section about this release |
| 86 |
from this NEWS_FILE; accumulates. |
| 87 |
--srcdir=DIR where to find the NEWS_FILEs (default: $srcdir) |
| 88 |
--bootstrap-tools=TOOL_LIST a comma-separated list of tools, e.g., |
| 89 |
autoconf,automake,bison,gnulib |
| 90 |
--gnulib-version=VERSION report VERSION as the gnulib version, where |
| 91 |
VERSION is the result of running git describe |
| 92 |
in the gnulib source directory. |
| 93 |
required if gnulib is in TOOL_LIST. |
| 94 |
--gpg-key-email=EMAIL The email address of the key used to |
| 95 |
sign the tarballs |
| 96 |
--gpg-keyring-url=URL URL pointing to keyring containing the key used |
| 97 |
to sign the tarballs |
| 98 |
--no-print-checksums do not emit SHA256 or SHA3-256 checksums |
| 99 |
--cksum-checksums emit SHA256 and SHA3-256 checksums in a form |
| 100 |
that requires cksum from coreutils or OpenBSD |
| 101 |
--archive-suffix=SUF add SUF to the list of archive suffixes |
| 102 |
--mail-headers=HEADERS a space-separated list of mail headers, e.g., |
| 103 |
To: x\@example.com Cc: y-announce\@example.com,... |
| 104 |
|
| 105 |
--help display this help and exit |
| 106 |
--version output version information and exit |
| 107 |
|
| 108 |
Send patches and bug reports to <bug-gnulib\@gnu.org>. |
| 109 |
EOF |
| 110 |
} |
| 111 |
exit $exit_code; |
| 112 |
} |
| 113 |
|
| 114 |
=over |
| 115 |
|
| 116 |
=item C<%size = sizes (@file)> |
| 117 |
|
| 118 |
Compute the sizes of the C<@file> and return them as a hash. Return |
| 119 |
C<undef> if one of the computation failed. |
| 120 |
|
| 121 |
=cut |
| 122 |
|
| 123 |
sub sizes (@) |
| 124 |
{ |
| 125 |
my (@file) = @_; |
| 126 |
|
| 127 |
my $fail = 0; |
| 128 |
my %res; |
| 129 |
foreach my $f (@file) |
| 130 |
{ |
| 131 |
my $cmd = "du -h -L $f"; |
| 132 |
my $t = `$cmd`; |
| 133 |
# FIXME-someday: give a better diagnostic, a la $PROCESS_STATUS |
| 134 |
$@ |
| 135 |
and (warn "command failed: '$cmd'\n"), $fail = 1; |
| 136 |
chomp $t; |
| 137 |
$t =~ s/^\s*([\d.]+[MkK]).*/${1}B/; |
| 138 |
$res{$f} = $t; |
| 139 |
} |
| 140 |
return $fail ? undef : %res; |
| 141 |
} |
| 142 |
|
| 143 |
=item C<print_locations ($title, \@url, \%size, @file)> |
| 144 |
|
| 145 |
Print a section C<$title> dedicated to the list of C<@file>, which |
| 146 |
sizes are stored in C<%size>, and which are available from the C<@url>. |
| 147 |
|
| 148 |
=cut |
| 149 |
|
| 150 |
sub print_locations ($\@\%@) |
| 151 |
{ |
| 152 |
my ($title, $url, $size, @file) = @_; |
| 153 |
print "Here are the $title:\n"; |
| 154 |
foreach my $url (@{$url}) |
| 155 |
{ |
| 156 |
for my $file (@file) |
| 157 |
{ |
| 158 |
print " $url/$file"; |
| 159 |
print " (", $$size{$file}, ")" |
| 160 |
if exists $$size{$file}; |
| 161 |
print "\n"; |
| 162 |
} |
| 163 |
} |
| 164 |
print "\n"; |
| 165 |
} |
| 166 |
|
| 167 |
=item C<print_checksums (@file)> |
| 168 |
|
| 169 |
Print the SHA256 and SHA3-256 signature section for each C<@file>. |
| 170 |
|
| 171 |
=cut |
| 172 |
|
| 173 |
# This digest function omits the "=" padding that is required by cksum, |
| 174 |
# so add the 0..2 bytes of padding required for each of Digest's algorithms. |
| 175 |
# To verify such a digest, users need |
| 176 |
# - a particular command ('cksum -a sha256 --check') |
| 177 |
# - and particular tools (coreutils >= 9.2 or OpenBSD's cksum since 2007). |
| 178 |
sub digest_file_base64_wrap ($$) |
| 179 |
{ |
| 180 |
my ($file, $alg) = @_; |
| 181 |
my $h = digest_file_base64($file, $alg); |
| 182 |
$alg =~ tr{-}{}d; |
| 183 |
my %pad = (MD5 => 2, SHA1 => 1, SHA256 => 1, SHA384 => 0, SHA512 => 2, |
| 184 |
SHA3256 => 1, SHA3384 => 0, SHA3512 => 2); |
| 185 |
(my $alg_tag = $alg) =~ s/^SHA3(\d{3})/SHA3-$1/; |
| 186 |
return $alg_tag . " (" . $file . ") = " . $h . '=' x $pad{$alg}; |
| 187 |
} |
| 188 |
|
| 189 |
sub print_checksums ($@) |
| 190 |
{ |
| 191 |
my ($prefer_cksum, @file) = @_; |
| 192 |
|
| 193 |
print "Here are the SHA256 and SHA3-256 checksums:\n"; |
| 194 |
print "\n"; |
| 195 |
|
| 196 |
use Digest::file qw(digest_file_hex digest_file_base64); |
| 197 |
|
| 198 |
if ($prefer_cksum) |
| 199 |
{ |
| 200 |
foreach my $f (@file) |
| 201 |
{ |
| 202 |
print ' ', digest_file_base64_wrap ($f, "SHA-256"), "\n"; |
| 203 |
print ' ', digest_file_base64_wrap ($f, "SHA3-256"), "\n"; |
| 204 |
} |
| 205 |
print "\nVerify the base64 SHA256 checksum with 'cksum -a sha256 --check'\n"; |
| 206 |
print "from coreutils-9.2 or OpenBSD's cksum since 2007.\n"; |
| 207 |
print "\nVerify the base64 SHA3-256 checksum with 'cksum -a sha3 --check'\n"; |
| 208 |
print "from coreutils-9.8.\n\n"; |
| 209 |
} |
| 210 |
else |
| 211 |
{ |
| 212 |
foreach my $f (@file) |
| 213 |
{ |
| 214 |
print " File: $f\n"; |
| 215 |
print ' SHA256 sum: ', digest_file_hex ($f, "SHA-256"), "\n"; |
| 216 |
print ' SHA3-256 sum: ', digest_file_hex ($f, "SHA3-256"), "\n"; |
| 217 |
print "\n"; |
| 218 |
} |
| 219 |
print "Verify the SHA256 checksum with either sha256sum, sha256, or\n"; |
| 220 |
print "'shasum -a 256'.\n"; |
| 221 |
print "\nVerify the SHA3-256 checksum with 'cksum -a sha3 -l 256 --base64'\n"; |
| 222 |
print "from coreutils-9.8.\n\n"; |
| 223 |
} |
| 224 |
} |
| 225 |
|
| 226 |
=item C<print_news_deltas ($news_file, $prev_version, $curr_version)> |
| 227 |
|
| 228 |
Print the section of the NEWS file C<$news_file> addressing changes |
| 229 |
between versions C<$prev_version> and C<$curr_version>. |
| 230 |
|
| 231 |
=cut |
| 232 |
|
| 233 |
sub print_news_deltas ($$$) |
| 234 |
{ |
| 235 |
my ($news_file, $prev_version, $curr_version) = @_; |
| 236 |
|
| 237 |
my $news_name = $news_file; |
| 238 |
$news_name =~ s|^\Q$srcdir\E/||; |
| 239 |
|
| 240 |
print "\n$news_name\n\n"; |
| 241 |
|
| 242 |
# Print all lines from $news_file, starting with the first one |
| 243 |
# that mentions $curr_version up to but not including |
| 244 |
# the first occurrence of $prev_version. |
| 245 |
my $in_items; |
| 246 |
|
| 247 |
my $re_prefix = qr/(?:[#*]+ )?(?:Noteworthy c|Major c|C)(?i:hanges)/; |
| 248 |
|
| 249 |
my $found_news; |
| 250 |
open NEWS, '<', $news_file |
| 251 |
or die "$ME: $news_file: cannot open for reading: $!\n"; |
| 252 |
while (defined (my $line = <NEWS>)) |
| 253 |
{ |
| 254 |
if ( ! $in_items) |
| 255 |
{ |
| 256 |
# Match lines like these: |
| 257 |
# * Major changes in release 5.0.1: |
| 258 |
# * Noteworthy changes in release 6.6 (2006-11-22) [stable] |
| 259 |
$line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$curr_version\E(?:[^\d.]|$)/o |
| 260 |
or next; |
| 261 |
$in_items = 1; |
| 262 |
print $line; |
| 263 |
} |
| 264 |
else |
| 265 |
{ |
| 266 |
# This regexp must not match version numbers in NEWS items. |
| 267 |
# For example, they might well say "introduced in 4.5.5", |
| 268 |
# and we don't want that to match. |
| 269 |
$line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$prev_version\E(?:[^\d.]|$)/o |
| 270 |
and last; |
| 271 |
print $line; |
| 272 |
$line =~ /\S/ |
| 273 |
and $found_news = 1; |
| 274 |
} |
| 275 |
} |
| 276 |
close NEWS; |
| 277 |
|
| 278 |
$in_items |
| 279 |
or die "$ME: $news_file: no matching lines for '$curr_version'\n"; |
| 280 |
$found_news |
| 281 |
or die "$ME: $news_file: no news item found for '$curr_version'\n"; |
| 282 |
} |
| 283 |
|
| 284 |
sub print_changelog_deltas ($$) |
| 285 |
{ |
| 286 |
my ($package_name, $prev_version) = @_; |
| 287 |
|
| 288 |
# Print new ChangeLog entries. |
| 289 |
|
| 290 |
# First find all CVS-controlled ChangeLog files. |
| 291 |
use File::Find; |
| 292 |
my @changelog; |
| 293 |
find ({wanted => sub {$_ eq 'ChangeLog' && -d 'CVS' |
| 294 |
and push @changelog, $File::Find::name}}, |
| 295 |
'.'); |
| 296 |
|
| 297 |
# If there are no ChangeLog files, we're done. |
| 298 |
@changelog |
| 299 |
or return; |
| 300 |
my %changelog = map {$_ => 1} @changelog; |
| 301 |
|
| 302 |
# Reorder the list of files so that if there are ChangeLog |
| 303 |
# files in the specified directories, they're listed first, |
| 304 |
# in this order: |
| 305 |
my @dir = qw ( . src lib m4 config doc ); |
| 306 |
|
| 307 |
# A typical @changelog array might look like this: |
| 308 |
# ./ChangeLog |
| 309 |
# ./po/ChangeLog |
| 310 |
# ./m4/ChangeLog |
| 311 |
# ./lib/ChangeLog |
| 312 |
# ./doc/ChangeLog |
| 313 |
# ./config/ChangeLog |
| 314 |
my @reordered; |
| 315 |
foreach my $d (@dir) |
| 316 |
{ |
| 317 |
my $dot_slash = $d eq '.' ? $d : "./$d"; |
| 318 |
my $target = "$dot_slash/ChangeLog"; |
| 319 |
delete $changelog{$target} |
| 320 |
and push @reordered, $target; |
| 321 |
} |
| 322 |
|
| 323 |
# Append any remaining ChangeLog files. |
| 324 |
push @reordered, sort keys %changelog; |
| 325 |
|
| 326 |
# Remove leading './'. |
| 327 |
@reordered = map { s!^\./!!; $_ } @reordered; |
| 328 |
|
| 329 |
print "\nChangeLog entries:\n\n"; |
| 330 |
# print join ("\n", @reordered), "\n"; |
| 331 |
|
| 332 |
$prev_version =~ s/\./_/g; |
| 333 |
my $prev_cvs_tag = "\U$package_name\E-$prev_version"; |
| 334 |
|
| 335 |
my $cmd = "cvs -n diff -u -r$prev_cvs_tag -rHEAD @reordered"; |
| 336 |
open DIFF, '-|', $cmd |
| 337 |
or die "$ME: cannot run '$cmd': $!\n"; |
| 338 |
# Print two types of lines, making minor changes: |
| 339 |
# Lines starting with '+++ ', e.g., |
| 340 |
# +++ ChangeLog 22 Feb 2003 16:52:51 -0000 1.247 |
| 341 |
# and those starting with '+'. |
| 342 |
# Don't print the others. |
| 343 |
my $prev_printed_line_empty = 1; |
| 344 |
while (defined (my $line = <DIFF>)) |
| 345 |
{ |
| 346 |
if ($line =~ /^\+\+\+ /) |
| 347 |
{ |
| 348 |
my $separator = "*"x70 ."\n"; |
| 349 |
$line =~ s///; |
| 350 |
$line =~ s/\s.*//; |
| 351 |
$prev_printed_line_empty |
| 352 |
or print "\n"; |
| 353 |
print $separator, $line, $separator; |
| 354 |
} |
| 355 |
elsif ($line =~ /^\+/) |
| 356 |
{ |
| 357 |
$line =~ s///; |
| 358 |
print $line; |
| 359 |
$prev_printed_line_empty = ($line =~ /^$/); |
| 360 |
} |
| 361 |
} |
| 362 |
close DIFF; |
| 363 |
|
| 364 |
# The exit code should be 1. |
| 365 |
# Allow in case there are no modified ChangeLog entries. |
| 366 |
$? == 256 || $? == 128 |
| 367 |
or warn "warning: '$cmd' had unexpected exit code or signal ($?)\n"; |
| 368 |
} |
| 369 |
|
| 370 |
sub get_tool_versions ($$) |
| 371 |
{ |
| 372 |
my ($tool_list, $gnulib_version) = @_; |
| 373 |
@$tool_list |
| 374 |
or return (); |
| 375 |
|
| 376 |
my $fail; |
| 377 |
my @tool_version_pair; |
| 378 |
foreach my $t (@$tool_list) |
| 379 |
{ |
| 380 |
if ($t eq 'gnulib') |
| 381 |
{ |
| 382 |
push @tool_version_pair, ucfirst $t . ' ' . $gnulib_version; |
| 383 |
next; |
| 384 |
} |
| 385 |
# Assume that the last "word" on the first line of |
| 386 |
# 'tool --version' output is the version string. |
| 387 |
my ($first_line, undef) = split ("\n", `$t --version`); |
| 388 |
if ($first_line =~ /.* ([a-f\d][\w.-]+)$/) |
| 389 |
{ |
| 390 |
$t = ucfirst $t; |
| 391 |
push @tool_version_pair, "$t $1"; |
| 392 |
} |
| 393 |
else |
| 394 |
{ |
| 395 |
warn "$t: unexpected --version output:\n$first_line"; |
| 396 |
defined $first_line |
| 397 |
and $first_line = ''; |
| 398 |
$fail = 1; |
| 399 |
} |
| 400 |
} |
| 401 |
|
| 402 |
$fail |
| 403 |
and exit 1; |
| 404 |
|
| 405 |
return @tool_version_pair; |
| 406 |
} |
| 407 |
|
| 408 |
# Print a more human-friendly representation of $SEC seconds. |
| 409 |
sub readable_interval0($) |
| 410 |
{ |
| 411 |
my $sec = shift; |
| 412 |
$sec < 60 and return "$sec seconds"; |
| 413 |
|
| 414 |
my $min = int($sec / 60); $sec %= 60; |
| 415 |
30 < $sec and $min++; |
| 416 |
$min < 60 and return "$min minutes"; |
| 417 |
|
| 418 |
my $hr = int($min / 60); $min %= 60; |
| 419 |
30 < $min and $hr++; |
| 420 |
$hr < 24 and return "$hr hours"; |
| 421 |
|
| 422 |
my $day = int($hr / 24); $hr %= 24; |
| 423 |
12 < $hr and $day++; |
| 424 |
$day < 50 and return "$day days"; |
| 425 |
|
| 426 |
my $wk = int($day / 7); $day %= 7; |
| 427 |
4 < $day and $wk++; |
| 428 |
return "$wk weeks"; |
| 429 |
} |
| 430 |
|
| 431 |
# Convert e.g., "1 weeks", to "1 week". |
| 432 |
sub readable_interval($) |
| 433 |
{ |
| 434 |
my $interval_str = shift; |
| 435 |
my $i = readable_interval0 $interval_str; |
| 436 |
$i =~ m{^1 \w+s$} and chop $i; |
| 437 |
return $i; |
| 438 |
} |
| 439 |
|
| 440 |
{ |
| 441 |
# Use the C locale so that, for instance, "du" does not |
| 442 |
# print "1,2" instead of "1.2", which would confuse our regexps. |
| 443 |
$ENV{LC_ALL} = "C"; |
| 444 |
|
| 445 |
my $mail_headers; |
| 446 |
my $release_type; |
| 447 |
my $package_name; |
| 448 |
my $prev_version; |
| 449 |
my $curr_version; |
| 450 |
my $gpg_key_id; |
| 451 |
my @url_dir_list; |
| 452 |
my @news_file; |
| 453 |
my $bootstrap_tools; |
| 454 |
my $gnulib_version; |
| 455 |
my $print_checksums_p = 1; |
| 456 |
my $cksum_checksums_p; |
| 457 |
my $gpg_key_email; |
| 458 |
my $gpg_keyring_url; |
| 459 |
|
| 460 |
# Reformat the warnings before displaying them. |
| 461 |
local $SIG{__WARN__} = sub |
| 462 |
{ |
| 463 |
my ($msg) = @_; |
| 464 |
# Warnings from GetOptions. |
| 465 |
$msg =~ s/Option (\w)/option --$1/; |
| 466 |
warn "$ME: $msg"; |
| 467 |
}; |
| 468 |
|
| 469 |
GetOptions |
| 470 |
( |
| 471 |
'mail-headers=s' => \$mail_headers, |
| 472 |
'release-type=s' => \$release_type, |
| 473 |
'package-name=s' => \$package_name, |
| 474 |
'previous-version=s' => \$prev_version, |
| 475 |
'current-version=s' => \$curr_version, |
| 476 |
'gpg-key-id=s' => \$gpg_key_id, |
| 477 |
'gpg-key-email=s' => \$gpg_key_email, |
| 478 |
'gpg-keyring-url=s' => \$gpg_keyring_url, |
| 479 |
'url-directory=s' => \@url_dir_list, |
| 480 |
'news=s' => \@news_file, |
| 481 |
'srcdir=s' => \$srcdir, |
| 482 |
'bootstrap-tools=s' => \$bootstrap_tools, |
| 483 |
'gnulib-version=s' => \$gnulib_version, |
| 484 |
'print-checksums!' => \$print_checksums_p, |
| 485 |
'cksum-checksums' => \$cksum_checksums_p, |
| 486 |
'archive-suffix=s' => \@archive_suffixes, |
| 487 |
|
| 488 |
help => sub { usage 0 }, |
| 489 |
version => |
| 490 |
sub |
| 491 |
{ |
| 492 |
print "$ME version $VERSION\n"; |
| 493 |
print "Copyright (C) $copyright_year Free Software Foundation, Inc.\n"; |
| 494 |
print "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.\n" |
| 495 |
. "This is free software: you are free to change and redistribute it.\n" |
| 496 |
. "There is NO WARRANTY, to the extent permitted by law.\n"; |
| 497 |
print "\n"; |
| 498 |
my $author = "Jim Meyering"; |
| 499 |
print "Written by $author.\n"; |
| 500 |
exit |
| 501 |
}, |
| 502 |
) or usage 1; |
| 503 |
|
| 504 |
my $fail = 0; |
| 505 |
# Ensure that each required option is specified. |
| 506 |
$release_type |
| 507 |
or (warn "release type not specified\n"), $fail = 1; |
| 508 |
$package_name |
| 509 |
or (warn "package name not specified\n"), $fail = 1; |
| 510 |
$prev_version |
| 511 |
or (warn "previous version string not specified\n"), $fail = 1; |
| 512 |
$curr_version |
| 513 |
or (warn "current version string not specified\n"), $fail = 1; |
| 514 |
$gpg_key_id |
| 515 |
or (warn "GnuPG key ID not specified\n"), $fail = 1; |
| 516 |
@url_dir_list |
| 517 |
or (warn "URL directory name(s) not specified\n"), $fail = 1; |
| 518 |
|
| 519 |
my @tool_list = split ',', $bootstrap_tools |
| 520 |
if $bootstrap_tools; |
| 521 |
|
| 522 |
grep (/^gnulib$/, @tool_list) && ! defined $gnulib_version |
| 523 |
and (warn "when specifying gnulib as a tool, you must also specify\n" |
| 524 |
. "--gnulib-version=V, where V is the result of running git describe\n" |
| 525 |
. "in the gnulib source directory.\n"), $fail = 1; |
| 526 |
|
| 527 |
! grep (/^gnulib$/, @tool_list) && defined $gnulib_version |
| 528 |
and (warn "with --gnulib-version=V you must use --bootstrap-tools=...\n" |
| 529 |
. "including gnulib in that list"), $fail = 1; |
| 530 |
|
| 531 |
!$release_type || exists $valid_release_types{$release_type} |
| 532 |
or (warn "'$release_type': invalid release type\n"), $fail = 1; |
| 533 |
|
| 534 |
@ARGV |
| 535 |
and (warn "too many arguments:\n", join ("\n", @ARGV), "\n"), |
| 536 |
$fail = 1; |
| 537 |
$fail |
| 538 |
and usage 1; |
| 539 |
|
| 540 |
my $my_distdir = "$package_name-$curr_version"; |
| 541 |
|
| 542 |
my $xd = "$package_name-$prev_version-$curr_version.xdelta"; |
| 543 |
|
| 544 |
my @candidates = map { "$my_distdir.$_" } @archive_suffixes; |
| 545 |
my @tarballs = grep {-f $_} @candidates; |
| 546 |
|
| 547 |
@tarballs |
| 548 |
or die "$ME: none of " . join(', ', @candidates) . " were found\n"; |
| 549 |
my @sizable = @tarballs; |
| 550 |
-f $xd |
| 551 |
and push @sizable, $xd; |
| 552 |
my %size = sizes (@sizable); |
| 553 |
%size |
| 554 |
or exit 1; |
| 555 |
|
| 556 |
my $headers = ''; |
| 557 |
if (defined $mail_headers) |
| 558 |
{ |
| 559 |
($headers = $mail_headers) =~ s/\s+(\S+:)/\n$1/g; |
| 560 |
$headers .= "\n"; |
| 561 |
} |
| 562 |
|
| 563 |
# The markup is escaped as <\# so that when this script is sent by |
| 564 |
# mail (or part of a diff), Gnus is not triggered. |
| 565 |
print <<EOF; |
| 566 |
|
| 567 |
${headers}Subject: $my_distdir released [$release_type] |
| 568 |
|
| 569 |
<\#secure method=pgpmime mode=sign> |
| 570 |
This is to announce $package_name-$curr_version, a $release_type release. |
| 571 |
|
| 572 |
FIXME: put comments here |
| 573 |
|
| 574 |
EOF |
| 575 |
|
| 576 |
my $v0 = $prev_version; |
| 577 |
my $v1 = $curr_version; |
| 578 |
|
| 579 |
(my $first_name = `git -C "$srcdir" config user.name|cut -d' ' -f1`) |
| 580 |
=~ m{\S} or die "no name? set user.name in ~/.gitconfig\n"; |
| 581 |
|
| 582 |
chomp (my $n_ci = `git -C "$srcdir" rev-list "v$v0..v$v1" | wc -l`); |
| 583 |
chomp (my $n_p = `git -C "$srcdir" shortlog "v$v0..v$v1" | grep -c '^[^ ]'`); |
| 584 |
|
| 585 |
my $this_commit_hash = `git -C "$srcdir" log --pretty=%H -1 "v$v1"`; |
| 586 |
chop $this_commit_hash; |
| 587 |
my $prev_release_date = `git -C "$srcdir" log --pretty=%ct -1 "v$v0"`; |
| 588 |
my $this_release_date = `git -C "$srcdir" log --pretty=%ct -1 "v$v1"`; |
| 589 |
my $n_seconds = $this_release_date - $prev_release_date; |
| 590 |
my $time_since_prev = readable_interval $n_seconds; |
| 591 |
my $names = `git -C "$srcdir" shortlog "v$v0..v$v1"|perl -lne '/^(\\w.*):/ and print " ".\$1'`; |
| 592 |
|
| 593 |
print <<EOF; |
| 594 |
There have been $n_ci commits by $n_p people in the $time_since_prev since $v0. |
| 595 |
|
| 596 |
See the NEWS below for a brief summary. |
| 597 |
|
| 598 |
Thanks to everyone who has contributed! |
| 599 |
The following people contributed changes to this release: |
| 600 |
|
| 601 |
$names |
| 602 |
$first_name [on behalf of the $package_name maintainers] |
| 603 |
================================================================== |
| 604 |
|
| 605 |
Here is the GNU $package_name home page: |
| 606 |
https://gnu.org/s/$package_name/ |
| 607 |
|
| 608 |
EOF |
| 609 |
|
| 610 |
if (@url_dir_list == 1 && @tarballs == 1) |
| 611 |
{ |
| 612 |
# When there's only one tarball and one URL, use a more concise form. |
| 613 |
my $m = "$url_dir_list[0]/$tarballs[0]"; |
| 614 |
print "Here are the compressed sources and a GPG detached signature:\n" |
| 615 |
. " $m\n" |
| 616 |
. " $m.sig\n\n"; |
| 617 |
} |
| 618 |
else |
| 619 |
{ |
| 620 |
print_locations ("compressed sources", @url_dir_list, %size, @tarballs); |
| 621 |
-f $xd |
| 622 |
and print_locations ("xdelta diffs (useful? if so, " |
| 623 |
. "please tell bug-gnulib\@gnu.org)", |
| 624 |
@url_dir_list, %size, $xd); |
| 625 |
my @sig_files = map { "$_.sig" } @tarballs; |
| 626 |
print_locations ("GPG detached signatures", @url_dir_list, %size, |
| 627 |
@sig_files); |
| 628 |
} |
| 629 |
|
| 630 |
if ($url_dir_list[0] =~ "gnu\.org") |
| 631 |
{ |
| 632 |
print "Use a mirror for higher download bandwidth:\n"; |
| 633 |
if (@tarballs == 1 && $url_dir_list[0] =~ m!https://ftp\.gnu\.org/gnu/!) |
| 634 |
{ |
| 635 |
(my $m = "$url_dir_list[0]/$tarballs[0]") |
| 636 |
=~ s!https://ftp\.gnu\.org/gnu/!https://ftpmirror\.gnu\.org/!; |
| 637 |
print " $m\n" |
| 638 |
. " $m.sig\n\n"; |
| 639 |
|
| 640 |
} |
| 641 |
else |
| 642 |
{ |
| 643 |
print " https://www.gnu.org/order/ftp.html\n\n"; |
| 644 |
} |
| 645 |
} |
| 646 |
|
| 647 |
$print_checksums_p |
| 648 |
and print_checksums ($cksum_checksums_p, @sizable); |
| 649 |
|
| 650 |
print <<EOF; |
| 651 |
Use a .sig file to verify that the corresponding file (without the |
| 652 |
.sig suffix) is intact. First, be sure to download both the .sig file |
| 653 |
and the corresponding tarball. Then, run a command like this: |
| 654 |
|
| 655 |
gpg --verify $tarballs[0].sig |
| 656 |
|
| 657 |
EOF |
| 658 |
my $gpg_fingerprint = `LC_ALL=C gpg --fingerprint $gpg_key_id | grep -v ^sub`; |
| 659 |
if ($gpg_fingerprint =~ /^pub/) |
| 660 |
{ |
| 661 |
chop $gpg_fingerprint; |
| 662 |
$gpg_fingerprint =~ s/ \[expires:.*//mg; |
| 663 |
$gpg_fingerprint =~ s/^uid \[ultimate\]/uid /mg; |
| 664 |
$gpg_fingerprint =~ s/^/ /mg; |
| 665 |
print<<EOF |
| 666 |
The signature should match the fingerprint of the following key: |
| 667 |
|
| 668 |
$gpg_fingerprint |
| 669 |
EOF |
| 670 |
} |
| 671 |
print <<EOF; |
| 672 |
If that command fails because you don't have the required public key, |
| 673 |
or that public key has expired, try the following commands to retrieve |
| 674 |
or refresh it, and then rerun the 'gpg --verify' command. |
| 675 |
EOF |
| 676 |
if ($gpg_key_email) { |
| 677 |
print <<EOF; |
| 678 |
|
| 679 |
gpg --locate-external-key $gpg_key_email |
| 680 |
EOF |
| 681 |
} |
| 682 |
print <<EOF; |
| 683 |
|
| 684 |
gpg --recv-keys $gpg_key_id |
| 685 |
EOF |
| 686 |
if ($gpg_keyring_url) { |
| 687 |
print <<EOF; |
| 688 |
|
| 689 |
wget -q -O- '$gpg_keyring_url' | gpg --import - |
| 690 |
EOF |
| 691 |
} |
| 692 |
print <<EOF; |
| 693 |
|
| 694 |
As a last resort to find the key, you can try the official GNU |
| 695 |
keyring: |
| 696 |
|
| 697 |
wget -q https://ftp.gnu.org/gnu/gnu-keyring.gpg |
| 698 |
gpg --keyring gnu-keyring.gpg --verify $tarballs[0].sig |
| 699 |
EOF |
| 700 |
|
| 701 |
print <<EOF; |
| 702 |
|
| 703 |
This release is based on the $package_name git repository, available as |
| 704 |
|
| 705 |
git clone https://https.git.savannah.gnu.org/git/$package_name.git |
| 706 |
|
| 707 |
with commit $this_commit_hash tagged as v$v1. |
| 708 |
|
| 709 |
For a summary of changes and contributors, see: |
| 710 |
|
| 711 |
https://gitweb.git.savannah.gnu.org/gitweb/?p=$package_name.git;a=shortlog;h=v$v1 |
| 712 |
|
| 713 |
or run this command from a git-cloned $package_name directory: |
| 714 |
|
| 715 |
git shortlog v$v0..v$v1 |
| 716 |
EOF |
| 717 |
|
| 718 |
my @tool_versions = get_tool_versions (\@tool_list, $gnulib_version); |
| 719 |
@tool_versions |
| 720 |
and print "\nThis release was bootstrapped with the following tools:", |
| 721 |
join ('', map {"\n $_"} @tool_versions), "\n"; |
| 722 |
|
| 723 |
print_news_deltas ($_, $prev_version, $curr_version) |
| 724 |
foreach @news_file; |
| 725 |
|
| 726 |
$release_type eq 'stable' |
| 727 |
or print_changelog_deltas ($package_name, $prev_version); |
| 728 |
|
| 729 |
exit 0; |
| 730 |
} |
| 731 |
|
| 732 |
=back |
| 733 |
|
| 734 |
=cut |
| 735 |
|
| 736 |
### Setup "GNU" style for perl-mode and cperl-mode. |
| 737 |
## Local Variables: |
| 738 |
## mode: perl |
| 739 |
## perl-indent-level: 2 |
| 740 |
## perl-continued-statement-offset: 2 |
| 741 |
## perl-continued-brace-offset: 0 |
| 742 |
## perl-brace-offset: 0 |
| 743 |
## perl-brace-imaginary-offset: 0 |
| 744 |
## perl-label-offset: -2 |
| 745 |
## perl-extra-newline-before-brace: t |
| 746 |
## perl-merge-trailing-else: nil |
| 747 |
## eval: (add-hook 'before-save-hook 'time-stamp nil t) |
| 748 |
## time-stamp-line-limit: 50 |
| 749 |
## time-stamp-start: "my $VERSION = '" |
| 750 |
## time-stamp-format: "%Y-%02m-%02d %02H:%02M" |
| 751 |
## time-stamp-time-zone: "UTC0" |
| 752 |
## time-stamp-end: "'; # UTC" |
| 753 |
## End: |