2 # Generate an announcement message.
9 (my $VERSION = '$Revision: 1.3 $ ') =~ tr/[0-9].//cd;
10 (my $ME = $0) =~ s
|.*/||;
14 # Nobody ever checks the status of print()s. That's okay, because
15 # if any do fail, we're guaranteed to get an indicator when we close()
18 # Close stdout now, and if there were no errors, return happy status.
19 # If stdout has already been closed by the script, though, do nothing.
25 # Errors closing stdout. Indicate that, and hope stderr is OK.
26 warn "$ME: closing standard output: $!\n";
28 # Don't be so arrogant as to assume that we're the first END handler
29 # defined, and thus the last one invoked. There may be others yet
30 # to come. $? will be passed on to them, and to the final _exit().
32 # If it isn't already an error, make it one (and if it _is_ an error,
33 # preserve the value: it might be important).
40 my $STREAM = ($exit_code == 0 ?
*STDOUT
: *STDERR
);
43 print $STREAM "Try `$ME --help' for more information.\n";
52 Generate an announcement message.
54 FIXME: describe the following
56 --package-name=PACKAGE_NAME
57 --previous-version=VER
59 --release-archive-directory=DIR
60 --url-directory=URL_DIR
62 --help display this help and exit
63 --version output version information and exit
74 my $release_archive_dir;
79 'package-name=s' => \
$package_name,
80 'previous-version=s' => \
$prev_version,
81 'current-version=s' => \
$curr_version,
82 'release-archive-directory=s' => \
$release_archive_dir,
83 'url-directory=s@' => \
@url_dir_list,
85 help
=> sub { usage
0 },
86 version
=> sub { print "$ME version $VERSION\n"; exit },
90 # Ensure that sure each required option is specified.
92 or (warn "$ME: missing package name\n"), $fail = 1;
94 or (warn "$ME: missing previous version string\n"), $fail = 1;
96 or (warn "$ME: missing current version string\n"), $fail = 1;
98 or (warn "$ME: missing release directory name\n"), $fail = 1;
100 or (warn "$ME: missing URL directory name(s)\n"), $fail = 1;
103 and (warn "$ME: too many arguments\n"), $fail = 1;
107 my $my_distdir = "$package_name-$curr_version";
108 my $tgz = "$my_distdir.tar.gz";
109 my $tbz = "$my_distdir.tar.bz2";
110 my $xd = "$package_name-$prev_version-$curr_version.xdelta";
114 foreach my $f (($tgz, $tbz, $xd))
116 my $cmd = "du --human $f";
118 # FIXME-someday: give a better diagnostic, a la $PROCESS_STATUS
120 and (warn "$ME: command failed: `$cmd'\n"), $fail = 1;
122 $t =~ s/^([\d.]+[MkK]).*/${1}B/;
131 Subject: $my_distdir released
133 <#secure method=pgpmime mode=sign>
135 FIXME: put comments here
139 foreach my $url (@url_dir_list)
141 print " $url/$tgz ($size{$tgz})\n";
142 print " $url/$tbz ($size{$tbz})\n";
145 print "\nAnd here are xdelta-style diffs:\n";
146 foreach my $url (@url_dir_list)
148 print " $url/$xd ($size{$xd})\n";
151 print "\nHere are GPG detached signatures:\n";
152 foreach my $url (@url_dir_list)
154 print " $url/$tgz.sig\n";
155 print " $url/$tbz.sig\n";
158 # FIXME: clean up upon interrupt or die
159 my $tmpdir = $ENV{TMPDIR
} || '/tmp';
160 my $tmp = "$tmpdir/$ME-$$";
161 unlink $tmp; # ignore failure
163 print "\nHere are the MD5 and SHA1 signatures:\n";
164 print "<#part type=text/plain filename=\"$tmp\" disposition=inline>\n"
168 or die "$ME: $tmp: cannot open for writing: $!\n";
170 foreach my $meth (qw
(md5 sha1
))
172 foreach my $f (($tgz, $tbz, $xd))
175 or die "$ME: $f: cannot open for reading: $!\n";
179 ? Digest
::MD5
->new->addfile(*IN
)->hexdigest
180 : Digest
::SHA1
->new->addfile(*IN
)->hexdigest);
182 print OUT
"$dig $f\n";
187 or die "$ME: $tmp: while writing: $!\n";
188 chmod 0400, $tmp; # ignore failure
190 # FIXME: depend on whether it's a test release
191 # sed -n "$news-r1),$news-r2)p" NEWS
194 # echo ChangeLog entries:;
195 # find . -name ChangeLog -maxdepth 2
196 # | xargs $(CVS) diff -up -r$(prev-cvs-tag) -rHEAD
198 # | perl -ne 'm!^\+\+ (\./)?! or print,next;'
199 # -e 'print "\n"."*"x70 ."\n"; s///; print; print "*"x70 ."\n"';