aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorGlenn Morris2018-07-05 21:50:18 -0700
committerGlenn Morris2018-07-05 21:50:18 -0700
commit6cfc7a7b1bc3989e6d2cc271222ff7ce4eb23b5e (patch)
tree2e5620f06b5fbb8fcc289e53f5861b783af1a268 /admin
parentb73cde5e2815c531df7f5fd13e214a7d92f78239 (diff)
downloademacs-6cfc7a7b1bc3989e6d2cc271222ff7ce4eb23b5e.tar.gz
emacs-6cfc7a7b1bc3989e6d2cc271222ff7ce4eb23b5e.zip
Automate upload of Emacs manuals to gnu.org
* admin/make-manuals, admin/upload-manuals: New scripts. * admin/admin.el (make-manuals, make-manuals-dist): Handle batch mode. * admin/make-tarball.txt: Update web-page details.
Diffstat (limited to 'admin')
-rw-r--r--admin/admin.el16
-rwxr-xr-xadmin/make-manuals214
-rw-r--r--admin/make-tarball.txt18
-rwxr-xr-xadmin/upload-manuals376
4 files changed, 604 insertions, 20 deletions
diff --git a/admin/admin.el b/admin/admin.el
index dab61bb9166..3cb5dbc2d92 100644
--- a/admin/admin.el
+++ b/admin/admin.el
@@ -261,8 +261,12 @@ ROOT should be the root of an Emacs source tree."
261ROOT should be the root of an Emacs source tree. 261ROOT should be the root of an Emacs source tree.
262Interactively with a prefix argument, prompt for TYPE. 262Interactively with a prefix argument, prompt for TYPE.
263Optional argument TYPE is type of output (nil means all)." 263Optional argument TYPE is type of output (nil means all)."
264 (interactive (let ((root (read-directory-name "Emacs root directory: " 264 (interactive (let ((root
265 source-directory nil t))) 265 (if noninteractive
266 (or (pop command-line-args-left)
267 default-directory)
268 (read-directory-name "Emacs root directory: "
269 source-directory nil t))))
266 (list root 270 (list root
267 (if current-prefix-arg 271 (if current-prefix-arg
268 (completing-read 272 (completing-read
@@ -717,8 +721,12 @@ style=\"text-align:left\">")
717ROOT should be the root of an Emacs source tree. 721ROOT should be the root of an Emacs source tree.
718Interactively with a prefix argument, prompt for TYPE. 722Interactively with a prefix argument, prompt for TYPE.
719Optional argument TYPE is type of output (nil means all)." 723Optional argument TYPE is type of output (nil means all)."
720 (interactive (let ((root (read-directory-name "Emacs root directory: " 724 (interactive (let ((root
721 source-directory nil t))) 725 (if noninteractive
726 (or (pop command-line-args-left)
727 default-directory)
728 (read-directory-name "Emacs root directory: "
729 source-directory nil t))))
722 (list root 730 (list root
723 (if current-prefix-arg 731 (if current-prefix-arg
724 (completing-read 732 (completing-read
diff --git a/admin/make-manuals b/admin/make-manuals
new file mode 100755
index 00000000000..7b9f6a28718
--- /dev/null
+++ b/admin/make-manuals
@@ -0,0 +1,214 @@
1#!/bin/bash
2### make-manuals - create the Emacs manuals to upload to the gnu.org website
3
4## Copyright 2018 Free Software Foundation, Inc.
5
6## Author: Glenn Morris <rgm@gnu.org>
7
8## This file is part of GNU Emacs.
9
10## GNU Emacs is free software: you can redistribute it and/or modify
11## it under the terms of the GNU General Public License as published by
12## the Free Software Foundation, either version 3 of the License, or
13## (at your option) any later version.
14
15## GNU Emacs is distributed in the hope that it will be useful,
16## but WITHOUT ANY WARRANTY; without even the implied warranty of
17## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18## GNU General Public License for more details.
19
20## You should have received a copy of the GNU General Public License
21## along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
22
23### Commentary:
24
25## This is a helper script to create the Emacs manuals as used on the
26## gnu.org website. After this, use upload-manuals to upload them.
27##
28## Usage:
29## Call from the top-level directory of an Emacs source tree.
30## This should normally be a release.
31## The info files should exist.
32
33### Code:
34
35die () # write error to stderr and exit
36{
37 [ $# -gt 0 ] && echo "$PN: $@" >&2
38 exit 1
39}
40
41PN=${0##*/} # basename of script
42
43usage ()
44{
45 cat 1>&2 <<EOF
46Usage: ${PN} [-c] [-e emacs]
47Create the Emacs manuals for the gnu.org website.
48Call this script from the top-level of the Emacs source tree that
49contains the manuals you want to use (normally a release).
50The admin/ directory is required.
51Options:
52-c: do not delete any pre-existing $outdir/ directory
53-e: Emacs executable to use (default $emacs)
54EOF
55 exit 1
56}
57
58
59## Defaults.
60continue=
61emacs=emacs
62
63## Parameters.
64outdir=manual
65gzip="gzip --best --no-name"
66tar="tar --numeric-owner --owner=0 --group=0 --mode=go+u,go-w"
67## Requires GNU tar >= 1.28 so that the tarballs are more reproducible.
68## (Personally I think this is way OOT. I'm not even sure if anyone
69## uses these tarfiles, let alone cares whether they are reproducible.)
70tar --help | grep -- '--sort.*name' >& /dev/null && tar="$tar --sort=name"
71
72while getopts ":hce:" option ; do
73 case $option in
74 (h) usage ;;
75
76 (c) continue=t ;;
77
78 (e) emacs=$OPTARG ;;
79
80 (\?) die "Bad option -$OPTARG" ;;
81
82 (:) die "Option -$OPTARG requires an argument" ;;
83
84 (*) die "getopts error" ;;
85 esac
86done
87shift $(( --OPTIND ))
88OPTIND=1
89
90[ $# -eq 0 ] || usage
91
92
93[ -e admin/admin.el ] || die "admin/admin.el not found"
94
95
96tempfile=/tmp/$PN.$$
97trap "rm -f $tempfile 2> /dev/null" EXIT
98
99
100[ "$continue" ] || rm -rf $outdir
101
102if [ -e $outdir ]; then
103 ## Speed up repeat invocation.
104 echo "Re-using existing $outdir/ directory"
105
106else
107
108 ## This creates the manuals in a manual/ directory.
109 ## Note makeinfo >= 5 is much slower than makeinfo 4.
110 echo "Making manuals (slow)..."
111 $emacs --batch -Q -l admin/admin.el -f make-manuals \
112 >| $tempfile 2>&1 || {
113 cat $tempfile 1>&2
114
115 die "error running make-manuals"
116 }
117fi
118
119find $outdir -name '*~' -exec rm {} +
120
121
122echo "Adding compressed html files..."
123for f in emacs elisp; do
124 $tar -C $outdir/html_node -cf - $f | $gzip \
125 > $outdir/$f.html_node.tar.gz || die "error for $f"
126done
127
128
129echo "Making manual tarfiles..."
130$emacs --batch -Q -l admin/admin.el -f make-manuals-dist \
131 >| $tempfile || {
132
133 cat $tempfile 1>&2
134
135 die "error running make-manuals-dist"
136}
137
138o=$outdir/texi
139mkdir -p $o
140
141for f in $outdir/*.tar; do
142 of=${f##*/}
143 of=${of#emacs-}
144 of=${of%%-[0-9]*}.texi.tar
145 of=${of/lispintro/eintr}
146 of=${of/lispref/elisp}
147 of=${of/manual/emacs}
148 of=$o/$of
149 mv $f $of
150 $gzip $of || die "error compressing $f"
151done
152
153
154echo "Making refcards..."
155make -C etc/refcards dist >| $tempfile 2>&1 || {
156 cat $tempfile 1>&2
157 die "failed make dist"
158}
159
160## This may hang if eg german.sty is missing.
161make -k -C etc/refcards pdf >| $tempfile 2>&1 || {
162 cat $tempfile 1>&2
163 echo "Warning: ignored failure(s) from make pdf"
164}
165
166## Newer Texlive only provide mex (used by pl refcards) for pdf, AFAICS.
167make -k -C etc/refcards ps >| $tempfile 2>&1 || {
168 cat $tempfile 1>&2
169 echo "Warning: ignored failure(s) from make ps"
170}
171
172## Note that in the website, refcards/ is not a subdirectory of manual/.
173refdir=$outdir/refcards
174
175mkdir -p $refdir
176
177mv etc/refcards/emacs-refcards.tar $refdir
178$gzip $refdir/emacs-refcards.tar
179
180for fmt in pdf ps; do
181
182 o=$refdir/$fmt
183
184 mkdir -p $o
185
186 [ $fmt = pdf ] && {
187 cp etc/refcards/*.$fmt $o
188 rm $o/gnus-logo.pdf
189 continue
190 }
191
192 for f in etc/refcards/*.$fmt; do
193 $gzip < $f > $o/${f##*/}.gz
194 done
195done
196
197make -C etc/refcards extraclean > /dev/null
198
199
200echo "Adding compressed info files..."
201
202o=$outdir/info
203mkdir -p $o
204
205for f in eintr.info elisp.info emacs.info; do
206
207 $gzip < info/$f > $o/$f.gz || die "error for $f"
208done
209
210
211echo "Finished OK, you might want to run upload-manuals now"
212
213
214exit 0
diff --git a/admin/make-tarball.txt b/admin/make-tarball.txt
index 6d6312c9b1b..092027d1e2a 100644
--- a/admin/make-tarball.txt
+++ b/admin/make-tarball.txt
@@ -203,22 +203,8 @@ For every new release, a banner is displayed on top of the emacs.html
203page. Uncomment and the release banner in emacs.html. Keep it on the 203page. Uncomment and the release banner in emacs.html. Keep it on the
204page for about a month, then comment it again. 204page for about a month, then comment it again.
205 205
206Use M-x make-manuals from admin/admin.el to regenerate the html 206Regenerate the various manuals in manual/.
207manuals in manual/. If there are new manuals, add appropriate index 207The scripts admin/make-manuals and admin/upload-manuals summarize the process.
208pages in manual/ and add them to manual/index.html. In the
209manual/html_node directory, delete any old manual pages that are no
210longer present.
211
212Tar up the generated html_node/emacs/ and elisp/ directories and update
213the files manual/elisp.html_node.tar.gz and emacs.html_node.tar.gz.
214
215Use M-x make-manuals-dist from admin/admin.el to update the
216manual/texi/ tarfiles.
217
218Add compressed copies of the main info pages from the tarfile to manual/info/.
219
220Update the refcards/pdf/ and ps/ directories, and also
221refcards/emacs-refcards.tar.gz (use make -C etc/refcards pdf ps dist).
222 208
223Browsing <https://web.cvs.savannah.gnu.org/viewvc/?root=emacs> is one 209Browsing <https://web.cvs.savannah.gnu.org/viewvc/?root=emacs> is one
224way to check for any files that still need updating. 210way to check for any files that still need updating.
diff --git a/admin/upload-manuals b/admin/upload-manuals
new file mode 100755
index 00000000000..1aa7d8be32d
--- /dev/null
+++ b/admin/upload-manuals
@@ -0,0 +1,376 @@
1#!/bin/bash
2
3### upload-manuals - upload the Emacs manuals to the gnu.org website
4
5## Copyright 2018 Free Software Foundation, Inc.
6
7## Author: Glenn Morris <rgm@gnu.org>
8
9## This file is part of GNU Emacs.
10
11## GNU Emacs is free software: you can redistribute it and/or modify
12## it under the terms of the GNU General Public License as published by
13## the Free Software Foundation, either version 3 of the License, or
14## (at your option) any later version.
15
16## GNU Emacs is distributed in the hope that it will be useful,
17## but WITHOUT ANY WARRANTY; without even the implied warranty of
18## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19## GNU General Public License for more details.
20
21## You should have received a copy of the GNU General Public License
22## along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
23
24### Commentary:
25
26## Run this on the output of make-manuals.
27
28## We assume you have already checked out a local copy of the website
29## following the instructions at
30## https://savannah.gnu.org/cvs/?group=emacs
31
32## Usage:
33## Call from the manual/ directory created by make-manual.
34## upload-manuals /path/to/cvs/checkout
35
36### Code:
37
38
39die () # write error to stderr and exit
40{
41 [ $# -gt 0 ] && echo "$PN: $@" >&2
42 exit 1
43}
44
45PN=${0##*/} # basename of script
46
47usage ()
48{
49 cat 1>&2 <<EOF
50Usage: ${PN} [-m message] [-n] /path/to/cvs/checkout
51Upload the Emacs manuals to the gnu.org website.
52Call this script from the manual/ directory created by make-manuals.
53This script destructively modifies the source directory.
54Options:
55-m: commit message to use (default "$message")
56-n: dry-run (do not commit files)
57EOF
58 exit 1
59}
60
61
62## Parameters
63version=$(gunzip -c info/emacs.info.gz 2> /dev/null | sed -n '0,/updated for Emacs version/s/.*updated for Emacs version \([0-9.]*\).*\.$/\1/p')
64
65## Defaults
66cvs=cvs
67message="Regenerate manuals for Emacs $version"
68umessage=
69
70while getopts ":hm:n" option ; do
71 case $option in
72 (h) usage ;;
73
74 (m) umessage=t ; message="$OPTARG" ;;
75
76 (n) cvs="echo $cvs" ;;
77
78 (\?) die "Bad option -$OPTARG" ;;
79
80 (:) die "Option -$OPTARG requires an argument" ;;
81
82 (*) die "getopts error" ;;
83 esac
84done
85shift $(( --OPTIND ))
86OPTIND=1
87
88[ $# -eq 1 ] || usage
89
90[ "$version$umessage" ] || \
91 die "Could not get version to use for commit message"
92
93webdir=$1
94
95[ -e $webdir/CVS/Entries ] && [ -e $webdir/refcards/pdf/refcard.pdf ] || \
96 die "$webdir does not look like a checkout of the Emacs webpages"
97
98[ -e html_mono/emacs.html ] && [ -e html_node/emacs/index.html ] || \
99 die "Current directory does not like the manual/ directory"
100
101
102echo "Doing refcards..."
103
104mv refcards/emacs-refcards.tar.gz $webdir/refcards/
105(
106 cd $webdir/refcards
107 $cvs commit -m "$message" emacs-refcards.tar.gz || die "commit error"
108)
109
110## For refcards, we assume a missing file is due to a tex failure,
111## rather than a refcard that should be deleted.
112for fmt in pdf ps.gz; do
113
114 clist=
115
116 for f in $webdir/refcards/${fmt%.gz}/*.$fmt; do
117
118 s=${f#$webdir/}
119
120 if [ -e $s ]; then
121 mv $s $f
122 clist="$clist ${f##*/}"
123 else
124 echo "$s seems to be missing"
125 fi
126 done
127
128
129 ## Check for new files.
130 new=
131 for f in refcards/${fmt%.gz}/*.$fmt; do
132 [ -e $f ] || break
133 new="$new $f"
134 clist="$clist ${f##*/}"
135 done
136
137 [ "$new" ] && mv $new $webdir/refcards/${fmt%.gz}/
138
139 [ "$clist" ] && (
140 cd $webdir
141 [ "$new" ] && {
142 echo "Adding new files: $new"
143 $cvs add -kb $new || die "add error"
144 echo "Remember to add new refcards to refcards/index.html"
145 }
146 cd refcards/${fmt%.gz}
147 $cvs commit -m "$message" $clist || die "commit error"
148 )
149
150done # $fmt
151
152
153echo "Doing non-html manuals..."
154
155for fmt in info pdf ps texi; do
156
157 clist=
158
159 for f in $webdir/manual/$fmt/*; do
160
161 [ ${f##*/} = CVS ] && continue
162
163 s=$fmt/${f##*/}
164
165 if [ -e $s ]; then
166 mv $s $f
167 clist="$clist ${f##*/}"
168 else
169 case ${f##*/} in
170 *_7x9*.pdf) continue ;;
171 esac
172
173 echo "$s seems to be missing"
174 fi
175 done
176
177 ## Check for new files.
178 new=
179 for f in $fmt/*.$fmt*; do
180 [ -e $f ] || break
181 new="$new $f"
182 clist="$clist ${f##*/}"
183 done
184
185 [ "$new" ] && mv $new $webdir/manual/$fmt/
186
187 [ "$clist" ] && (
188 cd $webdir/manual
189 [ "$new" ] && {
190 echo "Adding new files: $new"
191 $cvs add $new || die "add error"
192 echo "Remember to add new files to the appropriate index pages"
193 }
194 cd $fmt
195 $cvs commit -m "$message" $clist || die "commit error"
196 )
197
198done
199
200
201echo "Doing tarred html..."
202
203clist=
204
205for f in $webdir/manual/*html*.tar*; do
206
207 s=${f##*/}
208
209 if [ -e $s ]; then
210 mv $s $f
211 clist="$clist ${f##*/}"
212 else
213 echo "$s seems to be missing"
214 fi
215done
216
217## Check for new files.
218new=
219for f in *html*.tar*; do
220 [ -e $f ] || break
221 new="$new $f"
222 clist="$clist ${f##*/}"
223done
224
225[ "$new" ] && mv $new $webdir/manual
226
227[ "$clist" ] && (
228 cd $webdir/manual
229 [ "$new" ] && {
230 echo "Adding new files: $new"
231 $cvs add -kb $new || die "add error"
232 echo "Remember to add new files to the appropriate index pages"
233 }
234 $cvs commit -m "$message" $clist || die "commit error"
235)
236
237
238## This happens so rarely it would be less effort to do by hand...
239new_manual () {
240 local t=eww
241 local i=$webdir/manual/$t.html # template
242
243 [ -r $i ] || die "Cannot read template $i"
244
245 local name o mono title
246
247 for name; do
248
249 name=${name##*/}
250 name=${name%.html}
251
252 o=$webdir/manual/$name.html
253
254 [ -e $o ] && die "$o already exists"
255
256 mono=$webdir/manual/html_mono/$name.html
257
258 [ -r $mono ] || die "Cannot read $mono"
259
260 title=$(sed -n 's|^<title>\(.*\)</title>|\1|p' $mono)
261
262 : ${title:?}
263
264 echo "$title" | grep -qi "Emacs" || title="Emacs $title"
265 echo "$title" | grep -qi "manual" || title="$title Manual"
266
267 ## It is a pain to extract and insert a good "documenting...".
268 ## Improve it by hand if you care.
269 sed -e "s|^<title>.*\( - GNU Project\)|<title>$title\1|" \
270 -e "s|^<h2>.*|<h2>$title</h2>|" \
271 -e "s/^documenting.*/documenting \"$title\"./" \
272 -e "s/$t/$name/" \
273 -e "s/&copy;.* Free/\&copy; $(date +%Y) Free/" $i > $o
274
275 (
276 cd $webdir/manual
277 $cvs add ${o##*/} || die "add error for $o"
278 )
279 done
280
281 return 0
282}
283
284
285echo "Doing html_mono..."
286
287clist=
288
289for f in $webdir/manual/html_mono/*.html; do
290
291 s=${f##*manual/}
292
293 if [ -e $s ]; then
294 mv $s $f
295 clist="$clist ${f##*/}"
296 else
297 echo "$s seems to be missing"
298 fi
299done
300
301## Check for new files.
302new=
303for f in html_mono/*.html; do
304 [ -e $f ] || break
305 new="$new $f"
306 clist="$clist ${f##*/}"
307done
308
309[ "$new" ] && mv $new $webdir/manual/html_mono/
310
311## TODO: check for removed manuals.
312
313[ "$clist" ] && (
314 cd $webdir/manual/html_mono
315 [ "$new" ] && {
316 echo "Adding new files: $new"
317 $cvs add $new || die "add error"
318 new_manual $new || die
319 echo "Remember to add new entries to manual/index.html"
320 }
321 $cvs commit -m "$message" $clist || die "commit error"
322)
323
324
325echo "Doing html_node..."
326
327for d in html_node/*; do
328
329 [ -e $d ] || break
330
331 echo "Doing $d..."
332
333 [ -e $webdir/manual/$d ] || {
334 echo "New directory: $d"
335 mkdir $webdir/manual/$d
336 $cvs add $webdir/manual/$d || die "add error"
337 }
338
339 new=
340 for f in $d/*.html; do
341 [ -e $webdir/manual/$f ] || new="$new ${f##*/}"
342 done
343
344 stale=
345 for f in $webdir/manual/$d/*.html; do
346 [ -e ${f#$webdir/manual/} ] || stale="$stale ${f##*/}"
347 done
348
349 mv $d/*.html $webdir/manual/$d/
350
351 (
352 cd $webdir/manual/$d
353 [ "$new" ] && {
354 echo "Adding new files: $new"
355 $cvs add $new || die "add error"
356 }
357
358 [ "$stale" ] && {
359 echo "Removing stale files: $stale"
360 $cvs remove -f $stale || die "remove error"
361 }
362
363 ## -f: create a new revision even if no change.
364 $cvs commit -f -m "$message" *.html $stale || die "commit error"
365 )
366
367done
368
369
370echo "Checking for stray files..."
371find -type f
372
373
374echo "Finished"
375
376exit 0