X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=build-aux%2Fannounce-gen;fp=build-aux%2Fannounce-gen;h=ec7c22a281ffa323f657d3f60047a38ef69804cd;hb=dc84183747ce1703eb99685b5dbde1f65a143c06;hp=7d70fd4b59bac87362cc92a27f2b15187721340a;hpb=a2016c1de6e4884f6c8ed5cc498f3bf821c25ca4;p=debian%2Fgzip diff --git a/build-aux/announce-gen b/build-aux/announce-gen index 7d70fd4..ec7c22a 100755 --- a/build-aux/announce-gen +++ b/build-aux/announce-gen @@ -3,13 +3,13 @@ eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}' if 0; # Generate a release announcement message. -my $VERSION = '2009-11-20 13:36'; # UTC +my $VERSION = '2012-06-08 06:53'; # UTC # The definition above must lie within the first 8 lines in order # for the Emacs time-stamp write hook (at end) to update it. # If you change this file with Emacs, please let the write hook # do its job. Otherwise, update this string manually. -# Copyright (C) 2002-2010 Free Software Foundation, Inc. +# Copyright (C) 2002-2012 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -30,13 +30,15 @@ use strict; use Getopt::Long; use Digest::MD5; -use Digest::SHA1; +eval { require Digest::SHA; } + or eval 'use Digest::SHA1'; use POSIX qw(strftime); (my $ME = $0) =~ s|.*/||; my %valid_release_types = map {$_ => 1} qw (alpha beta stable); my @archive_suffixes = ('tar.gz', 'tar.bz2', 'tar.lzma', 'tar.xz'); +my $srcdir = '.'; sub usage ($) { @@ -44,14 +46,14 @@ sub usage ($) my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR); if ($exit_code != 0) { - print $STREAM "Try `$ME --help' for more information.\n"; + print $STREAM "Try '$ME --help' for more information.\n"; } else { my @types = sort keys %valid_release_types; print $STREAM <new->addfile(*IN)->hexdigest - : Digest::SHA1->new->addfile(*IN)->hexdigest); - close IN; - print "$dig $f\n"; - } + { + open IN, '<', $f + or die "$ME: $f: cannot open for reading: $!\n"; + binmode IN; + my $dig = + ($meth eq 'md5' + ? Digest::MD5->new->addfile(*IN)->hexdigest + : Digest::SHA1->new->addfile(*IN)->hexdigest); + close IN; + print "$dig $f\n"; + } } print "\n"; } @@ -178,7 +184,10 @@ sub print_news_deltas ($$$) { my ($news_file, $prev_version, $curr_version) = @_; - print "\n$news_file\n\n"; + my $news_name = $news_file; + $news_name =~ s|^\Q$srcdir\E/||; + + print "\n$news_name\n\n"; # Print all lines from $news_file, starting with the first one # that mentions $curr_version up to but not including @@ -187,34 +196,39 @@ sub print_news_deltas ($$$) my $re_prefix = qr/(?:\* )?(?:Noteworthy c|Major c|C)(?i:hanges)/; + my $found_news; open NEWS, '<', $news_file or die "$ME: $news_file: cannot open for reading: $!\n"; while (defined (my $line = )) { if ( ! $in_items) - { - # Match lines like these: - # * Major changes in release 5.0.1: - # * Noteworthy changes in release 6.6 (2006-11-22) [stable] - $line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$curr_version\E(?:[^\d.]|$)/o - or next; - $in_items = 1; - print $line; - } + { + # Match lines like these: + # * Major changes in release 5.0.1: + # * Noteworthy changes in release 6.6 (2006-11-22) [stable] + $line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$curr_version\E(?:[^\d.]|$)/o + or next; + $in_items = 1; + print $line; + } else - { - # This regexp must not match version numbers in NEWS items. - # For example, they might well say `introduced in 4.5.5', - # and we don't want that to match. - $line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$prev_version\E(?:[^\d.]|$)/o - and last; - print $line; - } + { + # This regexp must not match version numbers in NEWS items. + # For example, they might well say "introduced in 4.5.5", + # and we don't want that to match. + $line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$prev_version\E(?:[^\d.]|$)/o + and last; + print $line; + $line =~ /\S/ + and $found_news = 1; + } } close NEWS; $in_items - or die "$ME: $news_file: no matching lines for `$curr_version'\n"; + or die "$ME: $news_file: no matching lines for '$curr_version'\n"; + $found_news + or die "$ME: $news_file: no news item found for '$curr_version'\n"; } sub print_changelog_deltas ($$) @@ -227,8 +241,8 @@ sub print_changelog_deltas ($$) use File::Find; my @changelog; find ({wanted => sub {$_ eq 'ChangeLog' && -d 'CVS' - and push @changelog, $File::Find::name}}, - '.'); + and push @changelog, $File::Find::name}}, + '.'); # If there are no ChangeLog files, we're done. @changelog @@ -253,13 +267,13 @@ sub print_changelog_deltas ($$) my $dot_slash = $d eq '.' ? $d : "./$d"; my $target = "$dot_slash/ChangeLog"; delete $changelog{$target} - and push @reordered, $target; + and push @reordered, $target; } # Append any remaining ChangeLog files. push @reordered, sort keys %changelog; - # Remove leading `./'. + # Remove leading './'. @reordered = map { s!^\./!!; $_ } @reordered; print "\nChangeLog entries:\n\n"; @@ -270,37 +284,37 @@ sub print_changelog_deltas ($$) my $cmd = "cvs -n diff -u -r$prev_cvs_tag -rHEAD @reordered"; open DIFF, '-|', $cmd - or die "$ME: cannot run `$cmd': $!\n"; + or die "$ME: cannot run '$cmd': $!\n"; # Print two types of lines, making minor changes: - # Lines starting with `+++ ', e.g., + # Lines starting with '+++ ', e.g., # +++ ChangeLog 22 Feb 2003 16:52:51 -0000 1.247 - # and those starting with `+'. + # and those starting with '+'. # Don't print the others. my $prev_printed_line_empty = 1; while (defined (my $line = )) { if ($line =~ /^\+\+\+ /) - { - my $separator = "*"x70 ."\n"; - $line =~ s///; - $line =~ s/\s.*//; - $prev_printed_line_empty - or print "\n"; - print $separator, $line, $separator; - } + { + my $separator = "*"x70 ."\n"; + $line =~ s///; + $line =~ s/\s.*//; + $prev_printed_line_empty + or print "\n"; + print $separator, $line, $separator; + } elsif ($line =~ /^\+/) - { - $line =~ s///; - print $line; - $prev_printed_line_empty = ($line =~ /^$/); - } + { + $line =~ s///; + print $line; + $prev_printed_line_empty = ($line =~ /^$/); + } } close DIFF; # The exit code should be 1. # Allow in case there are no modified ChangeLog entries. $? == 256 || $? == 128 - or warn "$ME: warning: `cmd' had unexpected exit code or signal ($?)\n"; + or warn "warning: '$cmd' had unexpected exit code or signal ($?)\n"; } sub get_tool_versions ($$) @@ -314,25 +328,25 @@ sub get_tool_versions ($$) foreach my $t (@$tool_list) { if ($t eq 'gnulib') - { - push @tool_version_pair, ucfirst $t . ' ' . $gnulib_version; - next; - } + { + push @tool_version_pair, ucfirst $t . ' ' . $gnulib_version; + next; + } # Assume that the last "word" on the first line of - # `tool --version` output is the version string. + # 'tool --version' output is the version string. my ($first_line, undef) = split ("\n", `$t --version`); if ($first_line =~ /.* (\d[\w.-]+)$/) - { - $t = ucfirst $t; - push @tool_version_pair, "$t $1"; - } + { + $t = ucfirst $t; + push @tool_version_pair, "$t $1"; + } else - { - defined $first_line - and $first_line = ''; - warn "$ME: $t: unexpected --version output\n:$first_line"; - $fail = 1; - } + { + defined $first_line + and $first_line = ''; + warn "$t: unexpected --version output\n:$first_line"; + $fail = 1; + } } $fail @@ -346,6 +360,7 @@ sub get_tool_versions ($$) # issue "1,2" instead of "1.2", what confuses our regexps. $ENV{LC_ALL} = "C"; + my $mail_headers; my $release_type; my $package_name; my $prev_version; @@ -357,8 +372,18 @@ sub get_tool_versions ($$) my $gnulib_version; my $print_checksums_p = 1; + # Reformat the warnings before displaying them. + local $SIG{__WARN__} = sub + { + my ($msg) = @_; + # Warnings from GetOptions. + $msg =~ s/Option (\w)/option --$1/; + warn "$ME: $msg"; + }; + GetOptions ( + 'mail-headers=s' => \$mail_headers, 'release-type=s' => \$release_type, 'package-name=s' => \$package_name, 'previous-version=s' => \$prev_version, @@ -366,6 +391,7 @@ sub get_tool_versions ($$) 'gpg-key-id=s' => \$gpg_key_id, 'url-directory=s' => \@url_dir_list, 'news=s' => \@news_file, + 'srcdir=s' => \$srcdir, 'bootstrap-tools=s' => \$bootstrap_tools, 'gnulib-version=s' => \$gnulib_version, 'print-checksums!' => \$print_checksums_p, @@ -376,32 +402,32 @@ sub get_tool_versions ($$) ) or usage 1; my $fail = 0; - # Ensure that sure each required option is specified. + # Ensure that each required option is specified. $release_type - or (warn "$ME: release type not specified\n"), $fail = 1; + or (warn "release type not specified\n"), $fail = 1; $package_name - or (warn "$ME: package name not specified\n"), $fail = 1; + or (warn "package name not specified\n"), $fail = 1; $prev_version - or (warn "$ME: previous version string not specified\n"), $fail = 1; + or (warn "previous version string not specified\n"), $fail = 1; $curr_version - or (warn "$ME: current version string not specified\n"), $fail = 1; + or (warn "current version string not specified\n"), $fail = 1; $gpg_key_id - or (warn "$ME: GnuPG key ID not specified\n"), $fail = 1; + or (warn "GnuPG key ID not specified\n"), $fail = 1; @url_dir_list - or (warn "$ME: URL directory name(s) not specified\n"), $fail = 1; + or (warn "URL directory name(s) not specified\n"), $fail = 1; my @tool_list = split ',', $bootstrap_tools; grep (/^gnulib$/, @tool_list) ^ defined $gnulib_version - and (warn "$ME: when specifying gnulib as a tool, you must also specify\n" - . "--gnulib-version=V, where V is the result of running git describe\n" - . "in the gnulib source directory.\n"), $fail = 1; + and (warn "when specifying gnulib as a tool, you must also specify\n" + . "--gnulib-version=V, where V is the result of running git describe\n" + . "in the gnulib source directory.\n"), $fail = 1; exists $valid_release_types{$release_type} - or (warn "$ME: `$release_type': invalid release type\n"), $fail = 1; + or (warn "'$release_type': invalid release type\n"), $fail = 1; @ARGV - and (warn "$ME: too many arguments:\n", join ("\n", @ARGV), "\n"), + and (warn "too many arguments:\n", join ("\n", @ARGV), "\n"), $fail = 1; $fail and usage 1; @@ -422,11 +448,18 @@ sub get_tool_versions ($$) %size or exit 1; + my $headers = ''; + if (defined $mail_headers) + { + ($headers = $mail_headers) =~ s/\s+(\S+:)/\n$1/g; + $headers .= "\n"; + } + # The markup is escaped as <\# so that when this script is sent by # mail (or part of a diff), Gnus is not triggered. print < @@ -434,28 +467,50 @@ FIXME: put comments here EOF - print_locations ("compressed sources", @url_dir_list, %size, @tarballs); - -f $xd - and print_locations ("xdelta diffs (useful? if so, " - . "please tell bug-gnulib\@gnu.org)", - @url_dir_list, %size, $xd); - my @sig_files = map { "$_.sig" } @tarballs; - print_locations ("GPG detached signatures[*]", @url_dir_list, %size, - @sig_files); + if (@url_dir_list == 1 && @tarballs == 1) + { + # When there's only one tarball and one URL, use a more concise form. + my $m = "$url_dir_list[0]/$tarballs[0]"; + print "Here are the compressed sources and a GPG detached signature[*]:\n" + . " $m\n" + . " $m.sig\n\n"; + } + else + { + print_locations ("compressed sources", @url_dir_list, %size, @tarballs); + -f $xd + and print_locations ("xdelta diffs (useful? if so, " + . "please tell bug-gnulib\@gnu.org)", + @url_dir_list, %size, $xd); + my @sig_files = map { "$_.sig" } @tarballs; + print_locations ("GPG detached signatures[*]", @url_dir_list, %size, + @sig_files); + } + if ($url_dir_list[0] =~ "gnu\.org") { - print "To reduce load on the main server, use a mirror listed at:\n"; - print " http://www.gnu.org/order/ftp.html\n\n"; + print "Use a mirror for higher download bandwidth:\n"; + if (@tarballs == 1 && $url_dir_list[0] =~ m!http://ftp\.gnu\.org/gnu/!) + { + (my $m = "$url_dir_list[0]/$tarballs[0]") + =~ s!http://ftp\.gnu\.org/gnu/!http://ftpmirror\.gnu\.org/!; + print " $m\n" + . " $m.sig\n\n"; + + } + else + { + print " http://www.gnu.org/order/ftp.html\n\n"; + } } $print_checksums_p and print_checksums (@sizable); print <