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

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

modification of savesaxo.sh to fix ticket 17

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