bug-gnulib
[Top][All Lists]
Advanced

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

Re: announce-gen -- not flexible enough


From: Alfred M. Szmidt
Subject: Re: announce-gen -- not flexible enough
Date: Sat, 05 Dec 2009 12:26:23 -0500

   You said you would not be changing announce-gen, so isn't it moot?

I said that I did not have enough knowledge to hack announce-gen since
it is written in perl; I cannot do something when I don't know how to
do it.

   I pointed out that yet another script parses (and rewrites) NEWS
   and would need similar changes.

Right, so something similar needs to be added there.  I can do it for
do-release-commit-and-tag, since that is in shell script.  Attached is
a quick hack, that I didn't bother testing.

Is there is someone who can add a --skip-news option to announce-gen,
(and a way of specifying that you don't want NEWS to be inserted in
cfg.mk; though I can do that)?  If not, the best solution is to remove
announce-gen from gnulib, since it is not flexible enough for other
projets to use; asking everyone to use the same format for a file that
has been free-hand for 20+ years is not going to work.

diff --git a/build-aux/do-release-commit-and-tag 
b/build-aux/do-release-commit-and-tag
index ba0c1b2..abe463d 100755
--- a/build-aux/do-release-commit-and-tag
+++ b/build-aux/do-release-commit-and-tag
@@ -3,7 +3,7 @@
 # controlled .prev-version file, automate the procedure by which we record
 # the date, release-type and version string in the NEWS file.  That commit
 # will serve to identify the release, so apply a signed tag to it as well.
-VERSION=2009-11-06.10 # UTC
+VERSION=2009-12-05.17 # UTC
 
 # Note: this is a bash script (could be zsh or dash)
 
@@ -28,6 +28,8 @@ ME=`basename "$0"`
 warn() { printf '%s: %s\n' "$ME" "$*" >&2; }
 die() { warn "$*"; exit 1; }
 
+opt_skip_news=false
+
 help_version()
 {
   case $1 in
@@ -41,7 +43,7 @@ a signed tag.  Run it from your project's the top-level 
directory.
 
 Requirements:
 - you use git for version-control
-- a NEWS file, with line 3 identical to this:
+- optionally a NEWS file, with line 3 identical to this:
 * Noteworthy changes in release ?.? (????-??-??) [?]
 - a version-controlled .prev-version file
 
@@ -69,6 +71,10 @@ There is NO WARRANTY, to the extent permitted by law.
 EOF
       exit ;;
 
+      --skip-news)
+          opt_skip_news=true
+          break ;;
+
   *) die "unrecognized option: $1";;
   esac
 }
@@ -103,10 +109,12 @@ esac
 pkg=$(sed -n 's/^PACKAGE = \(.*\)/\1/p' Makefile) \
   || die 'failed to determine package name from Makefile'
 
-# simple check: no question marks on line 3 of NEWS
-noteworthy='* Noteworthy changes in release'
-test "$(sed -n 3p NEWS)" = "$noteworthy ?.? (????-??-??) [?]" \
-  || die 'line 3 of NEWS looks fishy!'
+if [ $opt_skip_news == "false" ]; then
+    # simple check: no question marks on line 3 of NEWS
+    noteworthy='* Noteworthy changes in release'
+    test "$(sed -n 3p NEWS)" = "$noteworthy ?.? (????-??-??) [?]" \
+        || die 'line 3 of NEWS looks fishy!'
+if
 
 # No dirt allowed.
 case $(git diff-index --name-only HEAD) in
@@ -114,19 +122,22 @@ case $(git diff-index --name-only HEAD) in
   *) die 'this tree is dirty; commit your changes first';;
 esac
 
-# update NEWS to have today's date, plus desired version number and $type
-perl -MPOSIX -ni -e 'my $today = strftime "%F", localtime time;' \
- -e 'my ($type, $ver) = qw('"$type $ver"');' \
- -e 'my $pfx = "'"$noteworthy"'";' \
- -e 'print $.==3 ? "$pfx $ver ($today) [$type]\n" : $_' \
-     NEWS || die 'failed to update NEWS'
+if [ $opt_skip_news == "false" ]; then
+    # update NEWS to have today's date, plus desired version number and $type
+    perl -MPOSIX -ni -e 'my $today = strftime "%F", localtime time;' \
+        -e 'my ($type, $ver) = qw('"$type $ver"');' \
+        -e 'my $pfx = "'"$noteworthy"'";' \
+        -e 'print $.==3 ? "$pfx $ver ($today) [$type]\n" : $_' \
+        NEWS || die 'failed to update NEWS'
+fi
 
 # Ensure the current branch name is "master":
 curr_br=$(git rev-parse --symbolic-full-name HEAD)
 test "$curr_br" = refs/heads/master || die not on master
-
-printf "version $ver\n\n* NEWS: Record release date.\n" \
-    | git commit -F -  -a || die 'git commit failed'
+if [ $opt_skip_news == "false" ]; then
+    printf "version $ver\n\n* NEWS: Record release date.\n" \
+        | git commit -F -  -a || die 'git commit failed'
+fi
 git tag -s -m "$pkg $ver" v$ver HEAD || die 'git tag failed'
 
 # Local variables:




reply via email to

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