bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

two new options for the announce-gen script


From: Jim Meyering
Subject: two new options for the announce-gen script
Date: Fri, 08 Dec 2006 10:28:53 +0100

I did not include bootstrap tool version information in the announcement
for coreutils-6.7.  Not a big deal, of course, but with the following
changes, that won't happen again.  Cc'ing bug-gnulib, since the announce-gen
script is now there.

Now, if you invoke announce-gen with --bootstrap-tools=...
(listing the bootstrap tools used by your package), you'll
get something like this in the generated announcement template:

  This release was bootstrapped with the following tools:
    Autoconf 2.61
    Automake 1.10
    Bison 2.3a
    CVS Gnulib sources from 2006-12-08 08:44:32 +0000

-------------------------------------------------
[coreutils]
        Include bootstrap tool version info in the announcement form.
        * Makefile.maint (gnulib_snapshot_date): Define.
        (announcement): Use two new announce-gen options,
        --bootstrap-tools and --gnulib-snapshot-date.
        * Makefile.cfg (gnulib_dir): Set.

[gnulib]
        * build-aux/announce-gen: Add two new options, both optional:
        --bootstrap-tools=TOOL_LIST
              a comma-separated list of tools, e.g.,
              autoconf,automake,bison,gnulib
        --gnulib-snapshot-date=DATE
              if gnulib is in the bootstrap tool list,
              then report this as the snapshot date.
              If not specified, use the current date/time.
              If you specify a date here, be sure it's UTC.

diff --git a/Makefile.cfg b/Makefile.cfg
index 0c43c21..bd42ca0 100644
--- a/Makefile.cfg
+++ b/Makefile.cfg
@@ -34,3 +34,7 @@ gpg_key_ID = D333CBA1
 # files -- otherwise, you'd need to have the upcoming version number
 # at the top of the file for each `make distcheck' run.
 local-checks-to-skip = changelog-check
+
+# The local directory containing the checked-out copy of gnulib used in
+# this release.  Used solely to get a date for the "announcement" target.
+gnulib_dir = /gnulib
diff --git a/Makefile.maint b/Makefile.maint
index f4e961f..112ce18 100644
--- a/Makefile.maint
+++ b/Makefile.maint
@@ -555,6 +555,11 @@ prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz
 xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta

 rel-files = $(xd-delta) $(DIST_ARCHIVES)
+
+# Approximate date of last "update" by the date on the ChangeLog file.
+gnulib_snapshot_date = \
+  $$(date -u --date $$(stat --printf @%Y $(gnulib_dir)/ChangeLog) \
+     '+%Y-%m-%d %T %z')
 announcement: NEWS ChangeLog $(rel-files)
        @./build-aux/announce-gen                                       \
            --release-type=$(RELEASE_TYPE)                              \
@@ -563,8 +568,9 @@ announcement: NEWS ChangeLog $(rel-files)
            --curr=$(VERSION)                                           \
            --gpg-key-id=$(gpg_key_ID)                                  \
            --news=NEWS                                                 \
-           $(addprefix --url-dir=, $(url_dir_list))                    \
-
+           --bootstrap-tools=autoconf,automake,bison,gnulib            \
+            --gnulib-snapshot-date=$(gnulib_snapshot_date)             \
+           $(addprefix --url-dir=, $(url_dir_list))

 ## ---------------- ##
 ## Updating files.  ##

Index: build-aux/announce-gen
===================================================================
RCS file: /sources/gnulib/gnulib/build-aux/announce-gen,v
retrieving revision 1.1
diff -u -p -r1.1 announce-gen
--- build-aux/announce-gen      23 Nov 2006 15:22:51 -0000      1.1
+++ build-aux/announce-gen      8 Dec 2006 09:14:36 -0000
@@ -24,6 +24,7 @@ use strict;
 use Getopt::Long;
 use Digest::MD5;
 use Digest::SHA1;
