summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2022-09-21 00:29:05 +0200
committerBruno Haible <bruno@clisp.org>2022-09-21 00:29:05 +0200
commitf22af31ef3bc6578250ad8951468456c8a987397 (patch)
treeb649e18132f9d46ba37c148ef7bfba865db7c2fb
parent5210250cccb00c9906a96d27212016ee578e8f29 (diff)
downloadgnulib-f22af31ef3bc6578250ad8951468456c8a987397.tar.gz
Add another helper script for creating testdirs.
* all-modules: New file, based on posix-modules.
-rw-r--r--ChangeLog5
-rwxr-xr-xall-modules127
2 files changed, 132 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 6d3eacd3a2..29cea3c545 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2022-09-20 Bruno Haible <bruno@clisp.org>
+ Add another helper script for creating testdirs.
+ * all-modules: New file, based on posix-modules.
+
+2022-09-20 Bruno Haible <bruno@clisp.org>
+
snippet/warn-on-use: Don't cause wrong AC_CHECK_DECL results with clang.
* m4/warn-on-use.m4 (gl_WARN_ON_USE_PREPARE): Use the clang command-line
option that disables implicit built-in function declarations in clang.
diff --git a/all-modules b/all-modules
new file mode 100755
index 0000000000..5b80499513
--- /dev/null
+++ b/all-modules
@@ -0,0 +1,127 @@
+#!/bin/sh
+#
+# Copyright (C) 2022 Free Software Foundation, Inc.
+#
+# This program 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 3 of the License, or
+# (at your option) any later version.
+#
+# This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
+#
+
+progname=$0
+package=gnulib
+
+# func_usage
+# outputs to stdout the --help usage message.
+func_usage ()
+{
+ echo "\
+Usage: all-modules [option]
+
+Lists the gnulib-tool command line options that can be used when creating
+a testdir of nearly all of gnulib.
+
+Options:
+
+ --for-mingw list only modules that work on mingw
+ --for-msvc list only modules that work on MSVC
+
+Report bugs to <bug-gnulib@gnu.org>."
+}
+
+# func_version
+# outputs to stdout the --version message.
+func_version ()
+{
+ func_gnulib_dir
+ if test -d "$gnulib_dir"/.git \
+ && (git --version) >/dev/null 2>/dev/null \
+ && (date --version) >/dev/null 2>/dev/null; then
+ # gnulib checked out from git.
+ sed_extract_first_date='/^Date/{
+s/^Date:[ ]*//p
+q
+}'
+ date=`cd "$gnulib_dir" && git log ChangeLog | sed -n -e "$sed_extract_first_date"`
+ # Turn "Fri Mar 21 07:16:51 2008 -0600" into "Mar 21 2008 07:16:51 -0600".
+ sed_year_before_time='s/^[^ ]* \([^ ]*\) \([0-9]*\) \([0-9:]*\) \([0-9]*\) /\1 \2 \4 \3 /'
+ date=`echo "$date" | sed -e "$sed_year_before_time"`
+ # Use GNU date to compute the time in GMT.
+ date=`date -d "$date" -u +"%Y-%m-%d %H:%M:%S"`
+ version=' '`cd "$gnulib_dir" && ./build-aux/git-version-gen /dev/null | sed -e 's/-dirty/-modified/'`
+ else
+ # gnulib copy without versioning information.
+ date=`sed -e 's/ .*//;q' "$gnulib_dir"/ChangeLog`
+ version=
+ fi
+ year=`"$gnulib_dir"/build-aux/mdate-sh "$self_abspathname" | sed 's,^.* ,,'`
+ echo "\
+all-modules (GNU $package $date)$version
+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.
+
+Written by" "Bruno Haible"
+}
+
+# Excludes for mingw and MSVC.
+exclude_for_mingw=
+# <pwd.h> and <grp.h> do not exist.
+exclude_for_mingw="$exclude_for_mingw idcache"
+exclude_for_mingw="$exclude_for_mingw pt_chown grantpt posix_openpt-tests posix_openpt"
+exclude_for_mingw="$exclude_for_mingw userspec-tests userspec"
+# The functions getuid, getgid, geteuid, getegid don't exist.
+exclude_for_mingw="$exclude_for_mingw faccessat"
+exclude_for_mingw="$exclude_for_mingw fchownat-tests fchownat chownat"
+# The functions fork, setsid, ttyname don't exist.
+exclude_for_mingw="$exclude_for_mingw forkpty-tests forkpty login_tty-tests login_tty"
+
+# Excludes for MSVC.
+exclude_for_msvc="$exclude_for_mingw"
+
+# Command-line option processing.
+exclude=
+while test $# -gt 0; do
+ case "$1" in
+ --for-mingw | --for-ming | --for-min | --for-mi )
+ exclude="$exclude $exclude_for_mingw"
+ shift ;;
+ --for-msvc | --for-msv | --for-ms )
+ exclude="$exclude $exclude_for_msvc"
+ shift ;;
+ --help | --hel | --he | --h )
+ func_usage
+ exit $? ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v )
+ func_version
+ exit $? ;;
+ -* )
+ echo "all-modules: unknown option $1" 1>&2
+ echo "Try 'all-modules --help' for more information." 1>&2
+ exit 1 ;;
+ * )
+ echo "all-modules: too many arguments" 1>&2
+ echo "Try 'all-modules --help' for more information." 1>&2
+ exit 1 ;;
+ esac
+done
+
+# gnulib-tool --create-testdir collects all modules by default.
+# We only need to filter out the excludes.
+for m in $exclude; do
+ printf '%s\n' "--avoid=$m"
+done
+
+# Local Variables:
+# indent-tabs-mode: nil
+# whitespace-check-buffer-indent: nil
+# End: