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

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

new compilation options (compile_opt idl2, strictarrsubs) in each routine

  • Property svn:executable set to *
File size: 12.6 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.reset_session 
83;
84!path = expand_path('+' + '../..') + ':' + expand_path('+' + !dir)
85resolve_all, resolve_either='def_myuniquetmpdir'
86resolve_all, resolve_either = 'find'
87def_myuniquetmpdir
88oldcm = find('oldcm_empty')
89;oldcm = find('oldcm_full')
90oldcm = oldcm[0]
91@cm_general
92file_copy, oldcm, myuniquetmpdir + 'oldcm_used.pro', /overwrite
93IF !journal NE 0 THEN journal
94journal, myuniquetmpdir + 'cm_demomode_used.pro'
95journal   
96;
97resolve_all, resolve_either='keep_compatibility'
98;
99EOF
100#
101    for i in $( find ${memopwd}/../../ -name "*.pro" )
102      do
103# does it contains return ?
104      grep -iq '^ *return' $i
105      if [ $? -eq 0 ]
106          then
107# does it contains pro or function ?
108          egrep -iq '^ *(pro|function)' $i
109          if [ $? -eq 0 ]
110              then
111              echo "resolve_all, resolve_either = '$( basename $i .pro )', skip_routines = ['xxx2ps','trends']" >> /tmp/compileall${$}.pro
112          fi
113      fi
114    done
115    echo exit >> /tmp/compileall${$}.pro
116    IDL_STARTUP=/tmp/compileall${$}.pro
117    $IDL_DIR/bin/idl &> /tmp/compileallerr_${$}
118    echo
119    echo
120    grep -i "error" /tmp/compileallerr_${$}
121#    grep -q "Compilation error(s)" /tmp/compileallerr_${$}
122    if [ ${?} -ne 0 ]
123    then
124     echo "ALL SAXO files are OK..."
125     rm -f /tmp/compileallerr_${$} /tmp/compileall${$}.pro
126    else
127     grep "Compilation error(s)" /tmp/compileallerr_${$}
128     echo "eee : see /tmp/compileallerr_${$}"
129     exit 1
130    fi
131    echo
132    echo
133fi
134#------------------------------------------------------------------
135if [ ${dohtml} -eq 1 ]
136then
137#
138# redo the html file
139#
140    cd ${memopwd}
141    for docxml in firststeps.xml getsaxo.xml mailing.xml main.xml tiplink.xml updatesaxo.xml whatissaxo.xml whatsnew.xml
142    do
143    ./makehtml.sh $(basename ${docxml} .xml)
144 #   tidy -m $(basename ${docxml}).html
145    done
146    exit 0
147fi
148#------------------------------------------------------------------
149if [ ${dooldtest} -eq 1 ]
150then
151# make the old test
152#
153    cd ${memopwd}/../../Tests/
154    ./makeold.sh
155    exit 0
156fi
157#------------------------------------------------------------------
158if  [ ${doidlwavedoc} -eq 1 ]
159then
160#
161# redo idlwave doc
162#
163    cd ${memopwd}/../..
164    Documentation/idlwave_catalog -v -f saxo
165    exit 0
166fi
167#------------------------------------------------------------------
168if  [ ${doidldoc_html} -eq 1 ]
169then
170#
171    # build a idl file to launch idldoc
172    output=../idldoc_html_output/
173    log="/tmp/idldochtlm_${$}.log"
174    pro="/tmp/idldochtlm_${$}.pro"
175    cat <<EOF > ${pro}
176!path = expand_path('+' + '../idldoc/')
177print,!path
178idldoc,root="../../",title="SAXO Documentation", $
179LOG_FILE="${log}", $
180output="${output}", /preformat, /embed
181exit
182EOF
183    # launch idl with the file built above
184    IDL_STARTUP=${pro};$IDL_DIR/bin/idl
185    /bin/rm ${pro}
186    # In order to do not have to many revision in svn, we modify some
187    # lines produced by idldoc :
188    # examples :
189    # <!-- Generated by IDLdoc 2.0 on Wed Jun  7 10:25:28 2006 -->
190    # will be replaced by
191    # <!-- Generated by IDLdoc 2.0 -->
192    # <div id="tagline">Produced by IDLdoc 2.0 on Wed Jun  7 10:54:37 2006.</div
193    # will be replaced by
194    # <div id="tagline">Produced by IDLdoc 2.0</div>
195    # <h2>Produced on Wed Jun  7 10:23:13 2006</h2>
196    # will be delete
197    # other lines will be deleted because the time is the time of checkout not
198    # the time of revision.
199    # the sequence of lines
200    #<dl>
201    #      <dt>Last modification:</dt>
202    #       <dd>Fri Jun  2 11:46:24 2006</dd>
203    #    </dl>
204    # should also be removed ++ je ne sais pas dire en sed la ligne
205    # suivant l'occurence de Last modification
206    # add ?format=raw to links on html files
207    list_html=$(find ${output} -name "*.html")
208    for file_html in ${list_html}
209    do
210     sed \
211     -e "s/\(Generated by IDLdoc 2.0\)\( on .*\)\( -->\)/\1\3/" \
212     -e "s/\(Produced by IDLdoc 2.0\)\( on .*\)\(\.<\/div>\)/\1\3/" \
213     -e "/<h2>Produced on/d" \
214     -e "/Last modification:/d" \
215     -e "/<dd>... ... .* ..:..:.. ....<\/dd>/d" \
216     -e 's@\(href="[^.]*[^h]*[^t]*[^m]*[^l]*[^"]*\)\(\.html\)\("\)@\1\2?format=raw\3@g' \
217     -e 's@\(href="[^.]*[^h]*[^t]*[^m]*[^l]*[^"]*\)\(\.html\)\(#.*"\)@\1\2?format=raw\3@g' \
218     -e 's@\(src="[^.]*[^h]*[^t]*[^m]*[^l]*[^"]*\)\(\.html\)\("\)@\1\2?format=raw\3@g' \
219     ${file_html} > ${file_html}_modify
220     mv ${file_html}_modify ${file_html}
221    done
222    # suppress ".html" in idldoc-index*.html in lines like
223    # a parameter from the routine ./ReadWrite/idl-NetCDF/ncdf_read.html
224    list_html=$(find ${output} -name "idldoc-index*.html")
225    for file_html in ${list_html}
226    do
227     sed \
228     -e "s/\(a parameter from the routine \)\(.*\)\(.html\)/\1\2/" \
229     ${file_html} > ${file_html}_modify
230     mv ${file_html}_modify ${file_html}
231    done
232    echo "iii : you can see log file in ${log}"
233    echo "iii : and look ${output}/idldoc-warnings.html#undoc"
234    exit 1
235fi
236#------------------------------------------------------------------
237if  [ ${doidldoc_assistant} -eq 1 ]
238then
239#
240    echo "eee : pas encore ecrit"
241    exit 1
242fi
243#------------------------------------------------------------------
244if [ ${doTARsrc} -eq 1 ]
245then
246    localtarbase=/tmp/savesaxo_${$}
247    mkdir  ${localtarbase}/
248# clean backup files : *~
249    find ${memopwd}/../../.. -name "*~" -exec rm {} \;
250# prepare the source tar (without the svn...)
251#
252    cd ${memopwd}/../../..
253    tar czf ${localtarbase}/SAXO_SRC_${ndate}.tar.gz --exclude .svn SRC
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 [ ${doTARdata} -eq 1 ]
261then
262    localtarbase=/tmp/savesaxo_${$}
263    mkdir  ${localtarbase}/
264#
265# prepare the data tar (without the svn...)
266#
267    cd ${memopwd}/../../..
268    tar czf ${localtarbase}/SAXO_DATA_${ndate}.tar.gz  --exclude .svn DATA
269#
270#   informations
271    echo "iii : following file may be copied on http://forge.ipsl.jussieu.fr/saxo/download/"
272    ls -l ${localtarbase}
273fi
274#------------------------------------------------------------------
275if [ ${doforge} -eq 1 ]
276then
277    echo "iii : you will be asked ${lgforge}@forge.ipsl.jussieu.fr passwd two times"
278    if [ ${doTARsrc} -ne 1 ]
279    then
280       localtarbase=${1}
281    fi
282    scp ${localtarbase}/SAXO_*.tar.gz ${lgforge}@forge.ipsl.jussieu.fr:/ipsl/forge/projets/saxo/download/
283    echo "iii : do not forget to update getsaxo.html"
284    echo "iii : \$ ./makehtml.sh getsaxo"
285    echo "iii : do not forget to clean ${localtarbase}"
286fi
287#------------------------------------------------------------------
288if [[ ($doSRClodyc -eq 1) || ($doSRCipsl -eq 1) ]]
289then
290    echo "iii : you will be asked ${lgforge}@forge.ipsl.jussieu.fr passwd"
291    infosrc=$(ssh ${lgforge}@forge.ipsl.jussieu.fr ls -lht /ipsl/forge/projets/saxo/download/SAXO_SRC_*.tar.gz  | head -n 1)
292    filesrc=$(echo ${infosrc} | awk '{print $NF}')
293    filesrc=$( basename $filesrc )
294#
295    cat <<EOF > job_src_$$
296#!/bin/bash
297cd SAXO_DIR
298#
299rm -rf SRC
300wget http://forge.ipsl.jussieu.fr/saxo/download/$filesrc
301gunzip $filesrc
302tar vxf $( basename $filesrc .gz )
303rm -f $( basename $filesrc .gz )
304#
305chmod -R 755 *
306exit
307#
308EOF
309fi
310#
311if [[ ($doDTAlodyc -eq 1) || ($doDTAipsl -eq 1) ]]
312then
313    echo "iii : you will be asked ${lgforge}@forge.ipsl.jussieu.fr passwd"
314    infodata=$(ssh ${lgforge}@forge.ipsl.jussieu.fr ls -lht /ipsl/forge/projets/saxo/download/SAXO_DATA_*.tar.gz | head -n 1)
315    filedata=$(echo ${infodata} | awk '{print $NF}')
316    filedata=$(basename $filedata)
317    cat <<EOF > job_data_$$
318#!/bin/bash
319cd SAXO_DIR
320#
321rm -rf DATA
322wget http://forge.ipsl.jussieu.fr/saxo/download/$filedata
323gunzip $filedata
324tar vxf $( basename $filedata .gz )
325rm -f $( basename $filedata .gz )
326#
327chmod -R 755 *
328exit
329#
330EOF
331fi
332#------------------------------------------------------------------
333if [ $doSRClodyc -eq 1 ]
334then
335# update src on cerbere
336#
337    echo "iii : update src on cerbere"
338    scp job_src_$$ smasson@cerbere.lodyc.jussieu.fr:.
339    ssh smasson@cerbere.lodyc.jussieu.fr "chmod 755 job_src_$$ ; ./job_src_$$ ; rm -f job_src_$$"
340fi
341#------------------------------------------------------------------
342if [ $doDTAlodyc -eq 1 ]
343then
344# update data on cerbere
345    echo "iii : update data on cerbere"
346    scp job_data_$$ smasson@cerbere.lodyc.jussieu.fr:.
347    ssh smasson@cerbere.lodyc.jussieu.fr "chmod 755 job_data_$$ ; ./job_data_$$ ; rm -f job_data_$$"
348fi
349#------------------------------------------------------------------
350if [ $doSRCipsl -eq 1 ]
351then
352# update src on cook
353#
354    echo "iii : update src on cook"
355    scp job_src_$$ smlod@cook.ipsl.jussieu.fr:.
356    ssh smlod@cook.ipsl.jussieu.fr "chmod 755 job_src_$$ ; ./job_src_$$ ; rm -f job_src_$$"
357fi
358#------------------------------------------------------------------
359if [ $doDTAipsl -eq 1 ]
360then
361# update data on cook
362    echo "iii : update data on cook"
363    scp job_data_$$ smlod@cook.ipsl.jussieu.fr:.
364    ssh smlod@cook.ipsl.jussieu.fr "chmod 755 job_data_$$ ; ./job_data_$$ ; rm -f job_data_$$"
365fi
366#------------------------------------------------------------------
367if [ $doSRCidris -eq 1 ]
368then
369# update src on rhodes
370    echo "iii : update src to rhodes"
371    ssh reee217@rhodes.idris.fr "svn update SAXO_DIR/SRC ; chmod -R 755 SAXO_DIR"
372fi
373#------------------------------------------------------------------
374if [ $doDTAidris -eq 1 ]
375then
376# create the update script for rhodes
377    if [[ ($doDTAlodyc -eq 0) && ($doDTAipsl -eq 0) ]]
378        then
379        echo "iii : you will be asked ${lgforge}@forge.ipsl.jussieu.fr passwd"
380        infodata=$(ssh ${lgforge}@forge.ipsl.jussieu.fr ls -lht /ipsl/forge/projets/saxo/download/SAXO_DATA_*.tar.gz | head -n 1)
381        filedata=$(echo ${infodata} | awk '{print $NF}')
382        filedata=$(basename $filedata)
383    fi
384    cat <<EOF > job_data_idris_$$
385#!/bin/ksh
386cd SAXO_DIR
387#
388rm -rf DATA
389echo "iii : you will be asked ${lgforge}@forge.ipsl.jussieu.fr passwd"
390scp ${lgforge}@forge.ipsl.jussieu.fr:/ipsl/forge/projets/saxo/download/$filedata .
391gunzip $filedata
392tar vxf $( basename $filedata .gz )
393rm -f $( basename $filedata .gz )
394#
395chmod -R 755 *
396exit
397#
398EOF
399# update data on gaya
400    echo "iii : update data to gaya"
401    scp job_data_idris_$$ reee217@gaya.idris.fr:.
402    ssh reee217@gaya.idris.fr "chmod 755 job_data_idris_$$ ; ./job_data_idris_$$ ; rm -f job_data_idris_$$"
403fi
404#------------------------------------------------------------------
405#
406[ -f job_src_$$ ] && rm -f job_src_$$
407[ -f job_data_$$ ] && rm -f job_data_$$
408[ -f job_data_idris_$$ ] && rm -f job_data_idris_$$
409#
410exit
411#
Note: See TracBrowser for help on using the repository browser.