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
Line 
1#!/bin/bash
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
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
7# fplod 2006-06-07T10:57:35Z aedon.locean-ipsl.upmc.fr (Darwin)
8# add ?format=raw in idldoc production for frames
9# fplod 2006-06-07T08:14:15Z aedon.locean-ipsl.upmc.fr (Darwin)
10# add action for idldochtml
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#
19docompileall=0
20dohtml=0
21dooldtest=0
22doidlwavedoc=0
23doidldoc_html=0
24doidldoc_assistant=0
25doTARsrc=1
26doTARdata=0
27doforge=1
28doSRClodyc=0
29doDTAlodyc=0
30doSRCipsl=0
31doDTAipsl=0
32doSRCidris=0
33doDTAidris=0
34#
35case $( whoami ) in
36    smasson)
37        lgforge=smasson
38    ;;
39    floseb)
40        lgforge=smasson
41    ;;
42    *)
43        lgforge=saxo
44    ;;
45esac
46#
47if [ ${lgforge} != smasson ]
48then
49    doSRClodyc=0
50    doDTAlodyc=0
51    doSRCipsl=0
52    doDTAipsl=0
53    doSRCidris=0
54    doDTAidris=0
55fi   
56#
57# get the date in a nice format
58#
59ndate=`date +%Y%m%d`
60# memorize current directory
61memopwd=$(pwd) # should be <working space>/SRC/Documentation/xmldoc
62#
63#------------------------------------------------------------------
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
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
101    echo
102    echo
103fi
104#------------------------------------------------------------------
105if [ ${dohtml} -eq 1 ]
106then
107#
108# redo the html file
109#
110    cd ${memopwd}
111    for docxml in firststeps.xml getsaxo.xml mailing.xml main.xml tiplink.xml updatesaxo.xml whatissaxo.xml whatsnew.xml
112    do
113    ./makehtml.sh $(basename ${docxml} .xml)
114 #   tidy -m $(basename ${docxml}).html
115    done
116    exit 0
117fi
118#------------------------------------------------------------------
119if [ ${dooldtest} -eq 1 ]
120then
121# make the old test
122#
123    cd ${memopwd}/../../Tests/
124    ./makeold.sh
125    exit 0
126fi
127#------------------------------------------------------------------
128if  [ ${doidlwavedoc} -eq 1 ]
129then
130#
131# redo idlwave doc
132#
133    cd ${memopwd}/../..
134    Documentation/idlwave_catalog -v -f saxo
135    exit 0
136fi
137#------------------------------------------------------------------
138if  [ ${doidldoc_html} -eq 1 ]
139then
140#
141    # build a idl file to launch idldoc
142    cat <<EOF > /tmp/idldoc_html_${$}.pro
143!path = expand_path('+' + '../idldoc/')
144print,!path
145idldoc,root="../../",title="SAXO Documentation",LOG_FILE="/tmp/idldochtlm_${$}.log", $
146output="../idldoc_html_output",/preformat,/embed
147exit
148EOF
149    # launch idl with the file built above
150    IDL_STARTUP=/tmp/idldoc_html_${$}.pro;idl
151    /bin/rm /tmp/idldoc_html_${$}.pro
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" \
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' \
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"
190    exit 1
191fi
192#------------------------------------------------------------------
193if  [ ${doidldoc_assistant} -eq 1 ]
194then
195#
196    echo "eee : pas encore ecrit"
197    exit 1
198fi
199#------------------------------------------------------------------
200if [ ${doTARsrc} -eq 1 ]
201then
202    localtarbase=/tmp/savesaxo_${$}
203    mkdir  ${localtarbase}/
204# clean backup files : *~
205    find ${memopwd}/../../.. -name "*~" -exec rm {} \;
206# prepare the source tar (without the svn...)
207#
208    cd ${memopwd}/../../..
209    tar czf ${localtarbase}/SAXO_SRC_${ndate}.tar.gz --exclude .svn SRC
210#
211#   informations
212    echo "iii : following file may be copied on http://forge.ipsl.jussieu.fr/saxo/download/"
213    ls -l ${localtarbase}
214fi
215#------------------------------------------------------------------
216if [ ${doTARdata} -eq 1 ]
217then
218    localtarbase=/tmp/savesaxo_${$}
219    mkdir  ${localtarbase}/
220#
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#
226#   informations
227    echo "iii : following file may be copied on http://forge.ipsl.jussieu.fr/saxo/download/"
228    ls -l ${localtarbase}
229fi
230#------------------------------------------------------------------
231if [ ${doforge} -eq 1 ]
232then
233    echo "iii : you will be asked ${lgforge}@forge.ipsl.jussieu.fr passwd two times"
234    if [ ${doTARsrc} -ne 1 ]
235    then
236       localtarbase=${1}
237    fi
238    scp ${localtarbase}/SAXO_*.tar.gz ${lgforge}@forge.ipsl.jussieu.fr:/ipsl/forge/projets/saxo/download/
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
243#------------------------------------------------------------------
244if [[ ($doSRClodyc -eq 1) || ($doSRCipsl -eq 1) ]]
245then
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 )
250#
251    cat <<EOF > job_src_$$
252#!/bin/bash
253cd SAXO_DIR
254#
255rm -rf SRC
256wget http://forge.ipsl.jussieu.fr/saxo/download/$filesrc
257gunzip $filesrc
258tar vxfz $filesrc
259rm -f $filesrc
260#
261chmod -R 755 *
262exit
263#
264EOF
265fi
266#
267if [[ ($doDTAlodyc -eq 1) || ($doDTAipsl -eq 1) ]]
268then
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)
273    cat <<EOF > job_data_$$
274#!/bin/bash
275cd SAXO_DIR
276#
277rm -rf DATA
278wget http://forge.ipsl.jussieu.fr/saxo/download/$filedata
279tar vxfz $filedata
280rm -f $filedata
281#
282chmod -R 755 *
283exit
284#
285EOF
286fi
287#------------------------------------------------------------------
288if [ $doSRClodyc -eq 1 ]
289then
290# update src on cerbere
291#
292    echo "iii : update src on cerbere"
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#------------------------------------------------------------------
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#------------------------------------------------------------------
322if [ $doSRCidris -eq 1 ]
323then
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
348# update src on rhodes
349    echo "iii : update src to rhodes"
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_$$"
352fi
353#------------------------------------------------------------------
354if [ $doDTAidris -eq 1 ]
355then
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
379# update data on gaya
380    echo "iii : update data to gaya"
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_$$"
383fi
384#------------------------------------------------------------------
385#
386[ -f job_src_$$ ] && rm -f job_src_$$
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_$$
390#
391exit
392#
Note: See TracBrowser for help on using the repository browser.