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

Last change on this file since 253 was 253, checked in by pinsard, 17 years ago

improvment of links in idldoc outputs but still not perfect. see ticket:62

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