source: trunk/SRC/Documentation/xmldoc/savesaxo.sh @ 176

Last change on this file since 176 was 176, checked in by smasson, 18 years ago

Update xml documentation files

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 18.0 KB
Line 
1#!/bin/bash
2#
3# update :
4# $Id$
5# smasson Wed Sep 13 14:18:02 CEST 2006
6# add the directory-overview.html from dir-files.html in idldoc_html_output
7# fplod 2006-09-07T08:09:47Z aedon.locean-ipsl.upmc.fr (Darwin)
8# main is rename to websaxo
9# fplod 2006-09-05T15:39:47Z aedon.locean-ipsl.upmc.fr (Darwin)
10# add Source link in idldoc html outpout
11# snlod/fplod 2006-08-25T08:30:36Z electre.locean-ipsl.upmc.fr (Darwin)
12# add for idldoc assistant
13# fplod 2006-08-17T09:19:06Z aedon.locean-ipsl.upmc.fr (Darwin)
14# add transformation after idldoc to force non-proportionnal font
15# on bloc delimited by
16#  <fixe>
17#  </fixe>
18# in .pro files (with modification of css)
19# !! do not replace \ by \\ inside this block
20# !! replace \ by an other character is a good idea
21# cf. example in ToBeReviewed/TRIANGULATION/definetri.pro
22# fplod 2006-07-21T08:23:52Z aedon.locean-ipsl.upmc.fr (Darwin)
23# add mini_notice production
24# fplod 2006-07-11T08:26:05Z aedon.locean-ipsl.upmc.fr (Darwin)
25# commented tidy in dohtml section is moved in makehtml
26# fplod 2006-07-10T08:22:53Z aedon.locean-ipsl.upmc.fr (Darwin)
27# ajout de  white-space: pre; dans la css pour file_comments
28# fplod 2006-07-04T13:09:19Z aedon.locean-ipsl.upmc.fr (Darwin)
29# for idldoc html output
30# because preformat option doesn't seem to work well
31# replace
32# div class="value"
33# by
34# div class="preformat"
35# fplod 2006-06-19T08:46:39Z aedon.locean-ipsl.upmc.fr (Darwin)
36# for idldoc html output
37#. replace
38#     -e 's/\(href=".*\)\(\.html\)\("\)/\1\2?format=raw\3/g' \
39#     -e 's/\(href=".*\)\(\.html\)\(#.*"\)/\1\2?format=raw\3/g' \
40#     -e 's/\(src=".*\)\(\.html\)\("\)/\1\2?format=raw\3/g' \
41# by
42# -e 's@\(href="[^.]*[^h]*[^t]*[^m]*[^l]*[^"]*\)\(\.html\)\("\)@\1\2?format=raw\3@g' \
43# -e 's@\(href="[^.]*[^h]*[^t]*[^m]*[^l]*[^"]*\)\(\.html\)\(#.*"\)@\1\2?format=raw\3@g' \
44#-e 's@\(src="[^.]*[^h]*[^t]*[^m]*[^l]*[^"]*\)\(\.html\)\("\)@\1\2?format=raw\3@g'
45# in order to be able to add ?format=raw several time on one line
46# . suppress .html in line like
47# a parameter from the routine ./ReadWrite/idl-NetCDF/ncdf_read.html
48# in files idldoc-index*.html
49# fplod 2006-06-14T12:41:37Z aedon.locean-ipsl.upmc.fr (Darwin)
50# add embed paramater idldoc instructions to try to fix ticket#17
51# fplod 2006-06-07T12:11:50Z aedon.locean-ipsl.upmc.fr (Darwin)
52# add g option in ?format=raw sed transformation in order to fix
53# link on top of idldoc like directory-overview.html
54# fplod 2006-06-07T10:57:35Z aedon.locean-ipsl.upmc.fr (Darwin)
55# add ?format=raw in idldoc production for frames
56# fplod 2006-06-07T08:14:15Z aedon.locean-ipsl.upmc.fr (Darwin)
57# add action for idldochtml
58# fplod 2006-06-02T14:28:30Z aedon.locean-ipsl.upmc.fr (Darwin)
59# modification to produce tar files in /tmp/saxo_${$} when dotar=1
60# modification to copy tar files on http://forge.ipsl.jussieu.fr/saxo/download/
61# when doforge=1
62# produce tar files in /tmp/saxo_${$} when dotar=1
63set -x
64set -u
65#
66docompileall=1
67dohtml=0
68dooldtest=0
69doidlwavedoc=0
70doidldoc_html=0
71doidldoc_assistant=0
72doTARsrc=0
73doTARdata=0
74doforge=0
75doSRClodyc=0
76doDTAlodyc=0
77doSRCipsl=0
78doDTAipsl=0
79doSRCidris=0
80doDTAidris=0
81#
82case $( whoami ) in
83    smasson)
84        lgforge=smasson
85    ;;
86    floseb)
87        lgforge=smasson
88    ;;
89    *)
90        lgforge=saxo
91    ;;
92esac
93#
94if [ ${lgforge} != smasson ]
95then
96    doSRClodyc=0
97    doDTAlodyc=0
98    doSRCipsl=0
99    doDTAipsl=0
100    doSRCidris=0
101    doDTAidris=0
102fi   
103#
104# get the date in a nice format
105#
106ndate=`date +%Y%m%d`
107# memorize current directory
108memopwd=$(pwd) # should be <working space>/SRC/Documentation/xmldoc
109#
110#------------------------------------------------------------------
111if [ ${docompileall} -eq 1 ]
112    then
113    cat <<EOF > /tmp/compileall${$}.pro
114.reset_session 
115;
116!path = expand_path('+' + '../..') + ':' + expand_path('+' + !dir)
117resolve_all, resolve_either='def_myuniquetmpdir', skip_routines = ['xxx2ps','trends', 'label_gmt']
118resolve_all, resolve_either = 'find', skip_routines = ['xxx2ps','trends', 'label_gmt']
119def_myuniquetmpdir
120oldcm = find('oldcm_empty')
121;oldcm = find('oldcm_full')
122oldcm = oldcm[0]
123@cm_general
124file_copy, oldcm, myuniquetmpdir + 'oldcm_used.pro', /overwrite
125IF !journal NE 0 THEN journal
126journal, myuniquetmpdir + 'cm_demomode_used.pro'
127journal   
128;
129resolve_all, resolve_either='keep_compatibility', skip_routines = ['xxx2ps','trends', 'label_gmt']
130;
131EOF
132#
133    for i in $( find ${memopwd}/../.. -name "*.pro" | grep -iv label_gmt )
134      do
135# does it contains pro or function ?
136      egrep -iq '^ *    *(pro|function)' $i
137      if [ $? -eq 0 ]
138          then
139          echo "print, '$( basename $i .pro ) :'" >> /tmp/compileall${$}.pro
140          echo "resolve_all, resolve_either = '$( basename $i .pro )', skip_routines = ['xxx2ps','trends', 'label_gmt']" >> /tmp/compileall${$}.pro
141      fi
142    done
143    echo exit >> /tmp/compileall${$}.pro
144    IDL_STARTUP=/tmp/compileall${$}.pro
145    ${IDL_DIR}/bin/idl &> /tmp/compileallerr_${$}
146    echo
147    echo
148    grep -i "error" /tmp/compileallerr_${$}
149#    grep -q "Compilation error(s)" /tmp/compileallerr_${$}
150    if [ ${?} -ne 0 ]
151    then
152     echo "ALL SAXO files are OK..."
153     rm -f /tmp/compileallerr_${$} /tmp/compileall${$}.pro
154    else
155     grep "Compilation error(s)" /tmp/compileallerr_${$}
156     echo "eee : see /tmp/compileallerr_${$}"
157     more /tmp/compileallerr_${$}
158     exit 1
159    fi
160    echo
161    echo
162fi
163#------------------------------------------------------------------
164if [ ${dohtml} -eq 1 ]
165then
166#
167# redo the html file
168#
169    cd ${memopwd}
170    for docxml in firststeps.xml getsaxo.xml mailing.xml websaxo.xml tiplink.xml updatesaxo.xml whatissaxo.xml whatsnew.xml infoupdatekwd.xml infoupdatecm.xml mini_notice.xml
171    do
172      ./makehtml.sh $(basename ${docxml} .xml)
173    done
174    exit 0
175fi
176#------------------------------------------------------------------
177if [ ${dooldtest} -eq 1 ]
178then
179# make the old test
180#
181    cd ${memopwd}/../../Tests/
182    ./makeold.sh
183    exit 0
184fi
185#------------------------------------------------------------------
186if  [ ${doidlwavedoc} -eq 1 ]
187then
188#
189# redo idlwave doc
190#
191    cd ${memopwd}/../..
192    Documentation/idlwave_catalog -v -f saxo
193    exit 0
194fi
195#------------------------------------------------------------------
196if  [ ${doidldoc_html} -eq 1 ]
197then
198#
199    # build a idl file to launch idldoc
200    output=../idldoc_html_output/
201    log="/tmp/idldochtlm_${$}.log"
202    pro="/tmp/idldochtlm_${$}.pro"
203    cat <<EOF > ${pro}
204!path = expand_path('+' + '../idldoc/')
205print,!path
206idldoc,root="../../",title="SAXO Documentation", $
207LOG_FILE="${log}", $
208output="${output}", $
209overview="../../overview", /statistics, /preformat, /embed
210exit
211EOF
212    # launch idl with the file built above
213    IDL_STARTUP=${pro};${IDL_DIR}/bin/idl
214    /bin/rm ${pro}
215    # In order to do not have to many revision in svn, we modify some
216    # lines produced by idldoc :
217    # - add Source link in each html file
218    # example :
219    # <td>Source</td>
220    # will be replaced by
221    # <td><a href="../../Calendar/caldat.pro?format=raw" title="Source code of a file">Source</a></td>
222    #
223    # - remove date and time of idldoc production
224    # examples :
225    # <!-- Generated by IDLdoc 2.0 on Wed Jun  7 10:25:28 2006 -->
226    # will be replaced by
227    # <!-- Generated by IDLdoc 2.0 -->
228    # <div id="tagline">Produced by IDLdoc 2.0 on Wed Jun  7 10:54:37 2006.</div
229    # will be replaced by
230    # <div id="tagline">Produced by IDLdoc 2.0</div>
231    # <h2>Produced on Wed Jun  7 10:23:13 2006</h2>
232    # will be delete
233    # other lines will be deleted because the time is the time of checkout not
234    # the time of revision.
235    # the sequence of lines
236    #<dl>
237    #      <dt>Last modification:</dt>
238    #       <dd>Fri Jun  2 11:46:24 2006</dd>
239    #    </dl>
240    # should also be removed ++ je ne sais pas dire en sed la ligne
241    # suivant l'occurence de Last modification
242    # add ?format=raw to links on html files
243    cat << EOF > /tmp/css_modification
244p.preformat {
245  font-family: Courier;
246}
247EOF
248    # count of directory levels in output
249    # this ount will be use to format relative path later
250    nblev1=$(echo ${output} | sed -e "s@/\$@@" |awk -F "/" '{print NF}')
251    #
252    list_html=$(find ${output} -name "*.html")
253    for file_html in ${list_html}
254    do
255     # buil the .pro file name
256     bfile=$(basename ${file_html} .html)
257     # retrieve the path of html file relative to memopwd (so relative to
258     # output). This path will be used in "Source" link.
259     nblev2=$(dirname ${file_html} |  sed -e "s@/\$@@" | awk -F "/" '{print NF}')
260     difflev=$((${nblev2} - ${nblev1}))
261     if [ ${difflev} -ge 2 ]
262     then
263      ilev=1
264      reloutput_html=".."
265      while [ ${ilev} -le ${difflev} ]
266      do
267       reloutput_html="${reloutput_html}/.."
268       ilev=$(( ${ilev} + 1 ))
269      done
270      relpath_html=$(dirname ${file_html} | \
271                   sed -e "s@${output}@${reloutput_html}@" \
272                       -e "s@\$@/@")
273      echo "relpath ${relpath_html})"
274     else
275      relpath_html="./"
276     fi
277     # echo "relpath ${relpath_html}/${bfile}"
278     sed \
279     -e "s@<td >Source<\/td>@<td><a href=\"${relpath_html}/${bfile}.pro?format=raw\" title=\"Source code of a file\">Source<\/a><\/td>@" \
280     -e "s/\(Generated by IDLdoc 2.0\)\( on .*\)\( -->\)/\1\3/" \
281     -e "s/\(Produced by IDLdoc 2.0\)\( on .*\)\(\.<\/div>\)/\1\3/" \
282     -e "/<h2>Produced on/d" \
283     -e "/Last modification:/d" \
284     -e "/<dd>... ... .* ..:..:.. ....<\/dd>/d" \
285     -e 's@\(href="[^.]*[^h]*[^t]*[^m]*[^l]*[^"]*\)\(\.html\)\("\)@\1\2?format=raw\3@g' \
286     -e 's@\(href="[^.]*[^h]*[^t]*[^m]*[^l]*[^"]*\)\(\.html\)\(#.*"\)@\1\2?format=raw\3@g' \
287     -e 's@\(src="[^.]*[^h]*[^t]*[^m]*[^l]*[^"]*\)\(\.html\)\("\)@\1\2?format=raw\3@g' \
288     -e 's@<div class="value">@<div class="preformat">@' \
289     -e 's/div\#file_comments {/div\#file_comments { white-space: pre;/' \
290     -e 's@^ <fixe>@<p class="preformat">@' \
291     -e 's@^ </fixe>@</p>@' \
292     -e '/Main styles/r /tmp/css_modification' \
293     ${file_html} > ${file_html}_modify
294     mv ${file_html}_modify ${file_html}
295    done
296    rm /tmp/css_modification
297    # suppress ".html" in idldoc-index*.html in lines like
298    # a parameter from the routine ./ReadWrite/idl-NetCDF/ncdf_read.html
299    list_html=$(find ${output} -name "idldoc-index*.html")
300    for file_html in ${list_html}
301    do
302     sed \
303     -e "s/\(a parameter from the routine \)\(.*\)\(.html\)/\1\2/" \
304     ${file_html} > ${file_html}_modify
305     mv ${file_html}_modify ${file_html}
306    done
307    echo "iii : you can see log file in ${log}"
308    echo "iii : and look ${output}/idldoc-warnings.html#undoc"
309fi
310#------------------------------------------------------------------
311if  [ ${doidldoc_assistant} -eq 1 ]
312then
313#
314    # build a idl file to launch idldoc
315    output=../idldoc_assistant_output/
316    log="/tmp/idldocassistant_${$}.log"
317    pro="/tmp/idldocassistant_${$}.pro"
318    cat <<EOF > ${pro}
319!path = expand_path('+' + '../idldoc/')
320print,!path
321idldoc,root="../../",title="SAXO Documentation Assistant", $
322LOG_FILE="${log}", $
323output="${output}", overview='../../overview', /statistics, /preformat, /embed, /assistant
324exit
325EOF
326    # launch idl with the file built above
327    IDL_STARTUP=${pro};${IDL_DIR}/bin/idl
328    /bin/rm ${pro}
329    # In order to do not have to many revision in svn, we modify some
330    # lines produced by idldoc :
331    # examples :
332    # <!-- Generated by IDLdoc 2.0 on Wed Jun  7 10:25:28 2006 -->
333    # will be replaced by
334    # <!-- Generated by IDLdoc 2.0 -->
335    # <div id="tagline">Produced by IDLdoc 2.0 on Wed Jun  7 10:54:37 2006.</div
336    # will be replaced by
337    # <div id="tagline">Produced by IDLdoc 2.0</div>
338    # <h2>Produced on Wed Jun  7 10:23:13 2006</h2>
339    # will be delete
340    # other lines will be deleted because the time is the time of checkout not
341    # the time of revision.
342    # the sequence of lines
343    #<dl>
344    #      <dt>Last modification:</dt>
345    #       <dd>Fri Jun  2 11:46:24 2006</dd>
346    #    </dl>
347    # should also be removed ++ je ne sais pas dire en sed la ligne
348    # suivant l'occurence de Last modification
349    # replace *_param_* in href attributes because anchors are badly written
350    # with _keyword_
351    #++ -e 's@\(href="#_.*\)\(_param_\)\(.*"\)@\1_keyword_\3@g' \ # ++ pb global
352    # DON'T add here (in assistant idldoc output) ?format=raw to link because
353    #  ONLINE_HELP, book="../idldoc_assistant_output/idldoc-lib.adp", /full_path    # won't work
354    list_html=$(find ${output} -name "*.html")
355    for file_html in ${list_html}
356    do
357     sed \
358     -e "s/\(Generated by IDLdoc 2.0\)\( on .*\)\( -->\)/\1\3/" \
359     -e "s/\(Produced by IDLdoc 2.0\)\( on .*\)\(\.<\/div>\)/\1\3/" \
360     -e "/<h2>Produced on/d" \
361     -e "/Last modification:/d" \
362     -e "/<dd>... ... .* ..:..:.. ....<\/dd>/d" \
363     -e '/href/s@_param_@_keyword_@g' \
364     -e 's@<div class="value">@<div class="preformat">@' \
365     -e 's/div\#file_comments {/div\#file_comments { white-space: pre;/' \
366     -e 's@^ <fixe>@<pre style="font-family: Courier;">@' \
367     -e 's@^ </fixe>@</pre>@' \
368     ${file_html} > ${file_html}_modify
369     mv ${file_html}_modify ${file_html}
370    done
371    # add the directory-overview.html from dir-files.html in idldoc_html_output
372    list_html=$(find ../idldoc_html_output -name dir-files.html)
373    for file_html in ${list_html}
374    do
375      fout=../idldoc_assistant_output/${file_html#../idldoc_html_output/*}
376      fout=${fout%/*}/directory-overview.html
377      sed -e 's/?format=raw//g' ${file_html} > ${fout}
378    done
379    echo "iii : you can see log file in ${log}"
380    echo "iii : and look ${output}/idldoc-warnings.html#undoc"
381fi
382#------------------------------------------------------------------
383if [ ${doTARsrc} -eq 1 ]
384then
385    localtarbase=/tmp/savesaxo_${$}
386    mkdir  ${localtarbase}/
387# clean backup files : *~
388    find ${memopwd}/../../.. -name "*~" -exec rm {} \;
389# prepare the source tar (without the svn...)
390#
391    cd ${memopwd}/../../..
392    tar czf ${localtarbase}/SAXO_SRC_${ndate}.tar.gz --exclude .svn SRC
393#
394#   informations
395    echo "iii : following file may be copied on http://forge.ipsl.jussieu.fr/saxo/download/"
396    ls -l ${localtarbase}
397fi
398#------------------------------------------------------------------
399if [ ${doTARdata} -eq 1 ]
400then
401    localtarbase=/tmp/savesaxo_${$}
402    mkdir  ${localtarbase}/
403#
404# prepare the data tar (without the svn...)
405#
406    cd ${memopwd}/../../..
407    tar czf ${localtarbase}/SAXO_DATA_${ndate}.tar.gz  --exclude .svn DATA
408#
409#   informations
410    echo "iii : following file may be copied on http://forge.ipsl.jussieu.fr/saxo/download/"
411    ls -l ${localtarbase}
412fi
413#------------------------------------------------------------------
414if [ ${doforge} -eq 1 ]
415then
416    echo "iii : you will be asked ${lgforge}@forge.ipsl.jussieu.fr passwd two times"
417    if [ ${doTARsrc} -ne 1 ]
418    then
419       localtarbase=${1}
420    fi
421    scp ${localtarbase}/SAXO_*.tar.gz ${lgforge}@forge.ipsl.jussieu.fr:/ipsl/forge/projets/saxo/download/
422    echo "iii : do not forget to update getsaxo.html"
423    echo "iii : \$ ./makehtml.sh getsaxo"
424    echo "iii : do not forget to clean ${localtarbase}"
425fi
426#------------------------------------------------------------------
427if [[ ($doDTAlodyc -eq 1) || ($doDTAipsl -eq 1) ]]
428then
429    echo "iii : you will be asked ${lgforge}@forge.ipsl.jussieu.fr passwd"
430    infodata=$(ssh ${lgforge}@forge.ipsl.jussieu.fr ls -lht /ipsl/forge/projets/saxo/download/SAXO_DATA_*.tar.gz | head -n 1)
431    filedata=$(echo ${infodata} | awk '{print $NF}')
432    filedata=$(basename $filedata)
433    cat <<EOF > job_data_$$
434#!/bin/bash
435cd SAXO_DIR
436#
437rm -rf DATA
438wget http://forge.ipsl.jussieu.fr/saxo/download/$filedata
439gunzip $filedata
440tar vxf $( basename $filedata .gz )
441rm -f $( basename $filedata .gz )
442#
443chmod -R 755 *
444exit
445#
446EOF
447fi
448#------------------------------------------------------------------
449if [ $doSRClodyc -eq 1 ]
450then
451# update src on cerbere
452#
453    echo "iii : update src on cerbere"
454    ssh smasson@cerbere.lodyc.jussieu.fr "svn update SAXO_DIR/SRC ; chmod -R 755 SAXO_DIR"
455fi
456#------------------------------------------------------------------
457if [ $doDTAlodyc -eq 1 ]
458then
459# update data on cerbere
460    echo "iii : update data on cerbere"
461    scp job_data_$$ smasson@cerbere.lodyc.jussieu.fr:.
462    ssh smasson@cerbere.lodyc.jussieu.fr "chmod 755 job_data_$$ ; ./job_data_$$ ; rm -f job_data_$$"
463fi
464#------------------------------------------------------------------
465if [ $doSRCipsl -eq 1 ]
466then
467# update src on calcul2
468#
469    echo "iii : update src on calcul2"
470    ssh smlod@calcul2.ipsl.jussieu.fr "svn update SAXO_DIR/SRC ; chmod -R 755 SAXO_DIR"
471fi
472#------------------------------------------------------------------
473if [ $doDTAipsl -eq 1 ]
474then
475# update data on cook
476    echo "iii : update data on cook"
477    scp job_data_$$ smlod@cook.ipsl.jussieu.fr:.
478    ssh smlod@cook.ipsl.jussieu.fr "chmod 755 job_data_$$ ; ./job_data_$$ ; rm -f job_data_$$"
479fi
480#------------------------------------------------------------------
481if [ $doSRCidris -eq 1 ]
482then
483# update src on rhodes
484    echo "iii : update src to rhodes"
485    ssh reee217@rhodes.idris.fr "/usr/local/pub/svn/svn-1.3.1/bin/svn update SAXO_DIR/SRC ; chmod -R 755 SAXO_DIR"
486fi
487#------------------------------------------------------------------
488if [ $doDTAidris -eq 1 ]
489then
490# create the update script for rhodes
491    if [[ ($doDTAlodyc -eq 0) && ($doDTAipsl -eq 0) ]]
492        then
493        echo "iii : you will be asked ${lgforge}@forge.ipsl.jussieu.fr passwd"
494        infodata=$(ssh ${lgforge}@forge.ipsl.jussieu.fr ls -lht /ipsl/forge/projets/saxo/download/SAXO_DATA_*.tar.gz | head -n 1)
495        filedata=$(echo ${infodata} | awk '{print $NF}')
496        filedata=$(basename $filedata)
497    fi
498    cat <<EOF > job_data_idris_$$
499#!/bin/ksh
500cd SAXO_DIR
501#
502rm -rf DATA
503echo "iii : you will be asked ${lgforge}@forge.ipsl.jussieu.fr passwd"
504scp ${lgforge}@forge.ipsl.jussieu.fr:/ipsl/forge/projets/saxo/download/$filedata .
505gunzip $filedata
506tar vxf $( basename $filedata .gz )
507rm -f $( basename $filedata .gz )
508#
509chmod -R 755 *
510exit
511#
512EOF
513# update data on gaya
514    echo "iii : update data to gaya"
515    scp job_data_idris_$$ reee217@gaya.idris.fr:.
516    ssh reee217@gaya.idris.fr "chmod 755 job_data_idris_$$ ; ./job_data_idris_$$ ; rm -f job_data_idris_$$"
517fi
518#------------------------------------------------------------------
519#
520[ -f job_src_$$ ] && rm -f job_src_$$
521[ -f job_data_$$ ] && rm -f job_data_$$
522[ -f job_data_idris_$$ ] && rm -f job_data_idris_$$
523#
524exit
525#
Note: See TracBrowser for help on using the repository browser.