removed obsolete issues (many of them fixed with AE)
[docutils.git] / sandbox / davidg / infrastructure / docutils-update
blob00bd1df967d25e2184e5f711a4db32bb41fc4557
1 #! /bin/sh
2 # $Id$
4 # This script is installed as a cron job to automatically update the
5 # Docutils web site whenever the CVS files change. Any .html document
6 # with a corresponding .txt file is regenerated whenever the .txt
7 # changes.
9 # Options:
10 # -e Access CVS as current user ("ext" instead of "pserver"; requires
11 # authentication).
12 # -p Run from the project directory.
13 # -t Run the script in trace mode ("set -o xtrace").
14 # -u Regenerate .html unconditionally.
15 # -v Run verbosely.
17 # exit on error
18 set -e
20 # make all newly created files group writeable
21 umask 002
23 projdir=/home/groups/d/do/docutils
24 project=docutils
25 dest=$projdir/htdocs
26 snapshotdir=$projdir/snapshots
27 pylib=$projdir/lib/python
28 lib=$pylib/$project
29 root=
31 export CVS_RSH=ssh
32 export CVSROOT=:pserver:anonymous@cvs1:/cvsroot/$project
34 trace=0
35 unconditional=0
36 verbose=0
38 while getopts eptuv opt
40 case $opt in
41 e) root="-d:ext:${USER}@cvs1:/cvsroot/docutils" ;;
42 p) export PYTHONPATH=$pylib:$lib:$lib/extras;;
43 t) trace=1;;
44 u) unconditional=1;;
45 v) verbose=1;;
46 \?) exit 2;;
47 esac
48 done
49 shift `expr $OPTIND - 1`
51 if [ $trace -eq 1 -o $verbose -eq 1 ] ; then
52 set -o xtrace
55 # update library area
56 cd $lib
57 cvs -Q -z3 $root update 2>&1 > /dev/null
59 # gather the materials
60 cd $snapshotdir
61 cvs -Q -z3 $root update -rHEAD $project sandbox web
63 # ensure proper permissions are set
64 find . -type f -print0 | xargs -0 chmod ug+rw 2> /dev/null || true
65 find . -type d -print0 | xargs -0 chmod ug+rwxs 2> /dev/null || true
67 # ensure executable bits are set
68 chmod +x $project/*.py 2> /dev/null || true
69 chmod +x $project/tools/*.py 2> /dev/null || true
70 chmod +x $project/test/alltests.py 2> /dev/null || true
71 find $project/test -name 'test_*.py' -print0 | xargs -0 chmod +x 2> /dev/null || true
73 # create the snapshots
74 exclude='--exclude=CVS --exclude=.cvsignore'
75 tar -cz $exclude -f $project-snapshot.tgz $project
76 tar -cz $exclude -f $project-sandbox-snapshot.tgz sandbox
77 tar -cz $exclude -f $project-web-snapshot.tgz web
78 ( cd sandbox/gschwant ;
79 tar -cz $exclude -f ../../docfactory-snapshot.tgz docfactory )
81 # plant the snapshots
82 mv -f *snapshot.tgz $dest
84 # update htdocs
85 cp -ruf $project/* $dest
86 cp -ruf sandbox $dest
87 cp -ruf web/* web/.[^.]* $dest
89 # remove CVS crud
90 cd $dest
91 find -name CVS -type d -exec rm -rf {} \; -prune
92 find -name .cvsignore -type f -exec rm -f {} \; -prune
94 # ensure proper permissions are set
95 cd $dest
96 find . -type f -print0 | xargs -0 chmod ug+rw 2> /dev/null || true
97 find . -type d -print0 | xargs -0 chmod ug+rwxs 2> /dev/null || true
99 # update HTML docs
100 cd $dest/tools
102 if [ $trace -eq 0 ] ; then
103 set +o xtrace
106 for htmlfile in `find .. -name '*.html'` ; do
107 dir=`dirname $htmlfile`
108 base=`basename $htmlfile .html`
109 txtfile=$dir/$base.txt
110 if [ -e $txtfile ] ; then
111 if [ $unconditional -eq 1 -o $txtfile -nt $htmlfile ] ; then
112 if [ "${base:0:4}" == "pep-" ] ; then
113 echo "$txtfile (PEP)"
114 # pep2html.py fails on SourceForge; can't import cgi
115 # (cgi imports urllib which imports socket which imports
116 # _socket; libssl.so.2 doesn't exist on SF):
117 ~/bin/python $lib/tools/pep.py --config=$dir/docutils.conf $txtfile $htmlfile
118 else
119 echo $txtfile
120 ~/bin/python $lib/tools/rst2html.py --config=$dir/docutils.conf $txtfile $htmlfile
124 done
126 # Local Variables:
127 # indent-tabs-mode: nil