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

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

modification of savesaxo.sh to add ?format=raw as often needed in one line, and suppress .html in idldoc-index*.html (known bug of idldoc)

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