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

Last change on this file since 140 was 140, checked in by pinsard, 18 years ago

new .html files from .xml files following the previous revision for Id modification

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 12.7 KB
RevLine 
[86]1#!/bin/bash
[111]2#
[123]3# update :
4# $Id$
[140]5# fplod 2006-07-11T08:26:05Z aedon.locean-ipsl.upmc.fr (Darwin)
6# commented tidy in dohtml section is moved in makehtml
[135]7# fplod 2006-07-10T08:22:53Z aedon.locean-ipsl.upmc.fr (Darwin)
8# ajout de  white-space: pre; dans la css pour file_comments
[123]9# fplod 2006-07-04T13:09:19Z aedon.locean-ipsl.upmc.fr (Darwin)
10# for idldoc html output
11# because preformat option doesn't seem to work well
12# replace
13# div class="value"
14# by
15# div class="preformat"
[111]16# fplod 2006-06-19T08:46:39Z aedon.locean-ipsl.upmc.fr (Darwin)
17# for idldoc html output
18#. replace
19#     -e 's/\(href=".*\)\(\.html\)\("\)/\1\2?format=raw\3/g' \
20#     -e 's/\(href=".*\)\(\.html\)\(#.*"\)/\1\2?format=raw\3/g' \
[123]21#     -e 's/\(src=".*\)\(\.html\)\("\)/\1\2?format=raw\3/g' \
[111]22# by
23# -e 's@\(href="[^.]*[^h]*[^t]*[^m]*[^l]*[^"]*\)\(\.html\)\("\)@\1\2?format=raw\3@g' \
24# -e 's@\(href="[^.]*[^h]*[^t]*[^m]*[^l]*[^"]*\)\(\.html\)\(#.*"\)@\1\2?format=raw\3@g' \
25#-e 's@\(src="[^.]*[^h]*[^t]*[^m]*[^l]*[^"]*\)\(\.html\)\("\)@\1\2?format=raw\3@g'
26# in order to be able to add ?format=raw several time on one line
27# . suppress .html in line like
28# a parameter from the routine ./ReadWrite/idl-NetCDF/ncdf_read.html
29# in files idldoc-index*.html
[109]30# fplod 2006-06-14T12:41:37Z aedon.locean-ipsl.upmc.fr (Darwin)
[111]31# add embed paramater idldoc instructions to try to fix ticket#17
[91]32# fplod 2006-06-07T12:11:50Z aedon.locean-ipsl.upmc.fr (Darwin)
33# add g option in ?format=raw sed transformation in order to fix
34# link on top of idldoc like directory-overview.html
[90]35# fplod 2006-06-07T10:57:35Z aedon.locean-ipsl.upmc.fr (Darwin)
36# add ?format=raw in idldoc production for frames
[89]37# fplod 2006-06-07T08:14:15Z aedon.locean-ipsl.upmc.fr (Darwin)
38# add action for idldochtml
[86]39# fplod 2006-06-02T14:28:30Z aedon.locean-ipsl.upmc.fr (Darwin)
40# modification to produce tar files in /tmp/saxo_${$} when dotar=1
41# modification to copy tar files on http://forge.ipsl.jussieu.fr/saxo/download/
42# when doforge=1
43# produce tar files in /tmp/saxo_${$} when dotar=1
44set -x
45set -u
46#
[138]47docompileall=1
[86]48dohtml=0
49dooldtest=0
[107]50doidlwavedoc=0
[138]51doidldoc_html=0
[86]52doidldoc_assistant=0
[116]53doTARsrc=0
[88]54doTARdata=0
[116]55doforge=0
[88]56doSRClodyc=0
57doDTAlodyc=0
[100]58doSRCipsl=0
59doDTAipsl=0
60doSRCidris=0
61doDTAidris=0
[86]62#
[100]63case $( whoami ) in
64    smasson)
65        lgforge=smasson
66    ;;
67    floseb)
68        lgforge=smasson
69    ;;
70    *)
71        lgforge=saxo
72    ;;
73esac
[88]74#
[100]75if [ ${lgforge} != smasson ]
76then
77    doSRClodyc=0
78    doDTAlodyc=0
79    doSRCipsl=0
80    doDTAipsl=0
81    doSRCidris=0
82    doDTAidris=0
83fi   
84#
[88]85# get the date in a nice format
86#
87ndate=`date +%Y%m%d`
[86]88# memorize current directory
89memopwd=$(pwd) # should be <working space>/SRC/Documentation/xmldoc
[100]90#
[88]91#------------------------------------------------------------------
[100]92if [ ${docompileall} -eq 1 ]
93    then
94    cat <<EOF > /tmp/compileall${$}.pro
[114]95.reset_session 
96;
[100]97!path = expand_path('+' + '../..') + ':' + expand_path('+' + !dir)
[115]98resolve_all, resolve_either='def_myuniquetmpdir', skip_routines = ['xxx2ps','trends', 'label_gmt']
99resolve_all, resolve_either = 'find', skip_routines = ['xxx2ps','trends', 'label_gmt']
[114]100def_myuniquetmpdir
101oldcm = find('oldcm_empty')
102;oldcm = find('oldcm_full')
103oldcm = oldcm[0]
104@cm_general
105file_copy, oldcm, myuniquetmpdir + 'oldcm_used.pro', /overwrite
106IF !journal NE 0 THEN journal
107journal, myuniquetmpdir + 'cm_demomode_used.pro'
108journal   
109;
[115]110resolve_all, resolve_either='keep_compatibility', skip_routines = ['xxx2ps','trends', 'label_gmt']
[114]111;
[100]112EOF
113#
[115]114    for i in $( find ${memopwd}/../.. -name "*.pro" | grep -iv label_gmt )
[100]115      do
[115]116# does it contains pro or function ?
117      egrep -iq '^ *    *(pro|function)' $i
[100]118      if [ $? -eq 0 ]
119          then
[115]120          echo "print, '$( basename $i .pro ) :'" >> /tmp/compileall${$}.pro
121          echo "resolve_all, resolve_either = '$( basename $i .pro )', skip_routines = ['xxx2ps','trends', 'label_gmt']" >> /tmp/compileall${$}.pro
[100]122      fi
123    done
124    echo exit >> /tmp/compileall${$}.pro
125    IDL_STARTUP=/tmp/compileall${$}.pro
[120]126    ${IDL_DIR}/bin/idl &> /tmp/compileallerr_${$}
[100]127    echo
128    echo
[114]129    grep -i "error" /tmp/compileallerr_${$}
130#    grep -q "Compilation error(s)" /tmp/compileallerr_${$}
[105]131    if [ ${?} -ne 0 ]
132    then
133     echo "ALL SAXO files are OK..."
134     rm -f /tmp/compileallerr_${$} /tmp/compileall${$}.pro
135    else
136     grep "Compilation error(s)" /tmp/compileallerr_${$}
137     echo "eee : see /tmp/compileallerr_${$}"
[115]138     more /tmp/compileallerr_${$}
[105]139     exit 1
140    fi
[100]141    echo
142    echo
143fi
144#------------------------------------------------------------------
[86]145if [ ${dohtml} -eq 1 ]
146then
147#
148# redo the html file
149#
150    cd ${memopwd}
[88]151    for docxml in firststeps.xml getsaxo.xml mailing.xml main.xml tiplink.xml updatesaxo.xml whatissaxo.xml whatsnew.xml
[86]152    do
[140]153      ./makehtml.sh $(basename ${docxml} .xml)
[86]154    done
155    exit 0
156fi
[88]157#------------------------------------------------------------------
[86]158if [ ${dooldtest} -eq 1 ]
159then
160# make the old test
161#
162    cd ${memopwd}/../../Tests/
163    ./makeold.sh
164    exit 0
165fi
[88]166#------------------------------------------------------------------
[86]167if  [ ${doidlwavedoc} -eq 1 ]
168then
169#
170# redo idlwave doc
171#
[107]172    cd ${memopwd}/../..
[86]173    Documentation/idlwave_catalog -v -f saxo
174    exit 0
175fi
[88]176#------------------------------------------------------------------
[86]177if  [ ${doidldoc_html} -eq 1 ]
178then
179#
[89]180    # build a idl file to launch idldoc
[111]181    output=../idldoc_html_output/
182    log="/tmp/idldochtlm_${$}.log"
183    pro="/tmp/idldochtlm_${$}.pro"
184    cat <<EOF > ${pro}
[89]185!path = expand_path('+' + '../idldoc/')
186print,!path
[111]187idldoc,root="../../",title="SAXO Documentation", $
188LOG_FILE="${log}", $
189output="${output}", /preformat, /embed
[89]190exit
191EOF
192    # launch idl with the file built above
[120]193    IDL_STARTUP=${pro};${IDL_DIR}/bin/idl
[111]194    /bin/rm ${pro}
[89]195    # In order to do not have to many revision in svn, we modify some
196    # lines produced by idldoc :
197    # examples :
198    # <!-- Generated by IDLdoc 2.0 on Wed Jun  7 10:25:28 2006 -->
199    # will be replaced by
200    # <!-- Generated by IDLdoc 2.0 -->
201    # <div id="tagline">Produced by IDLdoc 2.0 on Wed Jun  7 10:54:37 2006.</div
202    # will be replaced by
203    # <div id="tagline">Produced by IDLdoc 2.0</div>
204    # <h2>Produced on Wed Jun  7 10:23:13 2006</h2>
205    # will be delete
206    # other lines will be deleted because the time is the time of checkout not
207    # the time of revision.
208    # the sequence of lines
209    #<dl>
210    #      <dt>Last modification:</dt>
211    #       <dd>Fri Jun  2 11:46:24 2006</dd>
212    #    </dl>
213    # should also be removed ++ je ne sais pas dire en sed la ligne
214    # suivant l'occurence de Last modification
[111]215    # add ?format=raw to links on html files
216    list_html=$(find ${output} -name "*.html")
[89]217    for file_html in ${list_html}
218    do
219     sed \
220     -e "s/\(Generated by IDLdoc 2.0\)\( on .*\)\( -->\)/\1\3/" \
221     -e "s/\(Produced by IDLdoc 2.0\)\( on .*\)\(\.<\/div>\)/\1\3/" \
222     -e "/<h2>Produced on/d" \
223     -e "/Last modification:/d" \
224     -e "/<dd>... ... .* ..:..:.. ....<\/dd>/d" \
[111]225     -e 's@\(href="[^.]*[^h]*[^t]*[^m]*[^l]*[^"]*\)\(\.html\)\("\)@\1\2?format=raw\3@g' \
226     -e 's@\(href="[^.]*[^h]*[^t]*[^m]*[^l]*[^"]*\)\(\.html\)\(#.*"\)@\1\2?format=raw\3@g' \
227     -e 's@\(src="[^.]*[^h]*[^t]*[^m]*[^l]*[^"]*\)\(\.html\)\("\)@\1\2?format=raw\3@g' \
[123]228     -e 's@<div class="value">@<div class="preformat">@' \
[135]229     -e 's/div\#file_comments {/div\#file_comments { white-space: pre;/' \
[89]230     ${file_html} > ${file_html}_modify
231     mv ${file_html}_modify ${file_html}
232    done
[111]233    # suppress ".html" in idldoc-index*.html in lines like
234    # a parameter from the routine ./ReadWrite/idl-NetCDF/ncdf_read.html
235    list_html=$(find ${output} -name "idldoc-index*.html")
236    for file_html in ${list_html}
237    do
238     sed \
239     -e "s/\(a parameter from the routine \)\(.*\)\(.html\)/\1\2/" \
240     ${file_html} > ${file_html}_modify
241     mv ${file_html}_modify ${file_html}
242    done
243    echo "iii : you can see log file in ${log}"
244    echo "iii : and look ${output}/idldoc-warnings.html#undoc"
[86]245    exit 1
246fi
[88]247#------------------------------------------------------------------
[86]248if  [ ${doidldoc_assistant} -eq 1 ]
249then
250#
251    echo "eee : pas encore ecrit"
252    exit 1
253fi
[88]254#------------------------------------------------------------------
255if [ ${doTARsrc} -eq 1 ]
[86]256then
257    localtarbase=/tmp/savesaxo_${$}
258    mkdir  ${localtarbase}/
[87]259# clean backup files : *~
[88]260    find ${memopwd}/../../.. -name "*~" -exec rm {} \;
[87]261# prepare the source tar (without the svn...)
[86]262#
[87]263    cd ${memopwd}/../../..
264    tar czf ${localtarbase}/SAXO_SRC_${ndate}.tar.gz --exclude .svn SRC
[86]265#
[87]266#   informations
[89]267    echo "iii : following file may be copied on http://forge.ipsl.jussieu.fr/saxo/download/"
[87]268    ls -l ${localtarbase}
269fi
[88]270#------------------------------------------------------------------
271if [ ${doTARdata} -eq 1 ]
[87]272then
273    localtarbase=/tmp/savesaxo_${$}
274    mkdir  ${localtarbase}/
[86]275#
[87]276# prepare the data tar (without the svn...)
277#
278    cd ${memopwd}/../../..
279    tar czf ${localtarbase}/SAXO_DATA_${ndate}.tar.gz  --exclude .svn DATA
280#
[86]281#   informations
[89]282    echo "iii : following file may be copied on http://forge.ipsl.jussieu.fr/saxo/download/"
[86]283    ls -l ${localtarbase}
284fi
[88]285#------------------------------------------------------------------
[86]286if [ ${doforge} -eq 1 ]
287then
[100]288    echo "iii : you will be asked ${lgforge}@forge.ipsl.jussieu.fr passwd two times"
[88]289    if [ ${doTARsrc} -ne 1 ]
[86]290    then
[89]291       localtarbase=${1}
[86]292    fi
[100]293    scp ${localtarbase}/SAXO_*.tar.gz ${lgforge}@forge.ipsl.jussieu.fr:/ipsl/forge/projets/saxo/download/
[86]294    echo "iii : do not forget to update getsaxo.html"
295    echo "iii : \$ ./makehtml.sh getsaxo"
296    echo "iii : do not forget to clean ${localtarbase}"
297fi
[88]298#------------------------------------------------------------------
[100]299if [[ ($doDTAlodyc -eq 1) || ($doDTAipsl -eq 1) ]]
[88]300then
[100]301    echo "iii : you will be asked ${lgforge}@forge.ipsl.jussieu.fr passwd"
302    infodata=$(ssh ${lgforge}@forge.ipsl.jussieu.fr ls -lht /ipsl/forge/projets/saxo/download/SAXO_DATA_*.tar.gz | head -n 1)
303    filedata=$(echo ${infodata} | awk '{print $NF}')
304    filedata=$(basename $filedata)
[88]305    cat <<EOF > job_data_$$
[100]306#!/bin/bash
[88]307cd SAXO_DIR
[86]308#
[88]309rm -rf DATA
310wget http://forge.ipsl.jussieu.fr/saxo/download/$filedata
[114]311gunzip $filedata
312tar vxf $( basename $filedata .gz )
313rm -f $( basename $filedata .gz )
[88]314#
315chmod -R 755 *
316exit
317#
[86]318EOF
[88]319fi
320#------------------------------------------------------------------
321if [ $doSRClodyc -eq 1 ]
322then
323# update src on cerbere
[86]324#
[100]325    echo "iii : update src on cerbere"
[115]326    ssh smasson@cerbere.lodyc.jussieu.fr "svn update SAXO_DIR/SRC ; chmod -R 755 SAXO_DIR"
[88]327fi
328#------------------------------------------------------------------
329if [ $doDTAlodyc -eq 1 ]
330then
331# update data on cerbere
332    echo "iii : update data on cerbere"
333    scp job_data_$$ smasson@cerbere.lodyc.jussieu.fr:.
334    ssh smasson@cerbere.lodyc.jussieu.fr "chmod 755 job_data_$$ ; ./job_data_$$ ; rm -f job_data_$$"
335fi
336#------------------------------------------------------------------
[100]337if [ $doSRCipsl -eq 1 ]
338then
[116]339# update src on calcul2
[100]340#
[116]341    echo "iii : update src on calcul2"
342    ssh smlod@calcul2.ipsl.jussieu.fr "svn update SAXO_DIR/SRC ; chmod -R 755 SAXO_DIR"
[100]343fi
344#------------------------------------------------------------------
345if [ $doDTAipsl -eq 1 ]
346then
347# update data on cook
348    echo "iii : update data on cook"
349    scp job_data_$$ smlod@cook.ipsl.jussieu.fr:.
350    ssh smlod@cook.ipsl.jussieu.fr "chmod 755 job_data_$$ ; ./job_data_$$ ; rm -f job_data_$$"
351fi
352#------------------------------------------------------------------
[88]353if [ $doSRCidris -eq 1 ]
354then
355# update src on rhodes
356    echo "iii : update src to rhodes"
[115]357    ssh reee217@rhodes.idris.fr "/usr/local/pub/svn/svn-1.3.1/bin/svn update SAXO_DIR/SRC ; chmod -R 755 SAXO_DIR"
[88]358fi
359#------------------------------------------------------------------
360if [ $doDTAidris -eq 1 ]
361then
[100]362# create the update script for rhodes
363    if [[ ($doDTAlodyc -eq 0) && ($doDTAipsl -eq 0) ]]
364        then
365        echo "iii : you will be asked ${lgforge}@forge.ipsl.jussieu.fr passwd"
366        infodata=$(ssh ${lgforge}@forge.ipsl.jussieu.fr ls -lht /ipsl/forge/projets/saxo/download/SAXO_DATA_*.tar.gz | head -n 1)
367        filedata=$(echo ${infodata} | awk '{print $NF}')
368        filedata=$(basename $filedata)
369    fi
370    cat <<EOF > job_data_idris_$$
371#!/bin/ksh
372cd SAXO_DIR
373#
374rm -rf DATA
375echo "iii : you will be asked ${lgforge}@forge.ipsl.jussieu.fr passwd"
376scp ${lgforge}@forge.ipsl.jussieu.fr:/ipsl/forge/projets/saxo/download/$filedata .
377gunzip $filedata
378tar vxf $( basename $filedata .gz )
379rm -f $( basename $filedata .gz )
380#
381chmod -R 755 *
382exit
383#
384EOF
[88]385# update data on gaya
386    echo "iii : update data to gaya"
[100]387    scp job_data_idris_$$ reee217@gaya.idris.fr:.
388    ssh reee217@gaya.idris.fr "chmod 755 job_data_idris_$$ ; ./job_data_idris_$$ ; rm -f job_data_idris_$$"
[88]389fi
390#------------------------------------------------------------------
[86]391#
[88]392[ -f job_src_$$ ] && rm -f job_src_$$
[100]393[ -f job_data_$$ ] && rm -f job_data_$$
394[ -f job_data_idris_$$ ] && rm -f job_data_idris_$$
[86]395#
[88]396exit
[86]397#
Note: See TracBrowser for help on using the repository browser.