maint: post-release administrivia
[libtool.git] / build-aux / edit-readme-alpha
blob4f0922d02740ed6c3c571a569eb8a3508642128d
1 #! /bin/sh
3 # edit-readme-alpha - edit README file for alpha releases
4 # Copyright (C) 2010-2019, 2021-2024 Free Software Foundation, Inc.
5 # Written by Gary V. Vaughan, 2010
7 # This file is part of GNU Libtool.
9 # GNU Libtool is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation; either version 2 of
12 # the License, or (at your option) any later version.
14 # GNU Libtool is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with GNU Libtool; see the file COPYING. If not, a copy
21 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
22 # or obtained by writing to the Free Software Foundation, Inc.,
23 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 ####
26 # We used to maintain separate (but extremely similar!) README and
27 # README.alpha files, and had 'make dist' include the right one in a
28 # distribution based on the contests of '$(VERSION)'.
30 # Now, we have 'make dist' call this script to tweak the first paragraph
31 # of README in situ, to be more suitable for an alpha quality release.
33 EXIT_SUCCESS=0
34 EXIT_FAILURE=1
36 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
37 # is ksh but when the shell is invoked as "sh" and the current value of
38 # the _XPG environment variable is not equal to 1 (one), the special
39 # positional parameter $0, within a function call, is the name of the
40 # function.
41 progpath=$0
43 # The name of this program:
44 progname=`echo "$progpath" |sed 's|^.*/||'`
47 # func_fatal_error ARG...
48 # -----------------------
49 # Echo program name prefixed message to standard error, and exit.
50 func_fatal_error ()
52 echo "$progname: $*" >&2
53 exit $EXIT_FAILURE
57 for file in "$@"; do
58 # Assume that read-only README indicates that we are running inside
59 # the latter part of a 'make distcheck'.
60 test -w "$file" || {
61 echo "$progname: not editing non-writeable '$file' (distcheck?)" >&2
62 continue
65 # Did we already in-place edited this file?
66 matched=`sed -n -e '/^This is an alpha testing release/,/a consistent, portable interface\.$/p' $file \
67 |wc -l |sed 's|^ *||'`
68 test 3 = "$matched" && {
69 echo "$progname: $file already edited" >&2
70 continue
73 # Make sure the paragraph we are matching has not been edited since
74 # this script was written.
75 matched=`sed -n -e '/^\[GNU Libtool\]\[libtool\] is/,/^consistent, portable interface\.$/p' $file \
76 |wc -l |sed 's|^ *||'`
77 test 3 = "$matched" \
78 || func_fatal_error "$file format has changed, please fix '$0'"
80 # Don't leave file droppings.
81 trap 'x=$?; rm $file.T; exit $x' 1 2 13 15
83 # Edit the first paragraph to be suitable for an alpha release.
84 sed '/^\[GNU Libtool\]\[libtool\] is/,/^consistent, portable interface\.$/c\
85 This is an alpha testing release of [GNU Libtool][libtool], a generic\
86 library support script. [Libtool][] hides the complexity of using shared\
87 libraries behind a consistent, portable interface.' $file > $file.T
89 # Diagnose redirection failure.
90 test -f "$file.T" || func_fatal_error "Unable to write $file.T"
92 # Overwrite the original file with our edited version.
93 mv $file.T $file || func_fatal_error "Unable to edit $file"
94 done
96 exit $EXIT_SUCCESS