OSDN Git Service

2001-04-10 Loren J. Rittle <ljrittle@acm.org>
[pf3gnuchains/gcc-fork.git] / maintainer-scripts / update_web_docs
1 #!/bin/sh -x
2
3 # Run this from /tmp.
4 CVSROOT=/cvs/gcc
5 export CVSROOT
6
7 PATH=/usr/local/bin:$PATH
8 WWWBASE=/www/gcc/htdocs
9
10 # Process options -rrelease and -ddirectory
11 RELEASE=""
12 SUBDIR=""
13
14 while [ $# -gt 0 ]; do
15   case $1 in
16     -r*)
17       if [ -n "$RELEASE" ]; then
18         echo "Multiple releases specified" >&2
19         exit 1
20       fi
21       RELEASE="${1#-r}"
22       if [ -z "$RELEASE" ]; then
23         shift
24         RELEASE="$1"
25         if [ -z "$RELEASE" ]; then
26           echo "No release specified with -r" >&2
27           exit 1
28         fi
29       fi
30       ;;
31     -d*)
32       if [ -n "$SUBDIR" ]; then
33         echo "Multiple subdirectories specified" >&2
34         exit 1
35       fi
36       SUBDIR="${1#-d}"
37       if [ -z "$SUBDIR" ]; then
38         shift
39         SUBDIR="$1"
40         if [ -z "$SUBDIR" ]; then
41           echo "No subdirectory specified with -d" >&2
42           exit 1
43         fi
44       fi
45       ;;
46     *)
47       echo "Unknown argument \"$1\"" >&2
48       exit 1
49       ;;
50   esac
51   shift
52 done
53
54 if [ -n "$RELEASE" ] && [ -z "$SUBDIR" ]; then
55   echo "Release specified without subdirectory" >&2
56   exit 1
57 fi
58
59 if [ -z "$SUBDIR" ]; then
60   DOCSDIR=$WWWBASE/onlinedocs
61 else
62   DOCSDIR=$WWWBASE/onlinedocs/$SUBDIR
63 fi
64
65 if [ ! -d $DOCSDIR ]; then
66   mkdir $DOCSDIR
67 fi
68
69 if [ -z "$RELEASE" ]; then
70   RELEASE=HEAD
71   DO_THANKS_HTML=y
72 else
73   DO_THANKS_HTML=n
74 fi
75
76 WORKDIR=/tmp/gcc-doc-update.$$
77
78 /bin/rm -rf $WORKDIR
79 /bin/mkdir $WORKDIR
80 cd $WORKDIR
81
82 # Find all the texi files in the repository, except those in directories
83 # we do not care about (Attic, texinfo, etc).
84 find $CVSROOT/gcc -name \*.texi,v -print | fgrep -v -f/home/gccadmin/scripts/doc_exclude | sed -e s#$CVSROOT/##g -e s#,v##g > FILES
85
86
87 # Checkout all the texi files and get them into a single directory.
88 # If we ever have texi files with the same name we'll have to do this
89 # differently.
90 cvs -Q co -r$RELEASE `cat FILES`
91 mv `find . -name \*.texi -print` .
92
93 # Now convert the relavent files from texi to html 
94 for file in c-tree cpp chill cppinternals gcc gcj gxxint g77 objc-features porting; do 
95   /usr/local/bin/texi2html -glossary -menu -split_chapter ${file}.texi
96 done
97
98 # Then build a gzipped copy of each of the resulting .html files
99 for file in *.html; do
100   cat $file | gzip --best > $file.gz
101 done
102
103 # On the 15th of the month, wipe all the old files from the
104 # web server.
105 today=`date +%d`
106 if test $today = 15; then
107   find $DOCSDIR -type f -maxdepth 1 -print | grep -v index.html | xargs rm
108 fi
109
110 # And copy the resulting html files to the web server
111 for file in *.html; do
112   cat $DOCSDIR/$file | 
113     sed -e '/^<!-- Created on/d' \
114         -e '/^by <I>GCC Administrator<\/I> on/d' > file1
115   cat $file |
116     sed -e '/^<!-- Created on/d' \
117         -e '/^by <I>GCC Administrator<\/I> on/d' > file2
118   if cmp -s file1 file2; then
119     :
120   else
121     cp $file ${file}.gz $DOCSDIR
122   fi
123 done
124
125 news_file=`grep "News About GNU Fortran" $DOCSDIR/g77_toc.html | sed -e '/HREF=.*[^.]/  s#^.*HREF="##g' | sed -e 's%#SEC.*%%g'`
126 bugs_file=`grep "Known Causes of Trouble with GNU Fortran" $DOCSDIR/g77_toc.html | sed -e '/HREF=.*[^.]/  s#^.*HREF="##g' | sed -e 's%#SEC.*%%g'`
127 contrib_file=`grep "Contributors to GCC" $DOCSDIR/gcc_toc.html | sed -e '/HREF=.*[^.]/  s#^.*HREF="##g' | sed -e 's%#SEC.*%%g'`
128
129 cd $DOCSDIR
130
131 rm -f g77_news.html
132 rm -f g77_bugs.html
133 rm -f g77_news.html.gz
134 rm -f g77_bugs.html.gz
135 ln $news_file g77_news.html
136 ln $bugs_file g77_bugs.html
137 ln ${news_file}.gz g77_news.html.gz
138 ln ${bugs_file}.gz g77_bugs.html.gz
139
140 if [ "$DO_THANKS_HTML" = y ]; then
141   cd $WWWBASE
142   rm -f thanks.html
143   rm -f thanks.html.gz
144   ln onlinedocs/$contrib_file thanks.html
145   ln onlinedocs/${contrib_file}.gz thanks.html.gz
146 fi
147
148 rm -rf $WORKDIR