+use POSIX qw(strftime);

 (my $VERSION = '$Revision: 1.1 $ ') =~ tr/[0-9].//cd;
 (my $ME = $0) =~ s|.*/||;
@@ -73,7 +74,7 @@ OPTIONS:

   Generate an announcement message.

-  FIXME: describe the following
+These options must be specified:

    --release-type=TYPE          TYPE must be one of @types
    --package-name=PACKAGE_NAME
@@ -81,7 +82,16 @@ OPTIONS:
    --current-version=VER
    --gpg-key-id=ID         The GnuPG ID of the key used to sign the tarballs
    --url-directory=URL_DIR
-   --news=NEWS_FILE             optional
+
+The following are optional:
+
+   --news=NEWS_FILE
+   --bootstrap-tools=TOOL_LIST  a comma-separated list of tools, e.g.,
+                                autoconf,automake,bison,gnulib
+   --gnulib-snapshot-date=DATE  if gnulib is in the bootstrap tool list,
+                                then report this as the snapshot date.
+                                If not specified, use the current date/time.
+                                If you specify a date here, be sure it's UTC.

    --help             display this help and exit
    --version          output version information and exit
@@ -311,6 +321,49 @@ sub print_changelog_deltas ($$)
     or warn "$ME: warning: `cmd' had unexpected exit code or signal ($?)\n";
 }

+sub get_tool_versions ($$)
+{
+  my ($bootstrap_tools, $gnulib_snapshot_timestamp) = @_;
+  defined $bootstrap_tools
+    or return ();
+
+  defined $gnulib_snapshot_timestamp
+    or $gnulib_snapshot_timestamp = strftime '%Y-%m-%d %T UTC', gmtime;
+
+  my $fail;
+  my @tool_list = split ',', $bootstrap_tools;
+  my @tool_version_pair;
+  foreach my $t (@tool_list)
+    {
+      if ($t eq 'gnulib')
+       {
+         push @tool_version_pair,
+           "CVS Gnulib sources from $gnulib_snapshot_timestamp";
+         next;
+       }
+      # Assume that the last "word" on the first line of
+      # `tool --version` output is the version string.
+      my ($first_line, undef) = split ("\n", `$t --version`);
+      if ($first_line =~ /.* (\d[\w.-]+)$/)
+       {
+         $t = ucfirst $t;
+         push @tool_version_pair, "$t $1";
+       }
+      else
+       {
+         defined $first_line
+           and $first_line = '';
+         warn "$ME: $t: unexpected --version output\n:$first_line";
+         $fail = 1;
+       }
+    }
+
+  $fail
+    and exit 1;
+
+  return @tool_version_pair;
+}
+
 {
   # Neutralize the locale, so that, for instance, "du" does not
   # issue "1,2" instead of "1.2", what confuses our regexps.
@@ -323,6 +376,8 @@ sub print_changelog_deltas ($$)
   my $gpg_key_id;
   my @url_dir_list;
   my @news_file;
+  my $bootstrap_tools;
+  my $gnulib_snapshot_timestamp;

   GetOptions
     (
@@ -333,6 +388,8 @@ sub print_changelog_deltas ($$)
      'gpg-key-id=s'       => \$gpg_key_id,
      'url-directory=s'    => address@hidden,
      'news=s'             => address@hidden,
+     'bootstrap-tools=s'  => \$bootstrap_tools,
+     'gnulib-snapshot-time-stamp=s' => \$gnulib_snapshot_timestamp,

      help => sub { usage 0 },
      version => sub { print "$ME version $VERSION\n"; exit },
@@ -408,6 +465,12 @@ then run this command to import it:
 and rerun the \`gpg --verify' command.
 EOF

+  my @tool_versions = get_tool_versions ($bootstrap_tools,
+                                         $gnulib_snapshot_timestamp);
+  @tool_versions
+    and print "\nThis release was bootstrapped with the following tools:",
+      join ('', map {"\n  $_"} @tool_versions), "\n";
+
   print_news_deltas ($_, $prev_version, $curr_version)
     foreach @news_file;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]