summaryrefslogtreecommitdiff
path: root/build-aux/gnu-web-doc-update
blob: f6d0ee1f4e73eddb57195ac608e18d610f54badd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/bin/sh
# Run this after each non-alpha release, to update the web documentation at
# http://www.gnu.org/software/$pkg/manual/
# This script must be run from the top-level directory,
# assumes you're using git for revision control,
# and requires a .prev-version file as well as a Makefile,
# from which it extracts the version number and package name, respectively.
# Also, it assumes all documentation is in the doc/ sub-directory.

VERSION=2009-07-21.16; # UTC

# Copyright (C) 2009-2011 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 <http://www.gnu.org/licenses/>.

# Requirements: everything required to bootstrap your package,
# plus these: git, cvs, cvsu, rsync, mktemp

ME=`basename "$0"`
warn() { printf '%s: %s\n' "$ME" "$*" >&2; }
die() { warn "$*"; exit 1; }

help_version()
{
  case $1 in
    --help) cat <<EOF
Usage: $ME

Run this script (no options or arguments) after each non-alpha release,
to update the web documentation at http://www.gnu.org/software/\$pkg/manual/
Run it from your project's the top-level directory.

Options:
  --help     print this help, then exit
  --version  print version number, then exit

Report bugs and patches to <bug-gnulib@gnu.org>.
EOF
      exit ;;

    --version)
      year=`echo "$VERSION" | sed 's/[^0-9].*//'`
      cat <<EOF
$ME $VERSION
Copyright (C) $year Free Software Foundation, Inc,
License GPLv3+: GNU GPL version 3 or later <http://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.
EOF
      exit ;;

  *) die "unrecognized option: $1";;
  esac
}

case $# in
  0) ;;
  1) help_version $1 ;;
  *) die "$ME: too many options" ;;
esac

prev=.prev-version
version=$(cat $prev) || die "$ME: no $prev file?"
pkg=$(sed -n 's/^PACKAGE = \(.*\)/\1/p' Makefile) || die "$ME: no Makefile?"
tmp_branch=web-doc-$version-$$

cleanup()
{
  __st=$?;
  rm -rf "$tmp"
  git checkout master
  git branch -d $tmp_branch
  exit $__st
}
trap cleanup 0
trap 'exit $?' 1 2 13 15

# We must build using sources for which --version reports the
# just-released version number, not some string like 7.6.18-20761.
# That version string propagates into all documentation.
git checkout -b $tmp_branch v$version
ok=0
./bootstrap && ./configure && make && make web-manual && ok=1
test $ok = 1 || exit 1

tmp=$(mktemp -d --tmpdir=. web-doc-update.XXXXXX) || exit 1
( cd $tmp \
    && cvs -d $USER@cvs.sv.gnu.org:/webcvs/$pkg co $pkg )
rsync -avP doc/manual/ $tmp/$pkg/manual

(
  cd $tmp/$pkg/manual

  # Add any new files:
  cvsu --types='?'|sed s/..// | xargs --no-run-if-empty -- cvs add -ko

  cvs ci -m $version
)

# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "VERSION="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End: