summaryrefslogtreecommitdiff
path: root/build-aux/announce-gen
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2021-08-03 17:15:16 +0200
committerSimon Josefsson <simon@josefsson.org>2021-08-03 17:16:04 +0200
commit4adae938b8dbe01750698109bcbf5f1c9eb045b1 (patch)
treeb8a0909f2773d213a66812be3f2ead7a8af41886 /build-aux/announce-gen
parent8acb4bcef3a829662f196a1d3b4122902ca329d7 (diff)
downloadgnulib-4adae938b8dbe01750698109bcbf5f1c9eb045b1.tar.gz
announce-gen: Print SHA1/B64(SHA256) instead of MD5/SHA1.
* build-aux/announce-gen (%digest_classes): Removed. (usage): Doc fix. (print_checksums): Instead of MD5/SHA1, print SHA1 and B64(SHA256), inspired by OpenSSH announcements.
Diffstat (limited to 'build-aux/announce-gen')
-rwxr-xr-xbuild-aux/announce-gen33
1 files changed, 11 insertions, 22 deletions
diff --git a/build-aux/announce-gen b/build-aux/announce-gen
index daa478c8ef..b07cbd7422 100755
--- a/build-aux/announce-gen
+++ b/build-aux/announce-gen
@@ -35,7 +35,7 @@
eval 'exec perl -wSx "$0" "$@"'
if 0;
-my $VERSION = '2021-04-11 8:42'; # UTC
+my $VERSION = '2021-08-03 15: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
@@ -51,12 +51,6 @@ use POSIX qw(strftime);
my %valid_release_types = map {$_ => 1} qw (alpha beta stable);
my @archive_suffixes = qw (tar.gz tar.bz2 tar.lz tar.lzma tar.xz);
-my %digest_classes =
- (
- 'md5' => (eval { require Digest::MD5; } and 'Digest::MD5'),
- 'sha1' => ((eval { require Digest::SHA; } and 'Digest::SHA')
- or (eval { require Digest::SHA1; } and 'Digest::SHA1'))
- );
my $srcdir = '.';
sub usage ($)
@@ -96,7 +90,7 @@ The following are optional:
VERSION is the result of running git describe
in the gnulib source directory.
required if gnulib is in TOOL_LIST.
- --no-print-checksums do not emit MD5 or SHA1 checksums
+ --no-print-checksums do not emit SHA1 or SHA256 checksums
--archive-suffix=SUF add SUF to the list of archive suffixes
--mail-headers=HEADERS a space-separated list of mail headers, e.g.,
To: x\@example.com Cc: y-announce\@example.com,...
@@ -163,7 +157,7 @@ sub print_locations ($\@\%@)
=item C<print_checksums (@file)
-Print the MD5 and SHA1 signature section for each C<@file>.
+Print the SHA1 and SHA256 signature section for each C<@file>.
=cut
@@ -171,23 +165,18 @@ sub print_checksums (@)
{
my (@file) = @_;
- print "Here are the MD5 and SHA1 checksums:\n";
+ print "Here are the SHA1 and SHA256 checksums:\n";
print "\n";
- foreach my $meth (qw (md5 sha1))
+ use Digest::file qw(digest_file_hex digest_file_base64);
+
+ foreach my $f (@file)
{
- my $class = $digest_classes{$meth} or next;
- foreach my $f (@file)
- {
- open IN, '<', $f
- or die "$ME: $f: cannot open for reading: $!\n";
- binmode IN;
- my $dig = $class->new->addfile(*IN)->hexdigest;
- close IN;
- print "$dig $f\n";
- }
+ print digest_file_hex($f, "SHA-1"), " $f\n";
+ print digest_file_base64($f, "SHA-256"), " $f\n";
}
- print "\n";
+ print "\nPlease note that the SHA256 checksum is base64 encoded and not\n";
+ print "hexadecimal (which is the default for most checksum tools).\n\n";
}
=item C<print_news_deltas ($news_file, $prev_version, $curr_version)