announce-gen: better diagnose some usage errors
authorJim Meyering <meyering@fb.com>
Sun, 10 Jul 2022 01:42:29 +0000 (18:42 -0700)
committerJim Meyering <meyering@fb.com>
Sun, 10 Jul 2022 01:52:10 +0000 (18:52 -0700)
* build-aux/announce-gen (main): Erroneous usage would elicit a
misleading diagnostic. When --gnulib-version=V was specified:
- without --bootstrap-tools=..., or
- with --bootstrap-tools=..., but without "gnulib" in that list
we would give an inappropriate diagnostic. Now, each diagnostic
is tailored to the precise erroneous condition.
Reported by Bruno Haible in
https://lists.gnu.org/r/bug-gnulib/2022-01/msg00025.html

ChangeLog
build-aux/announce-gen

index 53b4ddc720178ea6b56c4e4907a98c23c91e93fc..6ce387d378e71a1e16f53ee43a424b1f97c36d65 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2022-07-09  Jim Meyering  <meyering@fb.com>
+
+       announce-gen: better diagnose some usage errors
+       * build-aux/announce-gen (main): Erroneous usage would elicit a
+       misleading diagnostic. When --gnulib-version=V was specified:
+       - without --bootstrap_tools, or
+       - with --bootstrap_tools, but without listing "gnulib" as a tool
+       we would give an inappropriate diagnostic. Now, each diagnostic
+       is tailored to the precise erroneous condition.
+       Reported by Bruno Haible in
+       https://lists.gnu.org/r/bug-gnulib/2022-01/msg00025.html
+
 2022-07-09  Simon Josefsson  <simon@josefsson.org>
 
        git-version-gen: Doc fix.
index 3557fabf4be836dbed53cd1f45bb24b0603b2859..320cf4b0d673e236d799fa078872158c93c205a0 100755 (executable)
@@ -35,7 +35,7 @@
 eval 'exec perl -wSx "$0" "$@"'
      if 0;
 
-my $VERSION = '2022-07-08 22:28'; # UTC
+my $VERSION = '2022-07-10 01:47'; # UTC
 # The definition above must lie within the first 8 lines in order
 # for the Emacs time-stamp write hook (at end) to update it.
 # If you change this file with Emacs, please let the write hook
@@ -445,11 +445,15 @@ sub get_tool_versions ($$)
   my @tool_list = split ',', $bootstrap_tools
     if $bootstrap_tools;
 
-  grep (/^gnulib$/, @tool_list) ^ defined $gnulib_version
+  grep (/^gnulib$/, @tool_list) && ! defined $gnulib_version
     and (warn "when specifying gnulib as a tool, you must also specify\n"
         . "--gnulib-version=V, where V is the result of running git describe\n"
         . "in the gnulib source directory.\n"), $fail = 1;
 
+  ! grep (/^gnulib$/, @tool_list) && defined $gnulib_version
+    and (warn "with --gnulib-version=V you must use --bootstrap-tools=...\n"
+         . "including gnulib in that list"), $fail = 1;
+
   !$release_type || exists $valid_release_types{$release_type}
     or (warn "'$release_type': invalid release type\n"), $fail = 1;