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

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

new wiki generation technique : form _full.xml instead of .html

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