From 1ac9a613b3644ad05a5348bbda36391c6f0de092 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 13 Dec 2002 20:20:39 +0000 Subject: *** empty log message *** --- announce-gen | 180 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100755 announce-gen (limited to 'announce-gen') diff --git a/announce-gen b/announce-gen new file mode 100755 index 000000000..8bb28ed24 --- /dev/null +++ b/announce-gen @@ -0,0 +1,180 @@ +#!/usr/bin/perl -w +# Generate an announcement message. +use strict; + +use Getopt::Long; +use Ascend::Init; +use Digest::MD5; +use Digest::SHA1; + +(my $VERSION = '$Revision: 1.1 $ ') =~ tr/[0-9].//cd; +(my $ME = $0) =~ s|.*/||; + +END +{ + # Nobody ever checks the status of print()s. That's okay, because + # if any do fail, we're guaranteed to get an indicator when we close() + # the filehandle. + # + # Close stdout now, and if there were no errors, return happy status. + # If stdout has already been closed by the script, though, do nothing. + defined fileno STDOUT + or return; + close STDOUT + and return; + + # Errors closing stdout. Indicate that, and hope stderr is OK. + warn "$ME: closing standard output: $!\n"; + + # Don't be so arrogant as to assume that we're the first END handler + # defined, and thus the last one invoked. There may be others yet + # to come. $? will be passed on to them, and to the final _exit(). + # + # If it isn't already an error, make it one (and if it _is_ an error, + # preserve the value: it might be important). + $? ||= 1; +} + +sub usage ($) +{ + my ($exit_code) = @_; + my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR); + if ($exit_code != 0) + { + print $STREAM "Try `$ME --help' for more information.\n"; + } + else + { + print $STREAM < \$package_name, + 'previous-version=s' => \$prev_version, + 'current-version=s' => \$curr_version, + 'release-archive-directory=s' => \$release_archive_dir, + 'url-directory=s@' => \@url_dir_list, + + help => sub { usage 0 }, + version => sub { print "$ME version $VERSION\n"; exit }, + ) or usage 1; + + my $fail = 0; + # Ensure that sure each required option is specified. + $package_name + or (warn "$ME: missing package name\n"), $fail = 1; + $prev_version + or (warn "$ME: missing previous version string\n"), $fail = 1; + $curr_version + or (warn "$ME: missing current version string\n"), $fail = 1; + $release_archive_dir + or (warn "$ME: missing release directory name\n"), $fail = 1; + @url_dir_list + or (warn "$ME: missing URL directory name(s)\n"), $fail = 1; + + @ARGV + and (warn "$ME: too many arguments\n"), $fail = 1; + $fail + and usage 1; + + my $my_distdir = "$package_name-$curr_version"; + my $tgz = "$my_distdir.tar.gz"; + my $tbz = "$my_distdir.tar.bz2"; + my $xd = "$package_name-$prev_version-$curr_version.xdelta"; + + # FIXME: make this optional? + my $mail_gpg_sign_cookie = '<#secure method=pgpmime mode=sign>'; + my %size; + + foreach my $f (($tgz, $tbz, $xd)) + { + my $t = `du --human $f`; + chomp $t; + # FIXME: don't ignore failure... + $t =~ s/^([\d.]+[MkK]).*/${1}B/; + $size{$f} = $t; + } + + print <new->addfile(*FH)->hexdigest + : Digest::SHA1->new->addfile(*FH)->hexdigest); + close FH; + print "$dig $f\n"; + } + } + + # FIXME: depend on whether it's a test release + # sed -n "$news-r1),$news-r2)p" NEWS + # | grep -v '^\['; + # echo; + # echo ChangeLog entries:; + # find . -name ChangeLog -maxdepth 2 + # | xargs $(CVS) diff -up -r$(prev-cvs-tag) -rHEAD + # | sed -n 's/^+//p' + # | perl -ne 'm!^\+\+ (\./)?! or print,next;' + # -e 'print "\n"."*"x70 ."\n"; s///; print; print "*"x70 ."\n"'; +} -- cgit v1.2.3-54-g00ecf