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

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

bugfix in fromirr and fromreg + add full path to call IDL in save saxo

  • Property svn:executable set to *
File size: 12.8 KB
Line 
1#!/bin/bash
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
17# fplod 2006-06-14T12:41:37Z aedon.locean-ipsl.upmc.fr (Darwin)
18# add embed paramater idldoc instructions to try to fix ticket#17
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
22# fplod 2006-06-07T10:57:35Z aedon.locean-ipsl.upmc.fr (Darwin)
23# add ?format=raw in idldoc production for frames
24# fplod 2006-06-07T08:14:15Z aedon.locean-ipsl.upmc.fr (Darwin)
25# add action for idldochtml
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#
34docompileall=1
35dohtml=0
36dooldtest=0
37doidlwavedoc=0
38doidldoc_html=0
39doidldoc_assistant=0
40doTARsrc=0
41doTARdata=0
42doforge=0
43doSRClodyc=0
44doDTAlodyc=0
45doSRCipsl=0
46doDTAipsl=0
47doSRCidris=0
48doDTAidris=0
49#
50case $( whoami ) in
51    smasson)
52        lgforge=smasson
53    ;;
54    floseb)
55        lgforge=smasson
56    ;;
57    *)
58        lgforge=saxo
59    ;;
60esac
61#
62if [ ${lgforge} != smasson ]
63then
64    doSRClodyc=0
65    doDTAlodyc=0
66    doSRCipsl=0
67    doDTAipsl=0
68    doSRCidris=0
69    doDTAidris=0
70fi   
71#
72# get the date in a nice format
73#
74ndate=`date +%Y%m%d`
75# memorize current directory
76memopwd=$(pwd) # should be <working space>/SRC/Documentation/xmldoc
77#
78#------------------------------------------------------------------
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
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
116    echo
117    echo
118fi
119#------------------------------------------------------------------
120if [ ${dohtml} -eq 1 ]
121then
122#
123# redo the html file
124#
125    cd ${memopwd}
126    for docxml in firststeps.xml getsaxo.xml mailing.xml main.xml tiplink.xml updatesaxo.xml whatissaxo.xml whatsnew.xml
127    do
128    ./makehtml.sh $(basename ${docxml} .xml)
129 #   tidy -m $(basename ${docxml}).html
130    done
131    exit 0
132fi
133#------------------------------------------------------------------
134if [ ${dooldtest} -eq 1 ]
135then
136# make the old test
137#
138    cd ${memopwd}/../../Tests/
139    ./makeold.sh
140    exit 0
141fi
142#------------------------------------------------------------------
143if  [ ${doidlwavedoc} -eq 1 ]
144then
145#
146# redo idlwave doc
147#
148    cd ${memopwd}/../..
149    Documentation/idlwave_catalog -v -f saxo
150    exit 0
151fi
152#------------------------------------------------------------------
153if  [ ${doidldoc_html} -eq 1 ]
154then
155#
156    # build a idl file to launch idldoc
157    output=../idldoc_html_output/
158    log="/tmp/idldochtlm_${$}.log"
159    pro="/tmp/idldochtlm_${$}.pro"
160    cat <<EOF > ${pro}
161!path = expand_path('+' + '../idldoc/')
162print,!path
163idldoc,root="../../",title="SAXO Documentation", $
164LOG_FILE="${log}", $
165output="${output}", /preformat, /embed
166exit
167EOF
168    # launch idl with the file built above
169    IDL_STARTUP=${pro};$IDL_DIR/bin/idl
170    /bin/rm ${pro}
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
191    # add ?format=raw to links on html files
192    list_html=$(find ${output} -name "*.html")
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" \
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' \
204     ${file_html} > ${file_html}_modify
205     mv ${file_html}_modify ${file_html}
206    done
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"
219    exit 1
220fi
221#------------------------------------------------------------------
222if  [ ${doidldoc_assistant} -eq 1 ]
223then
224#
225    echo "eee : pas encore ecrit"
226    exit 1
227fi
228#------------------------------------------------------------------
229if [ ${doTARsrc} -eq 1 ]
230then
231    localtarbase=/tmp/savesaxo_${$}
232    mkdir  ${localtarbase}/
233# clean backup files : *~
234    find ${memopwd}/../../.. -name "*~" -exec rm {} \;
235# prepare the source tar (without the svn...)
236#
237    cd ${memopwd}/../../..
238    tar czf ${localtarbase}/SAXO_SRC_${ndate}.tar.gz --exclude .svn SRC
239#
240#   informations
241    echo "iii : following file may be copied on http://forge.ipsl.jussieu.fr/saxo/download/"
242    ls -l ${localtarbase}
243fi
244#------------------------------------------------------------------
245if [ ${doTARdata} -eq 1 ]
246then
247    localtarbase=/tmp/savesaxo_${$}
248    mkdir  ${localtarbase}/
249#
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#
255#   informations
256    echo "iii : following file may be copied on http://forge.ipsl.jussieu.fr/saxo/download/"
257    ls -l ${localtarbase}
258fi
259#------------------------------------------------------------------
260if [ ${doforge} -eq 1 ]
261then
262    echo "iii : you will be asked ${lgforge}@forge.ipsl.jussieu.fr passwd two times"
263    if [ ${doTARsrc} -ne 1 ]
264    then
265       localtarbase=${1}
266    fi
267    scp ${localtarbase}/SAXO_*.tar.gz ${lgforge}@forge.ipsl.jussieu.fr:/ipsl/forge/projets/saxo/download/
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
272#------------------------------------------------------------------
273if [[ ($doSRClodyc -eq 1) || ($doSRCipsl -eq 1) ]]
274then
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 )
279#
280    cat <<EOF > job_src_$$
281#!/bin/bash
282cd SAXO_DIR
283#
284rm -rf SRC
285wget http://forge.ipsl.jussieu.fr/saxo/download/$filesrc
286gunzip $filesrc
287tar vxfz $filesrc
288rm -f $filesrc
289#
290chmod -R 755 *
291exit
292#
293EOF
294fi
295#
296if [[ ($doDTAlodyc -eq 1) || ($doDTAipsl -eq 1) ]]
297then
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)
302    cat <<EOF > job_data_$$
303#!/bin/bash
304cd SAXO_DIR
305#
306rm -rf DATA
307wget http://forge.ipsl.jussieu.fr/saxo/download/$filedata
308tar vxfz $filedata
309rm -f $filedata
310#
311chmod -R 755 *
312exit
313#
314EOF
315fi
316#------------------------------------------------------------------
317if [ $doSRClodyc -eq 1 ]
318then
319# update src on cerbere
320#
321    echo "iii : update src on cerbere"
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#------------------------------------------------------------------
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#------------------------------------------------------------------
351if [ $doSRCidris -eq 1 ]
352then
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
377# update src on rhodes
378    echo "iii : update src to rhodes"
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_$$"
381fi
382#------------------------------------------------------------------
383if [ $doDTAidris -eq 1 ]
384then
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
408# update data on gaya
409    echo "iii : update data to gaya"
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_$$"
412fi
413#------------------------------------------------------------------
414#
415[ -f job_src_$$ ] && rm -f job_src_$$
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_$$
419#
420exit
421#
Note: See TracBrowser for help on using the repository browser.