Merge remote-tracking branch 'origin/lexical-literals'
[bpt/guile.git] / build-aux / gnu-web-doc-update
CommitLineData
c84bdaf6
LC
1#!/bin/sh
2# Run this after each non-alpha release, to update the web documentation at
3# http://www.gnu.org/software/$pkg/manual/
4# This script must be run from the top-level directory,
5# assumes you're using git for revision control,
6# and requires a .prev-version file as well as a Makefile,
7# from which it extracts the version number and package name, respectively.
8# Also, it assumes all documentation is in the doc/ sub-directory.
9
10VERSION=2009-07-21.16; # UTC
11
49114fd4 12# Copyright (C) 2009-2011 Free Software Foundation, Inc.
c84bdaf6
LC
13
14# This program is free software: you can redistribute it and/or modify
15# it under the terms of the GNU General Public License as published by
16# the Free Software Foundation, either version 3 of the License, or
17# (at your option) any later version.
18
19# This program is distributed in the hope that it will be useful,
20# but WITHOUT ANY WARRANTY; without even the implied warranty of
21# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22# GNU General Public License for more details.
23
24# You should have received a copy of the GNU General Public License
25# along with this program. If not, see <http://www.gnu.org/licenses/>.
26
27# Requirements: everything required to bootstrap your package,
28# plus these: git, cvs, cvsu, rsync, mktemp
29
30ME=`basename "$0"`
31warn() { printf '%s: %s\n' "$ME" "$*" >&2; }
32die() { warn "$*"; exit 1; }
33
34help_version()
35{
36 case $1 in
37 --help) cat <<EOF
38Usage: $ME
39
40Run this script (no options or arguments) after each non-alpha release,
41to update the web documentation at http://www.gnu.org/software/\$pkg/manual/
42Run it from your project's the top-level directory.
43
44Options:
45 --help print this help, then exit
46 --version print version number, then exit
47
48Report bugs and patches to <bug-gnulib@gnu.org>.
49EOF
50 exit ;;
51
52 --version)
53 year=`echo "$VERSION" | sed 's/[^0-9].*//'`
54 cat <<EOF
55$ME $VERSION
56Copyright (C) $year Free Software Foundation, Inc,
57License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
58This is free software: you are free to change and redistribute it.
59There is NO WARRANTY, to the extent permitted by law.
60EOF
61 exit ;;
62
63 *) die "unrecognized option: $1";;
64 esac
65}
66
67case $# in
68 0) ;;
69 1) help_version $1 ;;
70 *) die "$ME: too many options" ;;
71esac
72
73prev=.prev-version
74version=$(cat $prev) || die "$ME: no $prev file?"
75pkg=$(sed -n 's/^PACKAGE = \(.*\)/\1/p' Makefile) || die "$ME: no Makefile?"
76tmp_branch=web-doc-$version-$$
77
78cleanup()
79{
80 __st=$?;
81 rm -rf "$tmp"
82 git checkout master
83 git branch -d $tmp_branch
84 exit $__st
85}
86trap cleanup 0
87trap 'exit $?' 1 2 13 15
88
89# We must build using sources for which --version reports the
90# just-released version number, not some string like 7.6.18-20761.
91# That version string propagates into all documentation.
92git checkout -b $tmp_branch v$version
a927b6c1
LC
93ok=0
94./bootstrap && ./configure && make && make web-manual && ok=1
95test $ok = 1 || exit 1
c84bdaf6
LC
96
97tmp=$(mktemp -d --tmpdir=. web-doc-update.XXXXXX) || exit 1
98( cd $tmp \
99 && cvs -d $USER@cvs.sv.gnu.org:/webcvs/$pkg co $pkg )
100rsync -avP doc/manual/ $tmp/$pkg/manual
101
102(
103 cd $tmp/$pkg/manual
104
105 # Add any new files:
106 cvsu --types='?'|sed s/..// | xargs --no-run-if-empty -- cvs add -ko
107
108 cvs ci -m $version
109)
110
111# Local variables:
112# eval: (add-hook 'write-file-hooks 'time-stamp)
113# time-stamp-start: "VERSION="
114# time-stamp-format: "%:y-%02m-%02d.%02H"
115# time-stamp-time-zone: "UTC"
116# time-stamp-end: "; # UTC"
117# End: