From f4108bb802770feed541f4b168aebbea45146ede Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 25 Feb 2023 13:20:43 -0800 Subject: announce-gen: add more info the auto-generated announce template * build-aux/announce-gen (readable_interval, readable_interval0): New functions. (digest_file_base64_wrap): New function to add padding to the base64-encoded SHA256 checksums. (print_checksums): Use that wrapper. Indent each line by two spaces. (main): Emit new sections, e.g., these lines from grep-3.8's release: - There have been 104 commits by 6 people in the 55 weeks since 3.7. - The following people contributed changes to this release: (and list) I tested with this, running from a sibling cloned grep directory: ../gnulib/build-aux/announce-gen --release-type=stable \ --package-name=grep --previous-version=3.7 --current-version=3.8 \ --gpg-key-id=0x7FD9FCCB000BEEEE --url-directory=https://testing Also, reference the cksum programs from coreutils-9.2 and from OpenBSD. --- build-aux/announce-gen | 92 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 86 insertions(+), 6 deletions(-) (limited to 'build-aux/announce-gen') diff --git a/build-aux/announce-gen b/build-aux/announce-gen index 6bf48e1b02..e51a8a78c1 100755 --- a/build-aux/announce-gen +++ b/build-aux/announce-gen @@ -35,7 +35,7 @@ eval 'exec perl -wSx "$0" "$@"' if 0; -my $VERSION = '2022-07-10 01:47'; # UTC +my $VERSION = '2023-02-25 21:13'; # 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 @@ -165,6 +165,17 @@ Print the SHA1 and SHA256 signature section for each C<@file>. =cut +# This digest function omits the "=" padding that is required by cksum, +# so add the 0..2 bytes of padding required for each of Digest's algorithms. +sub digest_file_base64_wrap ($$) +{ + my ($file, $alg) = @_; + my $h = digest_file_base64($file, $alg); + $alg =~ tr{-}{}d; + my %pad = (MD5 => 2, SHA1 => 1, SHA256 => 1, SHA384 => 0, SHA512 => 2); + return $h . '=' x $pad{$alg}; +} + sub print_checksums (@) { my (@file) = @_; @@ -176,11 +187,11 @@ sub print_checksums (@) foreach my $f (@file) { - print digest_file_hex($f, "SHA-1"), " $f\n"; - print digest_file_base64($f, "SHA-256"), " $f\n"; + print ' ', digest_file_hex ($f, "SHA-1"), " $f\n"; + print ' ', digest_file_base64_wrap ($f, "SHA-256"), " $f\n"; } - print "\nThe SHA256 checksum is base64 encoded, instead of the\n"; - print "hexadecimal encoding that most checksum tools default to.\n\n"; + print "\nVerify the base64 SHA256 checksum with cksum -a sha256 --check\n"; + print "from coreutils-9.2 or openBSD's cksum since 2007.\n\n"; } =item C +This is to announce $package_name-$curr_version, a $release_type release. FIXME: put comments here +EOF + + my $v0 = $prev_version; + my $v1 = $curr_version; + + (my $first_name = `git config --global user.name|cut -d' ' -f1`) + =~ m{\S} or die "no name? set user.name in ~/.gitconfig\n"; + + chomp (my $n_ci = `git rev-list "v$v0..v$v1" | wc -l`); + chomp (my $n_p = `git shortlog "v$v0..v$v1" | grep -c '^[^ ]'`); + + my $prev_release_date = `git log --pretty=%ct -1 "v$v0"`; + my $this_release_date = `git log --pretty=%ct -1 "v$v1"`; + my $n_seconds = $this_release_date - $prev_release_date; + my $time_since_prev = readable_interval $n_seconds; + my $names = `git shortlog "v$v0..v$v1"|perl -lne '/^(\\w.*):/ and print " ".\$1'`; + + print <