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

Last change on this file since 142 was 142, checked in by navarro, 18 years ago

english and nicer header (2a)

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