comparison autopull.sh @ 32477:e6d339b9309d

maint: Update gnulib. * bootstrap.conf (GNULIB_REVISION): Update to 7a38f30f925db7d486460c18df41413f3c7ef74b. * bootstrap, autogen.sh, autopull.sh, bootstrap-funclib.sh: Update with ./bootstrap --bootstrap-sync. * build-aux/gnulib-bootstrap-git-fetch.diff: Refresh patch for new gnulib version.
author Markus Mützel <markus.muetzel@gmx.de>
date Mon, 20 Nov 2023 18:41:06 +0100
parents e98fb9b4be86
children c51b07a71421
comparison
equal deleted inserted replaced
32476:9ad5b8864d3e 32477:e6d339b9309d
1 #!/bin/sh 1 #!/bin/sh
2 # Convenience script for fetching auxiliary files that are omitted from 2 # Convenience script for fetching auxiliary files that are omitted from
3 # the version control repository of this package. 3 # the version control repository of this package.
4 4
5 # Copyright (C) 2003-2022 Free Software Foundation, Inc. 5 # Copyright (C) 2003-2023 Free Software Foundation, Inc.
6 # 6 #
7 # This program is free software: you can redistribute it and/or modify 7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by 8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or 9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version. 10 # (at your option) any later version.
26 # build-aux/bootstrap.conf to get you started. 26 # build-aux/bootstrap.conf to get you started.
27 # 27 #
28 # Alternatively, you can use an autopull.sh script that is specific 28 # Alternatively, you can use an autopull.sh script that is specific
29 # to your package. 29 # to your package.
30 30
31 scriptversion=2022-07-24.15; # UTC
32
33 me="$0" 31 me="$0"
34 medir=`dirname "$me"` 32 medir=`dirname "$me"`
35 33
36 # Read the function library and the configuration. 34 # Read the function library and the configuration.
37 . "$medir"/bootstrap-funclib.sh 35 . "$medir"/bootstrap-funclib.sh
38 36
39 # Ensure that CDPATH is not set. Otherwise, the output from cd 37 autopull "$@"
40 # would cause trouble in at least one use below.
41 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
42
43 usage() {
44 cat <<EOF
45 Usage: $me [OPTION]...
46 Bootstrap this package from the checked-out sources.
47
48 Optional environment variables:
49 GNULIB_SRCDIR Specifies the local directory where gnulib
50 sources reside. Use this if you already
51 have gnulib sources on your machine, and
52 you want to use these sources.
53 GNULIB_REFDIR Specifies the local directory where a gnulib
54 repository (with a .git subdirectory) resides.
55 Use this if you already have gnulib sources
56 and history on your machine, and do not want
57 to waste your bandwidth downloading them again.
58 GNULIB_URL Cloneable URL of the gnulib repository.
59
60 Options:
61 --bootstrap-sync if this bootstrap script is not identical to
62 the version in the local gnulib sources,
63 update this script, and then restart it with
64 /bin/sh or the shell \$CONFIG_SHELL
65 --no-bootstrap-sync do not check whether bootstrap is out of sync
66 --force attempt to bootstrap even if the sources seem
67 not to have been checked out
68 --no-git do not use git to update gnulib. Requires that
69 \$GNULIB_SRCDIR or the --gnulib-srcdir option
70 points to a gnulib repository with the correct
71 revision
72 --skip-po do not download po files
73 EOF
74 bootstrap_print_option_usage_hook
75 cat <<EOF
76 If the file bootstrap.conf exists in the same directory as this script, its
77 contents are read as shell variables to configure the bootstrap.
78
79 For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
80 are honored.
81
82 Gnulib sources can be fetched in various ways:
83
84 * If the environment variable GNULIB_SRCDIR is set (either as an
85 environment variable or via the --gnulib-srcdir option), then sources
86 are fetched from that local directory. If it is a git repository and
87 the configuration variable GNULIB_REVISION is set in bootstrap.conf,
88 then that revision is checked out.
89
90 * Otherwise, if this package is in a git repository with a 'gnulib'
91 submodule configured, then that submodule is initialized and updated
92 and sources are fetched from there. If GNULIB_REFDIR is set (either
93 as an environment variable or via the --gnulib-refdir option) and is
94 a git repository, then it is used as a reference.
95
96 * Otherwise, if the 'gnulib' directory does not exist, Gnulib sources
97 are cloned into that directory using git from \$GNULIB_URL, defaulting
98 to $default_gnulib_url.
99 If the configuration variable GNULIB_REVISION is set in bootstrap.conf,
100 then that revision is checked out.
101
102 * Otherwise, the existing Gnulib sources in the 'gnulib' directory are
103 used. If it is a git repository and the configuration variable
104 GNULIB_REVISION is set in bootstrap.conf, then that revision is
105 checked out.
106
107 If you maintain a package and want to pin a particular revision of the
108 Gnulib sources that has been tested with your package, then there are
109 two possible approaches: either configure a 'gnulib' submodule with the
110 appropriate revision, or set GNULIB_REVISION (and if necessary
111 GNULIB_URL) in bootstrap.conf.
112
113 Running without arguments will suffice in most cases.
114 EOF
115 }
116
117 # Parse options.
118
119 # Use git to update gnulib sources
120 use_git=true
121
122 for option
123 do
124 case $option in
125 --help)
126 usage
127 exit;;
128 --version)
129 set -e
130 echo "autopull.sh $scriptversion"
131 echo "$copyright"
132 exit 0
133 ;;
134 --skip-po)
135 SKIP_PO=t;;
136 --force)
137 checkout_only_file=;;
138 --bootstrap-sync)
139 bootstrap_sync=true;;
140 --no-bootstrap-sync)
141 bootstrap_sync=false;;
142 --no-git)
143 use_git=false;;
144 *)
145 bootstrap_option_hook $option || die "$option: unknown option";;
146 esac
147 done
148
149 $use_git || test -n "$GNULIB_SRCDIR" \
150 || die "Error: --no-git requires \$GNULIB_SRCDIR environment variable or --gnulib-srcdir option"
151 test -z "$GNULIB_SRCDIR" || test -d "$GNULIB_SRCDIR" \
152 || die "Error: \$GNULIB_SRCDIR environment variable or --gnulib-srcdir option is specified, but does not denote a directory"
153
154 if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
155 die "Running this script from a non-checked-out distribution is risky."
156 fi
157
158 check_build_prerequisites $use_git
159
160 if $use_gnulib || $bootstrap_sync; then
161 prepare_GNULIB_SRCDIR
162 if $bootstrap_sync; then
163 upgrade_bootstrap
164 fi
165 fi
166
167 # Find sha1sum, named gsha1sum on MacPorts, shasum on Mac OS X 10.6.
168 # Also find the compatible sha1 utility on the BSDs
169 if test x"$SKIP_PO" = x; then
170 find_tool SHA1SUM sha1sum gsha1sum shasum sha1
171 fi
172
173 # See if we can use gnulib's git-merge-changelog merge driver.
174 if $use_git && test -d .git && check_exists git; then
175 if git config merge.merge-changelog.driver >/dev/null ; then
176 :
177 elif check_exists git-merge-changelog; then
178 echo "$0: initializing git-merge-changelog driver"
179 git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver'
180 git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B'
181 else
182 echo "$0: consider installing git-merge-changelog from gnulib"
183 fi
184 fi
185
186 # ----------------------------- Get translations. -----------------------------
187
188 download_po_files() {
189 subdir=$1
190 domain=$2
191 echo "$me: getting translations into $subdir for $domain..."
192 cmd=$(printf "$po_download_command_format" "$subdir" "$domain")
193 eval "$cmd"
194 }
195
196 # Mirror .po files to $po_dir/.reference and copy only the new
197 # or modified ones into $po_dir. Also update $po_dir/LINGUAS.
198 # Note po files that exist locally only are left in $po_dir but will
199 # not be included in LINGUAS and hence will not be distributed.
200 update_po_files() {
201 # Directory containing primary .po files.
202 # Overwrite them only when we're sure a .po file is new.
203 po_dir=$1
204 domain=$2
205
206 # Mirror *.po files into this dir.
207 # Usually contains *.s1 checksum files.
208 ref_po_dir="$po_dir/.reference"
209
210 test -d $ref_po_dir || mkdir $ref_po_dir || return
211 download_po_files $ref_po_dir $domain \
212 && ls "$ref_po_dir"/*.po 2>/dev/null |
213 sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS" || return
214
215 langs=$(cd $ref_po_dir && echo *.po | sed 's/\.po//g')
216 test "$langs" = '*' && langs=x
217 for po in $langs; do
218 case $po in x) continue;; esac
219 new_po="$ref_po_dir/$po.po"
220 cksum_file="$ref_po_dir/$po.s1"
221 if ! test -f "$cksum_file" ||
222 ! test -f "$po_dir/$po.po" ||
223 ! $SHA1SUM -c "$cksum_file" < "$new_po" > /dev/null 2>&1; then
224 echo "$me: updated $po_dir/$po.po..."
225 cp "$new_po" "$po_dir/$po.po" \
226 && $SHA1SUM < "$new_po" > "$cksum_file" || return
227 fi
228 done
229 }
230
231 case $SKIP_PO in
232 '')
233 if test -d po; then
234 update_po_files po $package || exit
235 fi
236
237 if test -d runtime-po; then
238 update_po_files runtime-po $package-runtime || exit
239 fi;;
240 esac
241
242 # -----------------------------------------------------------------------------
243
244 bootstrap_post_pull_hook \
245 || die "bootstrap_post_pull_hook failed"
246
247 # Don't proceed if there are uninitialized submodules. In particular,
248 # autogen.sh will remove dangling links, which might be links into
249 # uninitialized submodules.
250 # But it's OK if the 'gnulib' submodule is uninitialized, as long as
251 # GNULIB_SRCDIR is set.
252 if $use_git; then
253 # Uninitialized submodules are listed with an initial dash.
254 uninitialized=`git submodule | grep '^-' | awk '{ print $2 }'`
255 if test -n "$GNULIB_SRCDIR"; then
256 uninitialized=`echo "$uninitialized" | grep -v '^gnulib$'`
257 fi
258 if test -n "$uninitialized"; then
259 die "Some git submodules are not initialized: "`echo "$uninitialized" | tr '\n' ',' | sed -e 's|,$|.|'`" Either use option '--no-git', or run 'git submodule update --init' and bootstrap again."
260 fi
261 fi
262
263 echo "$0: done. Now you can run './autogen.sh'."
264
265 # ----------------------------------------------------------------------------
266
267 # Local Variables:
268 # eval: (add-hook 'before-save-hook 'time-stamp)
269 # time-stamp-start: "scriptversion="
270 # time-stamp-format: "%:y-%02m-%02d.%02H"
271 # time-stamp-time-zone: "UTC0"
272 # time-stamp-end: "; # UTC"
273 # End: