autoupdate
[gnulib.git] / all-modules
blob4d22f7fc47655e18ff0ea021741eb04b9763e9b4
1 #!/bin/sh
3 # Copyright (C) 2022-2024 Free Software Foundation, Inc.
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19 progname=$0
20 package=gnulib
22 # func_usage
23 # outputs to stdout the --help usage message.
24 func_usage ()
26 echo "\
27 Usage: all-modules [option]
29 Lists the gnulib-tool command line options that can be used when creating
30 a testdir of nearly all of gnulib.
32 Options:
34 --for-mingw list only modules that work on mingw
35 --for-msvc list only modules that work on MSVC
37 Report bugs to <bug-gnulib@gnu.org>."
40 # func_version
41 # outputs to stdout the --version message.
42 func_version ()
44 func_gnulib_dir
45 if test -d "$gnulib_dir"/.git \
46 && (git --version) >/dev/null 2>/dev/null \
47 && (date --version) >/dev/null 2>/dev/null; then
48 # gnulib checked out from git.
49 sed_extract_first_date='/^Date/{
50 s/^Date:[ ]*//p
53 date=`cd "$gnulib_dir" && git log ChangeLog | sed -n -e "$sed_extract_first_date"`
54 # Turn "Fri Mar 21 07:16:51 2008 -0600" into "Mar 21 2008 07:16:51 -0600".
55 sed_year_before_time='s/^[^ ]* \([^ ]*\) \([0-9]*\) \([0-9:]*\) \([0-9]*\) /\1 \2 \4 \3 /'
56 date=`echo "$date" | sed -e "$sed_year_before_time"`
57 # Use GNU date to compute the time in GMT.
58 date=`date -d "$date" -u +"%Y-%m-%d %H:%M:%S"`
59 version=' '`cd "$gnulib_dir" && ./build-aux/git-version-gen /dev/null | sed -e 's/-dirty/-modified/'`
60 else
61 # gnulib copy without versioning information.
62 date=`sed -e 's/ .*//;q' "$gnulib_dir"/ChangeLog`
63 version=
65 year=`"$gnulib_dir"/build-aux/mdate-sh "$self_abspathname" | sed 's,^.* ,,'`
66 echo "\
67 all-modules (GNU $package $date)$version
68 Copyright (C) $year Free Software Foundation, Inc.
69 License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
70 This is free software: you are free to change and redistribute it.
71 There is NO WARRANTY, to the extent permitted by law.
73 Written by" "Bruno Haible"
76 # Excludes for mingw and MSVC.
77 exclude_for_mingw=
78 # <pwd.h> and <grp.h> do not exist.
79 exclude_for_mingw="$exclude_for_mingw idcache"
80 exclude_for_mingw="$exclude_for_mingw pt_chown grantpt posix_openpt-tests posix_openpt"
81 exclude_for_mingw="$exclude_for_mingw userspec-tests userspec"
82 # The functions getuid, getgid, geteuid, getegid don't exist.
83 exclude_for_mingw="$exclude_for_mingw faccessat"
84 exclude_for_mingw="$exclude_for_mingw fchownat-tests fchownat chownat"
85 # The functions fork, setsid, ttyname don't exist.
86 exclude_for_mingw="$exclude_for_mingw forkpty-tests forkpty login_tty-tests login_tty"
88 # Excludes for MSVC.
89 exclude_for_msvc="$exclude_for_mingw"
91 # Command-line option processing.
92 exclude="year2038-recommended"
93 while test $# -gt 0; do
94 case "$1" in
95 --for-mingw | --for-ming | --for-min | --for-mi )
96 exclude="$exclude $exclude_for_mingw"
97 shift ;;
98 --for-msvc | --for-msv | --for-ms )
99 exclude="$exclude $exclude_for_msvc"
100 shift ;;
101 --help | --hel | --he | --h )
102 func_usage
103 exit $? ;;
104 --version | --versio | --versi | --vers | --ver | --ve | --v )
105 func_version
106 exit $? ;;
107 -* )
108 echo "all-modules: unknown option $1" 1>&2
109 echo "Try 'all-modules --help' for more information." 1>&2
110 exit 1 ;;
112 echo "all-modules: too many arguments" 1>&2
113 echo "Try 'all-modules --help' for more information." 1>&2
114 exit 1 ;;
115 esac
116 done
118 # gnulib-tool --create-testdir collects all modules by default.
119 # We only need to filter out the excludes.
120 for m in $exclude; do
121 printf '%s\n' "--avoid=$m"
122 done
124 # Local Variables:
125 # indent-tabs-mode: nil
126 # whitespace-check-buffer-indent: nil
127 # End: