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

Last change on this file since 345 was 345, checked in by pinsard, 16 years ago

migration from DocBook? 4 to Docbook 5 : sources and production tools

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 23.8 KB
Line 
1#!/bin/bash
2#
3# update :
4# $Id$
5# fplod 2008-04-16T09:02:45Z aedon.locean-ipsl.upmc.fr (Darwin)
6# html files produced from DocBook files are now produced using makefile
7# instead of makehtml.sh
8# fplod 2007-08-21T09:29:04Z aedon.locean-ipsl.upmc.fr (Darwin)
9# follow changes of calling sequence of pro2href.sh
10# add call to pro2href.sh for replacement of <proidl>...</proidl>
11# fplod 2007-06-26T14:33:12Z aedon.locean-ipsl.upmc.fr (Darwin)
12# copy listings.css in idldoc_assistant_output
13# fplod 2007-03-20T15:10:29Z aedon.locean-ipsl.upmc.fr (Darwin)
14# . replace <pro>ginette</pro> by a sequence like
15# <a href="./ginette.html">ginette</a> in idldoc html and assistant outputs
16# . encaspulate example content in <pre> </pre> in idldoc assistant outputs
17# smasson Fri Sep 22 17:28:10 CEST 2006
18# check that the number of existing html files for each .pro file is 2!
19# fplod 2006-09-21T14:55:09Z aedon.locean-ipsl.upmc.fr (Darwin)
20# remove css in idldoc html output (/embed)
21# entraine modif de modification de css pour nonproportional font ++ anglais
22# fixe is replace by pre and no more css modification
23# bug in idldoc html output file idldoc-categories.html
24# http://www.w3.org/TR/xhtml1/DTD/xhtml-transitional.dtd
25# au lieu de
26# http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
27# ++ prévenir l'auteur
28# fplod 2006-09-21T13:05:32Z aedon.locean-ipsl.upmc.fr (Darwin)
29# add an svn id in idldoc-lib.adb after </profile>
30# fplod 2006-09-20T16:34:38Z aedon.locean-ipsl.upmc.fr (Darwin)
31# suppress ?format=raw
32# fplod 2006-09-20T15:30:15Z aedon.locean-ipsl.upmc.fr (Darwin)
33# add copy of html files unedr xmldoc and idldoc_html_output on
34# saxo@forge.ipsl.jussieu.fr:/ipsl/forge/projets/saxo/download/
35# see dodocdownload
36# fplod 2006-09-20T11:05:23Z aedon.locean-ipsl.upmc.fr (Darwin)
37# correction to really suppress date in idldoc assistant outputs (font
38# instaed of div in html output)
39# fplod 2006-09-18T13:25:12Z aedon.locean-ipsl.upmc.fr (Darwin)
40# add status checking after makehtml.sh
41# smasson Fri Sep 15 10:42:01 CEST 2006
42# merge idldoc html and idldoc assistant
43# smasson Thu Sep 14 15:19:23 CEST 2006
44# add the revision number in the name of SAXO_SRC_*.tar.gz
45# smasson Wed Sep 13 14:18:02 CEST 2006
46# add the directory-overview.html from dir-files.html in idldoc_html_output
47# fplod 2006-09-07T08:09:47Z aedon.locean-ipsl.upmc.fr (Darwin)
48# main is rename to websaxo
49# fplod 2006-09-05T15:39:47Z aedon.locean-ipsl.upmc.fr (Darwin)
50# add Source link in idldoc html outpout
51# snlod/fplod 2006-08-25T08:30:36Z electre.locean-ipsl.upmc.fr (Darwin)
52# add for idldoc assistant
53# fplod 2006-08-17T09:19:06Z aedon.locean-ipsl.upmc.fr (Darwin)
54# add transformation after idldoc to force non-proportional font
55# on bloc delimited by
56#  <fixe>
57#  </fixe>
58# in .pro files (with modification of css)
59# !! do not replace \ by \\ inside this block
60# !! replace \ by an other character is a good idea
61# cf. example in ToBeReviewed/TRIANGULATION/definetri.pro
62# fplod 2006-07-21T08:23:52Z aedon.locean-ipsl.upmc.fr (Darwin)
63# add mini_notice production
64# fplod 2006-07-11T08:26:05Z aedon.locean-ipsl.upmc.fr (Darwin)
65# commented tidy in dohtml section is moved in makehtml
66# fplod 2006-07-10T08:22:53Z aedon.locean-ipsl.upmc.fr (Darwin)
67# ajout de  white-space: pre; dans la css pour file_comments
68# fplod 2006-07-04T13:09:19Z aedon.locean-ipsl.upmc.fr (Darwin)
69# for idldoc html output
70# because preformat option doesn't seem to work well
71# replace
72# div class="value"
73# by
74# div class="preformat"
75# fplod 2006-06-19T08:46:39Z aedon.locean-ipsl.upmc.fr (Darwin)
76# for idldoc html output
77#. replace
78#     -e 's/\(href=".*\)\(\.html\)\("\)/\1\2?format=raw\3/g' \
79#     -e 's/\(href=".*\)\(\.html\)\(#.*"\)/\1\2?format=raw\3/g' \
80#     -e 's/\(src=".*\)\(\.html\)\("\)/\1\2?format=raw\3/g' \
81# by
82# -e 's@\(href="[^.]*[^h]*[^t]*[^m]*[^l]*[^"]*\)\(\.html\)\("\)@\1\2?format=raw\3@g' \
83# -e 's@\(href="[^.]*[^h]*[^t]*[^m]*[^l]*[^"]*\)\(\.html\)\(#.*"\)@\1\2?format=raw\3@g' \
84#-e 's@\(src="[^.]*[^h]*[^t]*[^m]*[^l]*[^"]*\)\(\.html\)\("\)@\1\2?format=raw\3@g'
85# in order to be able to add ?format=raw several time on one line
86# . suppress .html in line like
87# a parameter from the routine ./ReadWrite/idl-NetCDF/ncdf_read.html
88# in files idldoc-index*.html
89# fplod 2006-06-14T12:41:37Z aedon.locean-ipsl.upmc.fr (Darwin)
90# add embed parameter idldoc instructions to try to fix ticket#17
91# fplod 2006-06-07T12:11:50Z aedon.locean-ipsl.upmc.fr (Darwin)
92# add g option in ?format=raw sed transformation in order to fix
93# link on top of idldoc like directory-overview.html
94# fplod 2006-06-07T10:57:35Z aedon.locean-ipsl.upmc.fr (Darwin)
95# add ?format=raw in idldoc production for frames
96# fplod 2006-06-07T08:14:15Z aedon.locean-ipsl.upmc.fr (Darwin)
97# add action for idldochtml
98# fplod 2006-06-02T14:28:30Z aedon.locean-ipsl.upmc.fr (Darwin)
99# modification to produce tar files in /tmp/saxo_${$} when dotar=1
100# modification to copy tar files on http://forge.ipsl.jussieu.fr/saxo/download/
101# when doforge=1
102# produce tar files in /tmp/saxo_${$} when dotar=1
103set -x
104set -u
105#
106docompileall=0
107dohtml=1
108dooldtest=0
109doidlwavedoc=0
110doidldoc=0
111doTARsrc=0
112doTARdata=0
113doforge=0
114doSRClocean=0
115doDTAlocean=0
116doSRCipsl=0
117doDTAipsl=0
118doSRCidris=0
119doDTAidris=0
120dodocdownload=0
121#
122case $( whoami ) in
123    smasson)
124        lgforge=smasson
125    ;;
126    floseb)
127        lgforge=smasson
128    ;;
129    *)
130        lgforge=saxo
131    ;;
132esac
133#
134if [ ${lgforge} != smasson ]
135then
136    doSRClocean=0
137    doDTAlocean=0
138    doSRCipsl=0
139    doDTAipsl=0
140    doSRCidris=0
141    doDTAidris=0
142fi
143#
144# get the date in a nice format
145#
146ndate=`date +%Y%m%d`
147rev=$( svn info | grep -i revision | awk '{print $NF}' )
148# memorize current directory
149memopwd=$(pwd) # should be <working space>/SRC/Documentation/xmldoc
150#
151#------------------------------------------------------------------
152if [ ${docompileall} -eq 1 ]
153    then
154    cat <<EOF > /tmp/compileall${$}.pro
155.reset_session
156;
157!path = expand_path('+' + '../..') + ':' + expand_path('+' + !dir)
158resolve_all, resolve_either='def_myuniquetmpdir', skip_routines = ['xxx2ps','trends', 'label_gmt']
159resolve_all, resolve_either = 'find', skip_routines = ['xxx2ps','trends', 'label_gmt']
160def_myuniquetmpdir
161oldcm = find('oldcm_empty')
162;oldcm = find('oldcm_full')
163oldcm = oldcm[0]
164@cm_general
165file_copy, oldcm, myuniquetmpdir + 'oldcm_used.pro', /overwrite
166!path = myuniquetmpdir + ':' + !path
167IF !journal NE 0 THEN journal
168journal, myuniquetmpdir + 'cm_demomode_used.pro'
169journal
170path_cache, /rebuild
171;
172resolve_all, resolve_either='keep_compatibility', skip_routines = ['xxx2ps','trends', 'label_gmt']
173;
174EOF
175#
176    for i in $( find ${memopwd}/../.. -name "*.pro" | grep -iv label_gmt  | grep -iv report )
177      do
178# does it contains pro or function ?
179      egrep -iq '^ *    *(pro|function)' ${i}
180      if [ ${?} -eq 0 ]
181          then
182          echo "print, '$( basename ${i} .pro ) :'" >> /tmp/compileall${$}.pro
183          echo "resolve_all, resolve_either = '$( basename ${i} .pro )', skip_routines = ['xxx2ps','trends', 'label_gmt', 'report']" >> /tmp/compileall${$}.pro
184      fi
185    done
186    echo "exit" >> /tmp/compileall${$}.pro
187    IDL_STARTUP=/tmp/compileall${$}.pro
188    ${IDL_DIR}/bin/idl &> /tmp/compileallerr_${$}
189    echo
190    echo
191    grep -i "error" /tmp/compileallerr_${$}
192#    grep -q "Compilation error(s)" /tmp/compileallerr_${$}
193    if [ ${?} -ne 0 ]
194    then
195     echo "ALL SAXO files are OK..."
196     rm -f /tmp/compileallerr_${$} /tmp/compileall${$}.pro
197    else
198     grep "Compilation error(s)" /tmp/compileallerr_${$}
199     echo "eee : see /tmp/compileallerr_${$}"
200     more /tmp/compileallerr_${$}
201     exit 1
202    fi
203    echo
204    echo
205fi
206#------------------------------------------------------------------
207if [ ${dohtml} -eq 1 ]
208then
209#
210# redo the html file
211#
212    cd ${memopwd}
213    make clean
214    make html
215    make dbkcheck
216fi
217#------------------------------------------------------------------
218if [ ${dooldtest} -eq 1 ]
219then
220# make the old test
221#
222    cd ${memopwd}/../../Tests/
223    ./makeold.sh
224    exit 0
225fi
226#------------------------------------------------------------------
227if  [ ${doidlwavedoc} -eq 1 ]
228then
229#
230# redo idlwave doc
231#
232    cd ${memopwd}/../..
233    Documentation/idlwave_catalog -v -f saxo
234    exit 0
235fi
236#------------------------------------------------------------------
237if  [ ${doidldoc} -eq 1 ]
238then
239#
240    # build a idl file to launch idldoc
241    output=../idldoc_html_output/
242    log="/tmp/idldochtml_${$}.log"
243    pro="/tmp/idldochtml_${$}.pro"
244    cat <<EOF > ${pro}
245!path = expand_path('+' + '../idldoc/')
246print,!path
247idldoc,root="../../",title="SAXO Documentation", $
248LOG_FILE="${log}", $
249output="${output}", $
250overview="../../overview", /statistics, /preformat
251exit
252EOF
253    # launch idl with the file built above
254    IDL_STARTUP=${pro};${IDL_DIR}/bin/idl
255    /bin/rm ${pro}
256    # In order to do not have to many revision in svn, we modify some
257    # lines produced by idldoc :
258    # - add Source link in each html file corresponding to a .pro file
259    # example :
260    # <td>Source</td>
261    # will be replaced by
262    # <td><a href="../../Calendar/caldat.pro" title="Source code of a file">Source</a></td>
263    #
264    # - remove date and time of idldoc production
265    # examples :
266    # <!-- Generated by IDLdoc 2.0 on Wed Jun  7 10:25:28 2006 -->
267    # will be replaced by
268    # <!-- Generated by IDLdoc 2.0 -->
269    # <div id="tagline">Produced by IDLdoc 2.0 on Wed Jun  7 10:54:37 2006.</div
270    # will be replaced by
271    # <div id="tagline">Produced by IDLdoc 2.0</div>
272    # <h2>Produced on Wed Jun  7 10:23:13 2006</h2>
273    # will be delete
274    # other lines will be deleted because the time is the time of checkout not
275    # the time of revision.
276    # the sequence of lines
277    #<dl>
278    #      <dt>Last modification:</dt>
279    #       <dd>Fri Jun  2 11:46:24 2006</dd>
280    #    </dl>
281    # should also be removed ++ je ne sais pas dire en sed la ligne
282    # suivant l'occurence de Last modification
283    #
284    # count of directory levels in output
285    # this count will be use to format relative path later
286    nblev1=$(echo ${output} | sed -e "s@/\$@@" |awk -F "/" '{print NF}')
287    #
288    list_html_pro=$(find ${output} -name "*.html" -exec grep -l "<title>.*\.pro" {} \;)
289    for file_html in ${list_html_pro}
290    do
291     # build the .pro file name
292     bfile=$(basename ${file_html} .html)
293     # retrieve the path of html file relative to memopwd (so relative to
294     # output). This path will be used in "Source" link.
295     nblev2=$(dirname ${file_html} |  sed -e "s@/\$@@" | awk -F "/" '{print NF}')
296     difflev=$((${nblev2} - ${nblev1}))
297     if [ ${difflev} -ge 2 ]
298     then
299      ilev=1
300      reloutput_html=".."
301      while [ ${ilev} -le ${difflev} ]
302      do
303       reloutput_html="${reloutput_html}/.."
304       ilev=$(( ${ilev} + 1 ))
305      done
306      relpath_html=$(dirname ${file_html} | \
307                   sed -e "s@${output}@${reloutput_html}@" \
308                       -e "s@\$@/@")
309      # echo "relpath ${relpath_html})"
310     else
311      relpath_html="./"
312     fi
313     # echo "relpath ${relpath_html}/${bfile}"
314     sed \
315     -e "s@<td >Source<\/td>@<td><a href=\"${relpath_html}/${bfile}.pro\" title=\"Source code of a file\">Source<\/a><\/td>@" \
316     ${file_html} > ${file_html}_modify
317     mv ${file_html}_modify ${file_html}
318    done
319    list_html=$(find ${output} -name "*.html")
320    for file_html in ${list_html}
321    do
322     sed \
323     -e "s/\(Generated by IDLdoc 2.0\)\( on .*\)\( -->\)/\1\3/" \
324     -e "s/\(Produced by IDLdoc 2.0\)\( on .*\)\(\.<\/div>\)/\1\3/" \
325     -e "/<h2>Produced on/d" \
326     -e "/Last modification:/d" \
327     -e "/<dd>... ... .* ..:..:.. ....<\/dd>/d" \
328     -e 's@<div class="value">@<div class="preformat">@' \
329     -e 's/div\#file_comments {/div\#file_comments { white-space: pre;/' \
330     -e 's@^ <fixe>@<pre>@' \
331     -e 's@^ </fixe>@</pre>@' \
332     -e 's@xhtml-transitional@xhtml1-transitional@' \
333     ${file_html} > ${file_html}_modify
334     mv ${file_html}_modify ${file_html}
335    done
336    # suppress ".html" in idldoc-index*.html in lines like
337    # a parameter from the routine ./ReadWrite/idl-NetCDF/ncdf_read.html
338    list_html=$(find ${output} -name "idldoc-index*.html")
339    for file_html in ${list_html}
340    do
341     sed \
342     -e "s/\(a parameter from the routine \)\(.*\)\(.html\)/\1\2/" \
343     ${file_html} > ${file_html}_modify
344     mv ${file_html}_modify ${file_html}
345    done
346    # replace <pro>ginette</pro> by a sequence like
347    # <a href="./ginette.html">ginette</a>
348    ./pro2href.sh -i ${output} -r ${output} -e pro
349    status=${?}
350    if [ ${status} -ne 0 ]
351    then
352       echo "eee : pb during ./pro2href.sh for <pro>...</pro>"
353       exit 1
354    fi
355    # replace <proidl>ginette</proidl> by a sequence like
356    # <a href="./ginette.html">ginette</a>
357    ./pro2href.sh -i ${output} -r ${IDL_DIR}/help/online_help -e proidl
358    status=${?}
359    if [ ${status} -ne 0 ]
360    then
361       echo "eee : pb during ./pro2href.sh for <proidl>...</proidl>"
362       exit 1
363    fi
364    echo "iii : you can see log file in ${log}"
365    echo "iii : and look ${output}/idldoc-warnings.html#undoc"
366#
367    # build a idl file to launch idldoc
368    output=../idldoc_assistant_output/
369    log="/tmp/idldocassistant_${$}.log"
370    pro="/tmp/idldocassistant_${$}.pro"
371    cat <<EOF > ${pro}
372!path = expand_path('+' + '../idldoc/')
373print,!path
374idldoc,root="../../",title="SAXO Documentation Assistant", $
375LOG_FILE="${log}", $
376output="${output}", overview='../../overview', /statistics, /preformat, /embed, /assistant
377exit
378EOF
379    # launch idl with the file built above
380    IDL_STARTUP=${pro};${IDL_DIR}/bin/idl
381    /bin/rm ${pro}
382    # In order to do not have to many revision in svn, we modify some
383    # lines produced by idldoc :
384    # examples :
385    # <!-- Generated by IDLdoc 2.0 on Wed Jun  7 10:25:28 2006 -->
386    # will be replaced by
387    # <!-- Generated by IDLdoc 2.0 -->
388    # <p><font color="gray" size="-3">&nbsp;&nbsp;Produced by IDLdoc 2.0 on Wed Sep 13 16:32:10 2006.</font></p>
389    # will be replaced by
390    # <p><font color="gray" size="-3">&nbsp;&nbsp;Produced by IDLdoc 2.0</font></p>
391    # <h2>Produced on Wed Jun  7 10:23:13 2006</h2>
392    # will be delete
393    # other lines will be deleted because the time is the time of checkout not
394    # the time of revision.
395    # the sequence of lines
396    #<dl>
397    #      <dt>Last modification:</dt>
398    #       <dd>Fri Jun  2 11:46:24 2006</dd>
399    #    </dl>
400    # should also be removed ++ je ne sais pas dire en sed la ligne
401    # suivant l'occurence de Last modification
402    # replace *_param_* in href attributes because anchors are badly written
403    # with _keyword_
404    #++ -e 's@\(href="#_.*\)\(_param_\)\(.*"\)@\1_keyword_\3@g' \ # ++ pb global
405    #  ONLINE_HELP, book="../idldoc_assistant_output/idldoc-lib.adp", /full_path    # won't work
406    # encaspulate example content in <pre> </pre> in idldoc assistant outputs
407    # Examples section is supposed to start with <h3>Examples</h3>
408    # and end is before <h3>Version history</h3>
409    list_html=$(find ${output} -name "*.html")
410    for file_html in ${list_html}
411    do
412     sed \
413     -e "s/\(Generated by IDLdoc 2.0\)\( on .*\)\( -->\)/\1\3/" \
414     -e "s/\(Produced by IDLdoc 2.0\)\( on .*\)\(\.<\/font>\)/\1\3/" \
415     -e "/<h2>Produced on/d" \
416     -e "/Last modification:/d" \
417     -e "/<dd>... ... .* ..:..:.. ....<\/dd>/d" \
418     -e '/href/s@_param_@_keyword_@g' \
419     -e 's@<div class="value">@<div class="preformat">@' \
420     -e 's/div\#file_comments {/div\#file_comments { white-space: pre;/' \
421     -e 's@^ <fixe>@<pre>@' \
422     -e 's@^ </fixe>@</pre>@' \
423     -e "s@<h3>Examples</h3>@<h3>Examples</h3><pre>@" \
424     -e "s@<h3>Version history</h3>@</pre><h3>Version history</h3>@" \
425     ${file_html} > ${file_html}_modify
426     mv ${file_html}_modify ${file_html}
427    done
428    # replace <pro>ginette</pro> by a sequence like
429    # <a href="./ginette.html">ginette</a>
430    ./pro2href.sh -i ${output} -r ${output} -e pro
431    status=${?}
432    if [ ${status} -ne 0 ]
433    then
434       echo "eee : pb during ./pro2href.sh for <pro>...</pro>"
435       exit 1
436    fi
437    # replace <proidl>ginette</proidl> by a sequence like
438    # <a href="./ginette.html">ginette</a>
439    ./pro2href.sh  -i ${output} -r ${IDL_DIR}/help/online_help -e proidl
440    status=${?}
441    if [ ${status} -ne 0 ]
442    then
443       echo "eee : pb during ./pro2href.sh for <proidl>...</proidl>"
444       exit 1
445    fi
446    # add the directory-overview.html from dir-files.html in idldoc_html_output
447    list_html=$(find ../idldoc_html_output -name dir-files.html)
448    for file_html in ${list_html}
449    do
450      fout=../idldoc_assistant_output/${file_html#../idldoc_html_output/*}
451      fout=${fout%/*}/directory-overview.html
452      cp ${file_html} ${fout}
453    done
454    # copy listings.css (needed by directory-overview.html files)
455    cp ../idldoc/resource/listings.css ${output}
456    # add an id in idldoc-lib.adp
457    cat << EOF > /tmp/adp_modification
458<!-- \$Id\$ -->
459EOF
460    sed -e "/<\/profile>/r /tmp/adp_modification" \
461     ../idldoc_assistant_output/idldoc-lib.adp > \
462     ../idldoc_assistant_output/idldoc-lib.adp_${$}
463    mv ../idldoc_assistant_output/idldoc-lib.adp_${$} \
464    ../idldoc_assistant_output/idldoc-lib.adp
465    rm /tmp/adp_modification
466    echo "iii : you can see log file in ${log}"
467    echo "iii : and look ${output}/idldoc-warnings.html#undoc"
468    # check that the number of existing html files for each .pro file is 2!
469    for i in $( find ../.. -name "*.pro" )
470    do
471      nhtml=$( find ../.. -name $( basename ${i} .pro ).html | wc -l )
472      if [ ${nhtml} -ne 2 ]
473          then
474          echo "ERROR there is not 2 $( basename ${i} .pro ).html files"
475          find ../.. -name $( basename ${i} .pro ).html
476          echo
477      fi
478    done
479fi
480#------------------------------------------------------------------
481if [ ${doTARsrc} -eq 1 ]
482then
483    localtarbase=/tmp/savesaxo_${$}
484    mkdir  ${localtarbase}/
485# clean backup files : *~
486    find ${memopwd}/../../.. -name "*~" -exec rm {} \;
487# prepare the source tar (without the svn...)
488#
489    cd ${memopwd}/../../..
490    tar czf ${localtarbase}/SAXO_SRC_${ndate}r${rev}.tar.gz --exclude .svn SRC
491#
492#   informations
493    echo "iii : following file may be copied on http://forge.ipsl.jussieu.fr/saxo/download/"
494    ls -l ${localtarbase}
495fi
496#------------------------------------------------------------------
497if [ ${doTARdata} -eq 1 ]
498then
499    localtarbase=/tmp/savesaxo_${$}
500    mkdir  ${localtarbase}/
501#
502# prepare the data tar (without the svn...)
503#
504    cd ${memopwd}/../../..
505    tar czf ${localtarbase}/SAXO_DATA_${ndate}.tar.gz  --exclude .svn DATA
506#
507#   informations
508    echo "iii : following file may be copied on http://forge.ipsl.jussieu.fr/saxo/download/"
509    ls -l ${localtarbase}
510fi
511#------------------------------------------------------------------
512if [ ${doforge} -eq 1 ]
513then
514    echo "iii : you will be asked ${lgforge}@forge.ipsl.jussieu.fr passwd two times"
515    if [ ${doTARsrc} -ne 1 ]
516    then
517       localtarbase=${1}
518    fi
519    scp ${localtarbase}/SAXO_*.tar.gz ${lgforge}@forge.ipsl.jussieu.fr:/ipsl/forge/projets/saxo/download/
520    echo "iii : do not forget to update getsaxo.html"
521    echo "iii : \$ make ./getsaxo.html"
522    echo "iii : do not forget to clean ${localtarbase}"
523fi
524#------------------------------------------------------------------
525if [[ (${doDTAlocean} -eq 1) || (${doDTAipsl} -eq 1) ]]
526then
527    echo "iii : you will be asked ${lgforge}@forge.ipsl.jussieu.fr passwd"
528    infodata=$(ssh ${lgforge}@forge.ipsl.jussieu.fr ls -lht /ipsl/forge/projets/saxo/download/SAXO_DATA_*.tar.gz | head -n 1)
529    filedata=$(echo ${infodata} | awk '{print $NF}')
530    filedata=$(basename ${filedata})
531    cat <<EOF > job_data_$$
532#!/bin/bash
533cd SAXO_DIR
534#
535rm -rf DATA
536wget http://forge.ipsl.jussieu.fr/saxo/download/${filedata}
537gunzip ${filedata}
538tar vxf $( basename ${filedata} .gz )
539rm -f $( basename ${filedata} .gz )
540#
541chmod -R 755 *
542exit
543#
544EOF
545fi
546#------------------------------------------------------------------
547if [ ${doSRClocean} -eq 1 ]
548then
549# update src on cerbere
550#
551    echo "iii : update src on cerbere"
552    ssh smasson@cerbere.locean-ipsl.upmc.fr "svn update SAXO_DIR/SRC ; chmod -R 755 SAXO_DIR"
553fi
554#------------------------------------------------------------------
555if [ ${doDTAlocean} -eq 1 ]
556then
557# update data on cerbere
558    echo "iii : update data on cerbere"
559    scp job_data_$$ smasson@cerbere.locean-ipsl.upmc.fr:.
560    ssh smasson@cerbere.locean-ipsl.upmc.fr "chmod 755 job_data_$$ ; ./job_data_$$ ; rm -f job_data_$$"
561fi
562#------------------------------------------------------------------
563if [ ${doSRCipsl} -eq 1 ]
564then
565# update src on calcul2
566#
567    echo "iii : update src on calcul2"
568    ssh smlod@calcul2.ipsl.jussieu.fr "svn update SAXO_DIR/SRC ; chmod -R 755 SAXO_DIR"
569fi
570#------------------------------------------------------------------
571if [ ${doDTAipsl} -eq 1 ]
572then
573# update data on cook
574    echo "iii : update data on cook"
575    scp job_data_$$ smlod@cook.ipsl.jussieu.fr:.
576    ssh smlod@cook.ipsl.jussieu.fr "chmod 755 job_data_$$ ; ./job_data_$$ ; rm -f job_data_$$"
577fi
578#------------------------------------------------------------------
579if [ ${doSRCidris} -eq 1 ]
580then
581# update src on rhodes
582    echo "iii : update src to rhodes"
583    ssh -t smasson@cerbere.locean-ipsl.upmc.fr ssh reee217@rhodes.idris.fr "/usr/local/pub/svn/svn-1.3.1/bin/svn update SAXO_DIR/SRC ; chmod -R 755 SAXO_DIR"
584fi
585#------------------------------------------------------------------
586if [ ${doDTAidris} -eq 1 ]
587then
588# create the update script for rhodes
589    if [[ (${doDTAlocean} -eq 0) && (${doDTAipsl} -eq 0) ]]
590        then
591        echo "iii : you will be asked ${lgforge}@forge.ipsl.jussieu.fr passwd"
592        infodata=$(ssh ${lgforge}@forge.ipsl.jussieu.fr ls -lht /ipsl/forge/projets/saxo/download/SAXO_DATA_*.tar.gz | head -n 1)
593        filedata=$(echo ${infodata} | awk '{print $NF}')
594        filedata=$(basename ${filedata})
595    fi
596    cat <<EOF > job_data_idris_$$
597#!/bin/ksh
598cd SAXO_DIR
599#
600rm -rf DATA
601echo "iii : you will be asked ${lgforge}@forge.ipsl.jussieu.fr passwd"
602scp ${lgforge}@forge.ipsl.jussieu.fr:/ipsl/forge/projets/saxo/download/${filedata} .
603gunzip ${filedata}
604tar vxf $( basename ${filedata} .gz )
605rm -f $( basename ${filedata} .gz )
606#
607chmod -R 755 *
608exit
609#
610EOF
611# update data on gaya
612    echo "iii : update data to gaya"
613    scp job_data_idris_$$ reee217@gaya.idris.fr:.
614    ssh reee217@gaya.idris.fr "chmod 755 job_data_idris_$$ ; ./job_data_idris_$$ ; rm -f job_data_idris_$$"
615fi
616#------------------------------------------------------------------
617if [ ${dodocdownload} -eq 1 ]
618then
619    # ++ on pourrait peut-etre faire un rsync en enlevant les .sh et le .xsl
620    # et faire le ménage des fichiers qui n'existent plus
621    echo "iii : you will be asked ${lgforge}@forge.ipsl.jussieu.fr passwd several times"
622    #
623    # copy files in a temporary directory
624    mkdir /tmp/download_${$}/
625    cp -rp ../xmldoc /tmp/download_${$}/
626    cp -rp ../idldoc_html_output /tmp/download_${$}/
627    #
628    # remove svn files
629    find /tmp/download_${$}/ -name ".svn" -exec rm -rf {} \;
630    #
631    # replace relative path
632    # by http://forge.ipsl.jussieu.fr/saxo/browser/trunk/SRC/
633    # on ulink lines containing some directories like ../../ToBeReviewed/ or ../../Test/ or file like newheader.txt
634    list_html=$(find /tmp/download_${$}/ -name "*.html")
635    for file_html in ${list_html}
636    do
637     sed  \
638     -e "/Source code of a file/s+../.*/../+http://forge.ipsl.jussieu.fr/saxo/browser/trunk/SRC/+" \
639     -e "/..\/..\/ToBeReviewed/s+../../+http://forge.ipsl.jussieu.fr/saxo/browser/trunk/SRC/+" \
640     -e "/..\/..\/Test/s+../../+http://forge.ipsl.jussieu.fr/saxo/browser/trunk/SRC/+"  \
641     -e "/..\/..\/Calendar/s+../../+http://forge.ipsl.jussieu.fr/saxo/browser/trunk/SRC/+" \
642     -e "/..\/newheader/s+../../+http://forge.ipsl.jussieu.fr/saxo/browser/trunk/SRC/Documentation/+" \
643     ${file_html} > ${file_html}_${$}
644     mv ${file_html}_${$} ${file_html}
645    done
646    echo
647    echo "give SAXO password if asked"
648    scp -rp /tmp/download_${$}/* saxo@forge.ipsl.jussieu.fr:/ipsl/forge/projets/saxo/download/
649    rm -rf /tmp/download_${$}/
650fi
651#------------------------------------------------------------------
652#------------------------------------------------------------------
653#
654[ -f job_src_$$ ] && rm -f job_src_$$
655[ -f job_data_$$ ] && rm -f job_data_$$
656[ -f job_data_idris_$$ ] && rm -f job_data_idris_$$
657#
658exit
659#
Note: See TracBrowser for help on using the repository browser.