mirror of
git://git.savannah.gnu.org/libtool.git
synced 2025-01-30 14:30:15 +08:00
47e4d7da64
* bootstrap: When extracting PACKAGE and VERSION from AC_INIT arguments, be sure to remove a 'GNU ' prefix and lowercase the package name for PACKAGE. Also set PACKAGE_NAME and PACKAGE_URL appropriately for GNU software. Pass these variables to the make commands creating tests/package.m4 and other files. * Makefile.am (edit): Fix substitution of PACKAGE_NAME and PACKAGE_STRING. * libltdl/config/announce-gen.m4sh: Use @PACKAGE@ not @PACKAGE_STRING@. Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
467 lines
14 KiB
Plaintext
467 lines
14 KiB
Plaintext
AS_INIT[]m4_divert_push([HEADER-COPYRIGHT])dnl
|
|
# @configure_input@
|
|
|
|
# announce-gen (GNU @PACKAGE@) version 1.0
|
|
# Written by Gary V. Vaughan
|
|
# based on a perl script by Jim Meyering
|
|
|
|
# Copyright (C) 2010 Free Software Foundation, Inc.
|
|
# This is free software; see the source for copying conditions. There is NO
|
|
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
# gen-announce is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# gen-announce is distributed in the hope that it will be useful, but
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with clcommit; see the file COPYING. If not, a copy
|
|
# can be downloaded from http://www.gnu.org/licenses/gpl.html,
|
|
# or obtained by writing to the Free Software Foundation, Inc.,
|
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
# Usage: $progname {-o|-p} [OPTIONS]... [--] RELEASE-TYPE [TO-ADDRESS]...
|
|
|
|
# -b file --blurb=FILE read announcement blurb from FILE
|
|
# --bootstrap-tools=LIST a comma-separated list of tools, e.g.
|
|
# autoconf,automake,bison,gnulib
|
|
# --current-version=VER override current release version number
|
|
# --debug enable verbose shell tracing
|
|
# --gpg-key-id=ID gnupg ID of signature key for release files
|
|
# -h STRING --header=STRING insert mail header into announcement
|
|
# -m STRING --message=STRING insert into message blurb for announcement
|
|
# -c --no-print-checksums do not emit MD5 and SHA1 checksums
|
|
# -o --output output to stdout
|
|
# --package-name=NAME override default package name
|
|
# -p --post post the announcement directly
|
|
# --previous-version=VER previous release version number
|
|
# -r [FILE] --rcfile[=FILE] read options from FILE [./.announcerc]
|
|
# --signature[=FILE] append FILE to post [~/.signature]
|
|
# --url-directory=URL download url directory for released files
|
|
# [ftp://ftp.gnu.org/gnu/<package-name>]
|
|
# -v --verbose run in verbose mode
|
|
# --version print version information
|
|
# -? --help print short or long help message
|
|
|
|
# In output mode, selected by `-o', a release note is printed on stdout.
|
|
|
|
# In post mode, the release note is displayed in $PAGER, (giving you the
|
|
# chance to make changes, and add headers) before posting to any every
|
|
# TO-ADDRESS given on the command line, as well as any addresses added
|
|
# to `To:', `Cc:' and `Bcc:' headers during editing.
|
|
|
|
# The `--rcfile' option points to a file with other option settings, one
|
|
# on each line. For example:
|
|
#
|
|
# --bootstrap-tools='autoconf, automake'
|
|
# --gpg-key-id=2983D606
|
|
# --header 'From: "Gary V. Vaughan" <gary@gnu.org>'
|
|
# --header 'To: Libtool List <libtool@gnu.org>'
|
|
# --header 'Cc: Autotools Announce List <autotools-announce@gnu.org>'
|
|
# --header 'Reply-To: Libtool Bugs <bug-libtool@gnu.org>'
|
|
# --message 'GNU Libtool hides the complexity of using shared'
|
|
# --message 'libraries behind a consistent, portable interface.'
|
|
# --message 'GNU Libtool ships with GNU libltdl, which hides the'
|
|
# --message 'complexity of loading dynamic runtime libraries'
|
|
# --message '(modules) behind a consistent, portable interface.'
|
|
# --signature
|
|
#
|
|
# This is the .announcerc for GNU Libtool. Announce-gen is pretty
|
|
# smart about picking defaults for package-name and current-version
|
|
# and often guesses previous-version correctly too. So, typically a
|
|
# release note can be posted with:
|
|
#
|
|
# ./$progname -r -p -h 'Cc: info-gnu@gnu.org' --prev=<LASTRELEASE> stable
|
|
#
|
|
# When that's producing a good announcement, it can be posted by using
|
|
# the same arguments again, but for `-p' instead of `-o'
|
|
|
|
# Report bugs to <gary@gnu.org>
|
|
|
|
: ${DU="du"}
|
|
: ${MAILNOTIFY="mailnotify"}
|
|
: ${MD5SUM="md5"}
|
|
: ${SHA1SUM="shasum"}
|
|
|
|
PROGRAM=announce-gen
|
|
|
|
m4_divert_pop
|
|
m4_include([getopt.m4sh])
|
|
|
|
M4SH_VERBATIM([[
|
|
top_srcdir=`cd "@top_srcdir@" && pwd`
|
|
test -d "$top_srcdir" || top_srcdir='@top_srcdir@'
|
|
|
|
# Initialisation:
|
|
mailnotify_flags=
|
|
package_name="@PACKAGE@"
|
|
sendmail_to=
|
|
valid_release_types='alpha,beta,release-candidate,stable'
|
|
|
|
# try to find out whether read supports -r
|
|
if echo bt | tr b '\\' | { read -r line; test "X$line" = 'X\t'; } 2>/dev/null
|
|
then
|
|
read_r='read -r'
|
|
else
|
|
read_r=read
|
|
fi
|
|
]])
|
|
|
|
dnl SHORT LONG DEFAULT INIT
|
|
dnl ----------------------------------------------------------------------
|
|
M4SH_GETOPTS(
|
|
[b@], [--blurb], [], [],
|
|
[h;], [--header], [], [],
|
|
[m;], [--message|--msg], [], [],
|
|
[o], [--output], [], [],
|
|
[p], [--post], [], [],
|
|
[r@?],[--rcfile], [$top_srcdir/.announcerc], [
|
|
# The funny quoting allows keeping one option per line in $opt_rcfile:
|
|
eval set dummy `echo \`cat $opt_rcfile\` '${1+"[$]@"}'`
|
|
shift],
|
|
[v], [--verbose], [], [
|
|
mailnotify_flags="${mailnotify_flags+$mailnotify_flags }$opt"],
|
|
[!], [--bootstrap-tools|--bootstrap|--boots], [], [
|
|
for tool in `echo "$optarg"|$SED 's|,| |g'`; do
|
|
($tool --version) >/dev/null 2>&1 || {
|
|
func_error "$opt \`$optarg' does not respond to --version option."
|
|
cmd_exit=exit
|
|
}
|
|
done],
|
|
[!], [--current-version|--current|--curr], [@VERSION@], [],
|
|
[!], [--gpg-key-id|--gpg], [], [],
|
|
[], [--no-print-checksums], [], [],
|
|
[!], [--previous-version|--previous|--prev], [@LASTRELEASE@], [],
|
|
[!], [--release-type], [], [],
|
|
[@?], [--signature], [$HOME/.signature], [],
|
|
[!], [--url-directory], [], [],
|
|
[
|
|
# validate $opt_gpg_key_id
|
|
test -n "$opt_gpg_key_id" || {
|
|
func_error "you must specify a key with --gpg-key-id."
|
|
exit_cmd=exit
|
|
}
|
|
|
|
# validate $opt_bootstrap_tools
|
|
test -n "$opt_bootstrap_tools" || {
|
|
func_error "you must specify some tools with --bootstrap-tools."
|
|
exit_cmd=exit
|
|
}
|
|
|
|
# validate $opt_blurb and $opt_message
|
|
test -n "$opt_blurb" && test -n "$opt_message" && {
|
|
func_error "you can specify only one of --blurb and --message."
|
|
exit_cmd=exit
|
|
}
|
|
|
|
# validate $opt_output and $opt_post
|
|
$opt_output && $opt_post && {
|
|
func_error "you can specify only one of --output and --post."
|
|
exit_cmd=exit
|
|
}
|
|
$opt_output || $opt_post || {
|
|
func_error "you must specify either --output or --post."
|
|
exit_cmd=exit
|
|
}
|
|
|
|
# validate $opt_release_type
|
|
test -n "$opt_release_type" || {
|
|
test [$]# -gt 0 || { func_error "no release type specified."; exit_cmd=exit; }
|
|
opt_release_type="[$]1"; shift
|
|
}
|
|
case ,$valid_release_types, in *,$opt_release_type,*) ;;
|
|
*) func_error "\`$opt_release_type': invalid release type."; exit_cmd=exit ;;
|
|
esac
|
|
|
|
# validate $url_directory
|
|
test -n "$url_directory" || {
|
|
case $opt_release_type in
|
|
stable) url_directory="ftp://ftp.gnu.org/gnu/$package_name" ;;
|
|
*) url_directory="ftp://alpha.gnu.org/gnu/$package_name" ;;
|
|
esac
|
|
}
|
|
|
|
# pass trace argument along to mailnotify too
|
|
test "$opt_debug" != ":" &&
|
|
mailnotify_flags="${mailnotify_flags+$mailnotify_flags }--debug"
|
|
|
|
# validate remaining command line args as destination addresses
|
|
for address
|
|
do
|
|
func_quote_for_eval "$address"
|
|
sendmail_to="${sendmail_to+$sendmail_to }$func_quote_for_eval_result"
|
|
done
|
|
])
|
|
|
|
M4SH_VERBATIM([[
|
|
# Bail out on command errors!
|
|
set -e
|
|
|
|
# func_print_changelog_deltas
|
|
func_print_changelog_deltas ()
|
|
{
|
|
$opt_debug
|
|
|
|
# FIXME: Jim's announce-gen does something with ChangeLogs
|
|
# and cvs diff. We don't use CVS, and perl makes
|
|
# my eyes bleed... maybe I'll write this function
|
|
# one day.
|
|
:
|
|
}
|
|
|
|
|
|
# func_print_checksums title filename...
|
|
func_print_checksums ()
|
|
{
|
|
$opt_debug
|
|
|
|
my_title="$1"; shift
|
|
|
|
test -n "$1" && {
|
|
echo
|
|
echo "Here are the $my_title:"
|
|
echo
|
|
for my_sum in $MD5SUM $SHA1SUM; do
|
|
for my_filename in ${1+"$@"}; do
|
|
my_line=`$my_sum $my_filename`
|
|
my_hash=`expr "$my_line" : '.*\([0-9a-f]\{40\}\)' || :`
|
|
test -n "$my_hash" || my_hash=`expr "$my_line" : '.*\([0-9a-f]\{32\}\)'`" "
|
|
echo " $my_hash $my_filename"
|
|
done
|
|
done
|
|
}
|
|
|
|
# To stop bash exiting if test fails
|
|
:
|
|
}
|
|
|
|
|
|
# func_print_locations title url files
|
|
func_print_locations ()
|
|
{
|
|
$opt_debug
|
|
|
|
test -n "$3" && {
|
|
echo
|
|
echo "Here are the $1:"
|
|
echo
|
|
for my_file in $3; do
|
|
my_size=`$DU -h $my_file|sed 's,[bB]*[ ].*$,,'`
|
|
echo " $2/$my_file (${my_size}B)"
|
|
done
|
|
}
|
|
|
|
# To stop bash exiting if test fails
|
|
:
|
|
}
|
|
|
|
|
|
# func_print_news_deltas
|
|
func_print_news_deltas ()
|
|
{
|
|
$opt_debug
|
|
|
|
my_news_file="$top_srcdir/NEWS"
|
|
my_skipping=:
|
|
|
|
# reset the field separator to prevent whitespace removal by 'read'
|
|
save_IFS="$IFS"
|
|
IFS=
|
|
|
|
echo
|
|
cat $my_news_file |
|
|
while read line; do
|
|
case $line in
|
|
"New in $opt_current_version "*:)
|
|
my_skipping=false
|
|
echo "$line"
|
|
;;
|
|
"New in "*:)
|
|
my_skipping=:
|
|
;;
|
|
*)
|
|
$my_skipping || echo "$line"
|
|
;;
|
|
esac
|
|
done
|
|
|
|
IFS="$save_IFS"
|
|
}
|
|
|
|
|
|
# func_tool_versions toolname...
|
|
func_print_tool_versions ()
|
|
{
|
|
$opt_debug
|
|
|
|
test -n "$1" && {
|
|
echo
|
|
echo "This release was bootstrapped with the following tools:"
|
|
echo
|
|
for my_tool in ${1+"$@"}; do
|
|
my_tool_version=`$my_tool --version|sed 's,^.* ,,g;1q'`
|
|
echo " $my_tool-$my_tool_version"
|
|
done
|
|
}
|
|
|
|
# To stop bash exiting if test fails
|
|
:
|
|
}
|
|
|
|
|
|
|
|
## ----- ##
|
|
## main. ##
|
|
## ----- ##
|
|
|
|
{
|
|
# Neutralize the locale, so that, for instance, "du" does not
|
|
# issue "1,2" instead of "1.2", which confuses our regexps.
|
|
LC_ALL=C
|
|
export LC_ALL
|
|
|
|
# Secure directory for temporary files
|
|
tmp_dir="`func_mktempdir`"
|
|
trap '$RM -r "$tmp_dir"; exit $EXIT_FAILURE' 1 2 15
|
|
|
|
# Save any header or post blurb for mailnotify
|
|
header_file="$tmp_dir/headers"
|
|
blurb_file="$tmp_dir/blurb"
|
|
|
|
test -n "$opt_header" && echo "$opt_header" > "$header_file"
|
|
test -n "$opt_message" && echo "$opt_message" > "$blurb_file"
|
|
test -n "$opt_blurb" && cat "$opt_blurb" > "$blurb_file"
|
|
|
|
archive_suffixes='tar.gz tar.bz2 tar.lzma tar.xz'
|
|
diff_suffixes='diff.gz diff.bz2 diff.lzma diff.xz xdelta'
|
|
|
|
# Ensure there is something to announce!
|
|
for suffix in $archive_suffixes; do
|
|
candidate="$package_name-$opt_current_version.$suffix"
|
|
candidates="${candidates+$candidates, }$candidate"
|
|
test -r "$candidate" || continue
|
|
tarballs="${tarballs+$tarballs }$candidate"
|
|
done
|
|
for suffix in $diff_suffixes; do
|
|
candidate="$package_name-$opt_previous_version-$opt_current_version.$suffix"
|
|
candidates="${candidates+$candidates, }$candidate"
|
|
test -r "$candidate" || continue
|
|
compressed_diffs="${compressed_diffs+$compressed_diffs }$candidate"
|
|
done
|
|
test -n "$tarballs$compressed_diffs" ||
|
|
func_fatal_error "none of $candidates were found."
|
|
|
|
# Signature files
|
|
signed_files="$tarballs $compressed_diffs"
|
|
for signed in $signed_files; do
|
|
sig_files="${sig_files+$sig_files }$signed.sig"
|
|
done
|
|
|
|
# Displaying or posting the announcement?
|
|
if $opt_post; then
|
|
notify_file="$tmp_dir/post"
|
|
exec 3>$notify_file
|
|
else
|
|
exec 3>&1
|
|
fi
|
|
|
|
{
|
|
echo "Subject: $package_name $opt_current_version released ($opt_release_type)"
|
|
test -f "$header_file" && cat "$header_file"
|
|
echo
|
|
test -f "$blurb_file" && cat "$blurb_file"
|
|
func_print_locations "compressed sources" "$url_directory" "$tarballs"
|
|
func_print_locations "diffs against $package_name $opt_previous_version" "$url_directory" "$compressed_diffs"
|
|
func_print_locations "GPG detached signatures[1]" "$url_directory" "$sig_files"
|
|
|
|
$opt_print_checksums &&
|
|
func_print_checksums "MD5 and SHA1 checksums[2]" $tarballs $compressed_diffs
|
|
|
|
case $url_directory in
|
|
*"gnu.org"*)
|
|
echo
|
|
echo 'To reduce load on the main server, please one of the mirrors listed at:'
|
|
echo
|
|
echo ' http://www.gnu.org/order/ftp.html'
|
|
;;
|
|
esac
|
|
|
|
cat <<EOF
|
|
|
|
[1] You can use the above signature files to verify that the
|
|
corresponding file (without the .sig suffix) is the same
|
|
file that was released by the owner of it's GPG key ID.
|
|
First be sure to download both the .sig file and the
|
|
corresponding file. Then run a cammand like this:
|
|
|
|
gpg --verify `echo "$tarballs" | sed -e 's, .*$,,g'`.sig
|
|
|
|
If that command fails because you don't have the required
|
|
public key, then run this command to import it:
|
|
|
|
gpg --keyserver keys.gnupg.net --recv-keys $opt_gpg_key_id
|
|
|
|
and rerun the \`gpg --verify' command.
|
|
EOF
|
|
|
|
$opt_print_checksums && cat <<EOF
|
|
|
|
[2] You can use either of the above checksum files to verify
|
|
that the corresponding file is complete and correct. To
|
|
confirm that the file you downloaded has a checksum that
|
|
matches the release note, compare it against the output
|
|
one of the following commands:
|
|
|
|
md5sum `echo "$tarballs" | sed -e 's, .*$,,g'`
|
|
shasum `echo "$tarballs" | sed -e 's, .*$,,g'`
|
|
|
|
(the name of the command sometimes varies between
|
|
different operating systems).
|
|
EOF
|
|
|
|
func_print_tool_versions $tool_list
|
|
func_print_news_deltas
|
|
func_print_changelog_deltas
|
|
|
|
echo 'Enjoy!'
|
|
} >&3
|
|
|
|
$opt_post && {
|
|
test -f "$top_srcdir/libltdl/config/$MAILNOTIFY" &&
|
|
MAILNOTIFY="$top_srcdir/libltdl/config/$MAILNOTIFY"
|
|
test -f "$MAILNOTIFY" ||
|
|
func_fatal_error "$MAILNOTIFY: file not found."
|
|
|
|
${PAGER-more} "$notify_file" || break
|
|
|
|
sleep 1 # give the user some time for a ^C
|
|
|
|
# Break out the headers
|
|
header_file="$tmp_dir/headers"
|
|
$SED -n '/[A-Z][a-zA-Z0-9-]*: /p;/^$/q' "$notify_file" > "$header_file"
|
|
|
|
my_mail_body="`$SED '1,/^$/d' $notify_file`"
|
|
echo "$my_mail_body" > "$notify_file"
|
|
|
|
func_verbose "mailing release announcement to \"$sendmail_to\""
|
|
func_show_eval "$MAILNOTIFY $mailnotify_flags \
|
|
--headers='$header_file' \
|
|
-m 'text/plain' -f '$notify_file' -- $sendmail_to"
|
|
}
|
|
}
|
|
|
|
$RM -r "$tmp_dir"
|
|
|
|
exit $EXIT_SUCCESS
|
|
|
|
# Local Variables:
|
|
# mode:shell-script
|
|
# sh-indentation:2
|
|
# End:
|
|
]])
|