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

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

add some missing compilation options + small updates

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