These patches implement a --version option for some of the build-aux/* programs
according to the GNU Coding Standards
<https://www.gnu.org/prep/standards/html_node/_002d_002dversion.html>
I concentrated on the programs that are likely invoked interactively.
Adding --help and --version to helper scripts (such as config.libpath,
config.rpath,
declared.sh, install-reloc, etc.) is not high priority to me.
The same thing would be useful also in these two scripts, but I didn't succeed.
Help appreciated!
* update-copyright: This would require removing the '-pi' option and using a
'while (<>)' loop. But I didn't succeed. Some p*rl magician is needed.
* vcs-to-changelog.py: How to tell 'argparse' that there are no required
parameters when --help is given?
2021-04-11 Bruno Haible <[email protected]>
useless-if-before-free: Implement --version option according to GCS.
* build-aux/useless-if-before-free (copyright_year): New variable.
(GetOptions): Print also a short copyright and license notice and
author statement.
libtool-next-version: Implement --version option according to GCS.
* build-aux/libtool-next-version (scriptversion): New variable.
(func_version): Deduce the copyright year from it. Terminate sentences
with '.'.
gnupload: Implement --version option according to GCS.
* build-aux/gnupload (copyright_year, copyright): New variables.
(--version): Print also a short copyright and license notice.
git-version-gen: Implement --version option according to GCS.
* build-aux/git-version-gen (version): State the license. Use wording
from GCS.
bootstrap: Implement --version option according to GCS.
* build-aux/bootstrap (copyright_year, copyright): New variables.
(--version): New option processing.
announce-gen: Implement --version option according to GCS.
* build-aux/announce-gen (copyright_year): New variable.
(GetOptions): Print also a short copyright and license notice and
author statement.
>From 60863e8024d7a7c6ffe4b03d33a87bdb44ab5770 Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Sun, 11 Apr 2021 14:17:13 +0200
Subject: [PATCH 1/6] announce-gen: Implement --version option according to
GCS.
* build-aux/announce-gen (copyright_year): New variable.
(GetOptions): Print also a short copyright and license notice and
author statement.
---
ChangeLog | 7 +++++++
build-aux/announce-gen | 18 ++++++++++++++++--
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 197ce80..d6e0f72 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2021-04-11 Bruno Haible <[email protected]>
+
+ announce-gen: Implement --version option according to GCS.
+ * build-aux/announce-gen (copyright_year): New variable.
+ (GetOptions): Print also a short copyright and license notice and
+ author statement.
+
2021-04-10 Bruno Haible <[email protected]>
Simplify GNULIB_* variable initializations.
diff --git a/build-aux/announce-gen b/build-aux/announce-gen
index 84d2d63..daa478c 100755
--- a/build-aux/announce-gen
+++ b/build-aux/announce-gen
@@ -35,12 +35,14 @@
eval 'exec perl -wSx "$0" "$@"'
if 0;
-my $VERSION = '2020-05-10 16:13'; # UTC
+my $VERSION = '2021-04-11 8:42'; # 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
# do its job. Otherwise, update this string manually.
+my $copyright_year = '2021';
+
use strict;
use Getopt::Long;
use POSIX qw(strftime);
@@ -413,7 +415,19 @@ sub get_tool_versions ($$)
'archive-suffix=s' => \@archive_suffixes,
help => sub { usage 0 },
- version => sub { print "$ME version $VERSION\n"; exit },
+ version =>
+ sub
+ {
+ print "$ME version $VERSION\n";
+ print "Copyright (C) $copyright_year Free Software Foundation, Inc.\n";
+ print "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.\n"
+ . "This is free software: you are free to change and redistribute it.\n"
+ . "There is NO WARRANTY, to the extent permitted by law.\n";
+ print "\n";
+ my $author = "Jim Meyering";
+ print "Written by $author.\n";
+ exit
+ },
) or usage 1;
my $fail = 0;
--
2.7.4
>From fd6f32a849f159d6063869ebeb7f29e9c7b0736f Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Sun, 11 Apr 2021 14:20:08 +0200
Subject: [PATCH 2/6] bootstrap: Implement --version option according to GCS.
* build-aux/bootstrap (copyright_year, copyright): New variables.
(--version): New option processing.
---
ChangeLog | 4 ++++
build-aux/bootstrap | 14 +++++++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index d6e0f72..dc08f18 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2021-04-11 Bruno Haible <[email protected]>
+ bootstrap: Implement --version option according to GCS.
+ * build-aux/bootstrap (copyright_year, copyright): New variables.
+ (--version): New option processing.
+
announce-gen: Implement --version option according to GCS.
* build-aux/announce-gen (copyright_year): New variable.
(GetOptions): Print also a short copyright and license notice and
diff --git a/build-aux/bootstrap b/build-aux/bootstrap
index c17a36f..7336598 100755
--- a/build-aux/bootstrap
+++ b/build-aux/bootstrap
@@ -1,6 +1,6 @@
#! /bin/sh
# Print a version string.
-scriptversion=2021-01-10.00; # UTC
+scriptversion=2021-04-11.09; # UTC
# Bootstrap this package from checked-out sources.
@@ -115,6 +115,12 @@ Running without arguments will suffice in most cases.
EOF
}
+copyright_year=`echo "$scriptversion" | sed -e 's/[^0-9].*//'`
+copyright="Copyright (C) ${copyright_year} Free Software Foundation, Inc.
+License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law."
+
# warnf_ FORMAT-STRING ARG1...
warnf_ ()
{
@@ -337,6 +343,12 @@ do
--help)
usage
exit;;
+ --version)
+ set -e
+ echo "bootstrap $scriptversion"
+ echo "$copyright"
+ exit 0
+ ;;
--gnulib-srcdir=*)
GNULIB_SRCDIR=${option#--gnulib-srcdir=};;
--skip-po)
--
2.7.4
>From 38cd01d2d16cdae8794d3cc2a4a70054651b799d Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Sun, 11 Apr 2021 14:22:07 +0200
Subject: [PATCH 3/6] git-version-gen: Implement --version option according to
GCS.
* build-aux/git-version-gen (version): State the license. Use wording
from GCS.
---
ChangeLog | 4 ++++
build-aux/git-version-gen | 8 ++++----
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index dc08f18..2f9c759 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2021-04-11 Bruno Haible <[email protected]>
+ git-version-gen: Implement --version option according to GCS.
+ * build-aux/git-version-gen (version): State the license. Use wording
+ from GCS.
+
bootstrap: Implement --version option according to GCS.
* build-aux/bootstrap (copyright_year, copyright): New variables.
(--version): New option processing.
diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen
index 959f988..da525aa 100755
--- a/build-aux/git-version-gen
+++ b/build-aux/git-version-gen
@@ -75,10 +75,10 @@ me=$0
year=`expr "$scriptversion" : '\([^-]*\)'`
version="git-version-gen $scriptversion
-Copyright $year Free Software Foundation, Inc.
-There is NO warranty. You may redistribute this software
-under the terms of the GNU General Public License.
-For more information about these matters, see the files named COPYING."
+Copyright (C) ${year} Free Software Foundation, Inc.
+License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law."
usage="\
Usage: $me [OPTION]... \$srcdir/.tarball-version [TAG-NORMALIZATION-SED-SCRIPT]
--
2.7.4
>From 8bd125ff4b6e2f34a754bf1adcf4c75a7630cfef Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Sun, 11 Apr 2021 14:25:56 +0200
Subject: [PATCH 4/6] gnupload: Implement --version option according to GCS.
* build-aux/gnupload (copyright_year, copyright): New variables.
(--version): Print also a short copyright and license notice.
---
ChangeLog | 4 ++++
build-aux/gnupload | 11 +++++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2f9c759..6b6111d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2021-04-11 Bruno Haible <[email protected]>
+ gnupload: Implement --version option according to GCS.
+ * build-aux/gnupload (copyright_year, copyright): New variables.
+ (--version): Print also a short copyright and license notice.
+
git-version-gen: Implement --version option according to GCS.
* build-aux/git-version-gen (version): State the license. Use wording
from GCS.
diff --git a/build-aux/gnupload b/build-aux/gnupload
index 90e7c82..e7822ae 100755
--- a/build-aux/gnupload
+++ b/build-aux/gnupload
@@ -1,7 +1,7 @@
#!/bin/sh
# Sign files and upload them.
-scriptversion=2018-05-19.18; # UTC
+scriptversion=2021-04-11.09; # UTC
# Copyright (C) 2004-2021 Free Software Foundation, Inc.
#
@@ -145,6 +145,12 @@ the build-aux/ directory of the gnulib package
Send patches and bug reports to <[email protected]>."
+copyright_year=`echo "$scriptversion" | sed -e 's/[^0-9].*//'`
+copyright="Copyright (C) ${copyright_year} Free Software Foundation, Inc.
+License GPLv2+: GNU GPL version 2 or later <https://gnu.org/licenses/gpl.html>.
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law."
+
# Read local configuration file
if test -r "$conffile"; then
echo "$0: Reading configuration file $conffile"
@@ -209,7 +215,8 @@ while test -n "$1"; do
;;
--version)
echo "gnupload $scriptversion"
- exit $?
+ echo "$copyright"
+ exit 0
;;
--)
shift
--
2.7.4
>From 893a10822645300c26e67d54732ec564deabcf3f Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Sun, 11 Apr 2021 14:28:00 +0200
Subject: [PATCH 5/6] libtool-next-version: Implement --version option
according to GCS.
* build-aux/libtool-next-version (scriptversion): New variable.
(func_version): Deduce the copyright year from it. Terminate sentences
with '.'.
---
ChangeLog | 5 +++++
build-aux/libtool-next-version | 12 ++++++++----
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6b6111d..1006e25 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2021-04-11 Bruno Haible <[email protected]>
+ libtool-next-version: Implement --version option according to GCS.
+ * build-aux/libtool-next-version (scriptversion): New variable.
+ (func_version): Deduce the copyright year from it. Terminate sentences
+ with '.'.
+
gnupload: Implement --version option according to GCS.
* build-aux/gnupload (copyright_year, copyright): New variables.
(--version): Print also a short copyright and license notice.
diff --git a/build-aux/libtool-next-version b/build-aux/libtool-next-version
index 66e3b77..657f513 100755
--- a/build-aux/libtool-next-version
+++ b/build-aux/libtool-next-version
@@ -42,6 +42,8 @@
# - It does not enforce that applying the third or fourth rule is only
# possible after applying the second rule.
+scriptversion=2021-04-11
+
# func_usage
# outputs to stdout the --help usage message.
func_usage ()
@@ -68,12 +70,14 @@ Report bugs to <[email protected]>."
# outputs to stdout the --version message.
func_version ()
{
- echo "libtool-next-version (GNU gnulib)"
- echo "Copyright (C) 2019 Free Software Foundation, Inc.
-License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
+ copyright_year=`echo "$scriptversion" | sed -e 's/[^0-9].*//'`
+ echo "libtool-next-version (GNU gnulib) $scriptversion"
+ echo "Copyright (C) ${copyright_year} Free Software Foundation, Inc.
+License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law."
- echo "Written by" "Bruno Haible"
+ echo
+ printf 'Written by %s.\n' "Bruno Haible"
}
# func_fatal_error message
--
2.7.4
>From 906d51f17c05324f7389de7cad5e12e1800ac279 Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Sun, 11 Apr 2021 14:30:03 +0200
Subject: [PATCH 6/6] useless-if-before-free: Implement --version option
according to GCS.
* build-aux/useless-if-before-free (copyright_year): New variable.
(GetOptions): Print also a short copyright and license notice and
author statement.
---
ChangeLog | 5 +++++
build-aux/useless-if-before-free | 18 ++++++++++++++++--
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 1006e25..b046ab7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2021-04-11 Bruno Haible <[email protected]>
+ useless-if-before-free: Implement --version option according to GCS.
+ * build-aux/useless-if-before-free (copyright_year): New variable.
+ (GetOptions): Print also a short copyright and license notice and
+ author statement.
+
libtool-next-version: Implement --version option according to GCS.
* build-aux/libtool-next-version (scriptversion): New variable.
(func_version): Deduce the copyright year from it. Terminate sentences
diff --git a/build-aux/useless-if-before-free b/build-aux/useless-if-before-free
index 784d80b..5bbbc44 100755
--- a/build-aux/useless-if-before-free
+++ b/build-aux/useless-if-before-free
@@ -36,12 +36,14 @@
eval 'exec perl -wSx "$0" "$@"'
if 0;
-my $VERSION = '2020-04-04 15:07'; # UTC
+my $VERSION = '2021-04-11 10:11'; # 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
# do its job. Otherwise, update this string manually.
+my $copyright_year = '2021';
+
use strict;
use warnings;
use Getopt::Long;
@@ -118,7 +120,19 @@ sub is_NULL ($)
GetOptions
(
help => sub { usage 0 },
- version => sub { print "$ME version $VERSION\n"; exit },
+ version =>
+ sub
+ {
+ print "$ME version $VERSION\n";
+ print "Copyright (C) $copyright_year Free Software Foundation, Inc.\n";
+ print "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.\n"
+ . "This is free software: you are free to change and redistribute it.\n"
+ . "There is NO WARRANTY, to the extent permitted by law.\n";
+ print "\n";
+ my $author = "Jim Meyering";
+ print "Written by $author.\n";
+ exit
+ },
list => \$list,
'name=s@' => \@name,
) or usage 1;
--
2.7.4