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
RevLine 
[144]1#!/bin/bash
[186]2#
[123]3# update :
4# $Id$
[345]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
[262]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>
[253]11# fplod 2007-06-26T14:33:12Z aedon.locean-ipsl.upmc.fr (Darwin)
12# copy listings.css in idldoc_assistant_output
[233]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
[195]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!
[191]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
[189]28# fplod 2006-09-21T13:05:32Z aedon.locean-ipsl.upmc.fr (Darwin)
[191]29# add an svn id in idldoc-lib.adb after </profile>
[188]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)
[233]33# add copy of html files unedr xmldoc and idldoc_html_output on
[188]34# saxo@forge.ipsl.jussieu.fr:/ipsl/forge/projets/saxo/download/
35# see dodocdownload
[187]36# fplod 2006-09-20T11:05:23Z aedon.locean-ipsl.upmc.fr (Darwin)
[191]37# correction to really suppress date in idldoc assistant outputs (font
[187]38# instaed of div in html output)
[183]39# fplod 2006-09-18T13:25:12Z aedon.locean-ipsl.upmc.fr (Darwin)
40# add status checking after makehtml.sh
[182]41# smasson Fri Sep 15 10:42:01 CEST 2006
42# merge idldoc html and idldoc assistant
[179]43# smasson Thu Sep 14 15:19:23 CEST 2006
44# add the revision number in the name of SAXO_SRC_*.tar.gz
[176]45# smasson Wed Sep 13 14:18:02 CEST 2006
46# add the directory-overview.html from dir-files.html in idldoc_html_output
[170]47# fplod 2006-09-07T08:09:47Z aedon.locean-ipsl.upmc.fr (Darwin)
48# main is rename to websaxo
[168]49# fplod 2006-09-05T15:39:47Z aedon.locean-ipsl.upmc.fr (Darwin)
50# add Source link in idldoc html outpout
[163]51# snlod/fplod 2006-08-25T08:30:36Z electre.locean-ipsl.upmc.fr (Darwin)
52# add for idldoc assistant
[156]53# fplod 2006-08-17T09:19:06Z aedon.locean-ipsl.upmc.fr (Darwin)
[183]54# add transformation after idldoc to force non-proportional font
[156]55# on bloc delimited by
[163]56#  <fixe>
57#  </fixe>
[156]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
[144]62# fplod 2006-07-21T08:23:52Z aedon.locean-ipsl.upmc.fr (Darwin)
63# add mini_notice production
[140]64# fplod 2006-07-11T08:26:05Z aedon.locean-ipsl.upmc.fr (Darwin)
65# commented tidy in dohtml section is moved in makehtml
[135]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
[123]68# fplod 2006-07-04T13:09:19Z aedon.locean-ipsl.upmc.fr (Darwin)
[186]69# for idldoc html output
[123]70# because preformat option doesn't seem to work well
[186]71# replace
[123]72# div class="value"
73# by
74# div class="preformat"
[111]75# fplod 2006-06-19T08:46:39Z aedon.locean-ipsl.upmc.fr (Darwin)
[186]76# for idldoc html output
[111]77#. replace
78#     -e 's/\(href=".*\)\(\.html\)\("\)/\1\2?format=raw\3/g' \
79#     -e 's/\(href=".*\)\(\.html\)\(#.*"\)/\1\2?format=raw\3/g' \
[123]80#     -e 's/\(src=".*\)\(\.html\)\("\)/\1\2?format=raw\3/g' \
[186]81# by
[111]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
[186]86# . suppress .html in line like
[111]87# a parameter from the routine ./ReadWrite/idl-NetCDF/ncdf_read.html
88# in files idldoc-index*.html
[109]89# fplod 2006-06-14T12:41:37Z aedon.locean-ipsl.upmc.fr (Darwin)
[183]90# add embed parameter idldoc instructions to try to fix ticket#17
[91]91# fplod 2006-06-07T12:11:50Z aedon.locean-ipsl.upmc.fr (Darwin)
[186]92# add g option in ?format=raw sed transformation in order to fix
[91]93# link on top of idldoc like directory-overview.html
[90]94# fplod 2006-06-07T10:57:35Z aedon.locean-ipsl.upmc.fr (Darwin)
95# add ?format=raw in idldoc production for frames
[89]96# fplod 2006-06-07T08:14:15Z aedon.locean-ipsl.upmc.fr (Darwin)
97# add action for idldochtml
[86]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#
[345]106docompileall=0
107dohtml=1
[86]108dooldtest=0
[321]109doidlwavedoc=0
[327]110doidldoc=0
[116]111doTARsrc=0
[88]112doTARdata=0
[116]113doforge=0
[291]114doSRClocean=0
115doDTAlocean=0
[100]116doSRCipsl=0
117doDTAipsl=0
118doSRCidris=0
119doDTAidris=0
[189]120dodocdownload=0
[86]121#
[100]122case $( whoami ) in
123    smasson)
124        lgforge=smasson
125    ;;
126    floseb)
127        lgforge=smasson
128    ;;
129    *)
130        lgforge=saxo
131    ;;
132esac
[88]133#
[100]134if [ ${lgforge} != smasson ]
135then
[291]136    doSRClocean=0
137    doDTAlocean=0
[100]138    doSRCipsl=0
139    doDTAipsl=0
140    doSRCidris=0
141    doDTAidris=0
[186]142fi
[100]143#
[88]144# get the date in a nice format
145#
146ndate=`date +%Y%m%d`
[179]147rev=$( svn info | grep -i revision | awk '{print $NF}' )
[86]148# memorize current directory
149memopwd=$(pwd) # should be <working space>/SRC/Documentation/xmldoc
[100]150#
[88]151#------------------------------------------------------------------
[100]152if [ ${docompileall} -eq 1 ]
153    then
154    cat <<EOF > /tmp/compileall${$}.pro
[186]155.reset_session
[114]156;
[100]157!path = expand_path('+' + '../..') + ':' + expand_path('+' + !dir)
[115]158resolve_all, resolve_either='def_myuniquetmpdir', skip_routines = ['xxx2ps','trends', 'label_gmt']
159resolve_all, resolve_either = 'find', skip_routines = ['xxx2ps','trends', 'label_gmt']
[114]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
[239]166!path = myuniquetmpdir + ':' + !path
[114]167IF !journal NE 0 THEN journal
168journal, myuniquetmpdir + 'cm_demomode_used.pro'
[186]169journal
[239]170path_cache, /rebuild
[114]171;
[115]172resolve_all, resolve_either='keep_compatibility', skip_routines = ['xxx2ps','trends', 'label_gmt']
[114]173;
[100]174EOF
175#
[324]176    for i in $( find ${memopwd}/../.. -name "*.pro" | grep -iv label_gmt  | grep -iv report )
[100]177      do
[115]178# does it contains pro or function ?
[233]179      egrep -iq '^ *    *(pro|function)' ${i}
180      if [ ${?} -eq 0 ]
[100]181          then
[233]182          echo "print, '$( basename ${i} .pro ) :'" >> /tmp/compileall${$}.pro
[324]183          echo "resolve_all, resolve_either = '$( basename ${i} .pro )', skip_routines = ['xxx2ps','trends', 'label_gmt', 'report']" >> /tmp/compileall${$}.pro
[100]184      fi
185    done
[291]186    echo "exit" >> /tmp/compileall${$}.pro
[100]187    IDL_STARTUP=/tmp/compileall${$}.pro
[120]188    ${IDL_DIR}/bin/idl &> /tmp/compileallerr_${$}
[100]189    echo
190    echo
[114]191    grep -i "error" /tmp/compileallerr_${$}
192#    grep -q "Compilation error(s)" /tmp/compileallerr_${$}
[186]193    if [ ${?} -ne 0 ]
[105]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_${$}"
[115]200     more /tmp/compileallerr_${$}
[105]201     exit 1
202    fi
[100]203    echo
204    echo
205fi
206#------------------------------------------------------------------
[86]207if [ ${dohtml} -eq 1 ]
208then
209#
210# redo the html file
211#
212    cd ${memopwd}
[345]213    make clean
214    make html
215    make dbkcheck
[86]216fi
[88]217#------------------------------------------------------------------
[86]218if [ ${dooldtest} -eq 1 ]
219then
220# make the old test
221#
222    cd ${memopwd}/../../Tests/
223    ./makeold.sh
224    exit 0
225fi
[88]226#------------------------------------------------------------------
[86]227if  [ ${doidlwavedoc} -eq 1 ]
228then
229#
230# redo idlwave doc
231#
[107]232    cd ${memopwd}/../..
[86]233    Documentation/idlwave_catalog -v -f saxo
234    exit 0
235fi
[88]236#------------------------------------------------------------------
[182]237if  [ ${doidldoc} -eq 1 ]
[86]238then
239#
[89]240    # build a idl file to launch idldoc
[111]241    output=../idldoc_html_output/
[233]242    log="/tmp/idldochtml_${$}.log"
243    pro="/tmp/idldochtml_${$}.pro"
[111]244    cat <<EOF > ${pro}
[89]245!path = expand_path('+' + '../idldoc/')
246print,!path
[111]247idldoc,root="../../",title="SAXO Documentation", $
248LOG_FILE="${log}", $
[163]249output="${output}", $
[191]250overview="../../overview", /statistics, /preformat
[89]251exit
252EOF
253    # launch idl with the file built above
[120]254    IDL_STARTUP=${pro};${IDL_DIR}/bin/idl
[111]255    /bin/rm ${pro}
[89]256    # In order to do not have to many revision in svn, we modify some
257    # lines produced by idldoc :
[191]258    # - add Source link in each html file corresponding to a .pro file
[168]259    # example :
260    # <td>Source</td>
261    # will be replaced by
[188]262    # <td><a href="../../Calendar/caldat.pro" title="Source code of a file">Source</a></td>
[168]263    #
264    # - remove date and time of idldoc production
[89]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>
[186]273    # will be delete
274    # other lines will be deleted because the time is the time of checkout not
[89]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
[191]283    #
[168]284    # count of directory levels in output
[233]285    # this count will be use to format relative path later
[168]286    nblev1=$(echo ${output} | sed -e "s@/\$@@" |awk -F "/" '{print NF}')
287    #
[233]288    list_html_pro=$(find ${output} -name "*.html" -exec grep -l "<title>.*\.pro" {} \;)
[191]289    for file_html in ${list_html_pro}
[89]290    do
[183]291     # build the .pro file name
[168]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@\$@/@")
[233]309      # echo "relpath ${relpath_html})"
[168]310     else
311      relpath_html="./"
312     fi
313     # echo "relpath ${relpath_html}/${bfile}"
[89]314     sed \
[188]315     -e "s@<td >Source<\/td>@<td><a href=\"${relpath_html}/${bfile}.pro\" title=\"Source code of a file\">Source<\/a><\/td>@" \
[191]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 \
[89]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" \
[123]328     -e 's@<div class="value">@<div class="preformat">@' \
[135]329     -e 's/div\#file_comments {/div\#file_comments { white-space: pre;/' \
[191]330     -e 's@^ <fixe>@<pre>@' \
331     -e 's@^ </fixe>@</pre>@' \
332     -e 's@xhtml-transitional@xhtml1-transitional@' \
[89]333     ${file_html} > ${file_html}_modify
334     mv ${file_html}_modify ${file_html}
335    done
[111]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
[233]346    # replace <pro>ginette</pro> by a sequence like
347    # <a href="./ginette.html">ginette</a>
[262]348    ./pro2href.sh -i ${output} -r ${output} -e pro
[233]349    status=${?}
350    if [ ${status} -ne 0 ]
351    then
[262]352       echo "eee : pb during ./pro2href.sh for <pro>...</pro>"
[233]353       exit 1
354    fi
[262]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
[111]364    echo "iii : you can see log file in ${log}"
365    echo "iii : and look ${output}/idldoc-warnings.html#undoc"
[86]366#
[163]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 -->
[187]388    # <p><font color="gray" size="-3">&nbsp;&nbsp;Produced by IDLdoc 2.0 on Wed Sep 13 16:32:10 2006.</font></p>
[163]389    # will be replaced by
[187]390    # <p><font color="gray" size="-3">&nbsp;&nbsp;Produced by IDLdoc 2.0</font></p>
[163]391    # <h2>Produced on Wed Jun  7 10:23:13 2006</h2>
[186]392    # will be delete
393    # other lines will be deleted because the time is the time of checkout not
[163]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
[233]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>
[163]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/" \
[187]414     -e "s/\(Produced by IDLdoc 2.0\)\( on .*\)\(\.<\/font>\)/\1\3/" \
[163]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;/' \
[191]421     -e 's@^ <fixe>@<pre>@' \
[163]422     -e 's@^ </fixe>@</pre>@' \
[233]423     -e "s@<h3>Examples</h3>@<h3>Examples</h3><pre>@" \
424     -e "s@<h3>Version history</h3>@</pre><h3>Version history</h3>@" \
[163]425     ${file_html} > ${file_html}_modify
426     mv ${file_html}_modify ${file_html}
427    done
[233]428    # replace <pro>ginette</pro> by a sequence like
429    # <a href="./ginette.html">ginette</a>
[262]430    ./pro2href.sh -i ${output} -r ${output} -e pro
[233]431    status=${?}
432    if [ ${status} -ne 0 ]
433    then
[262]434       echo "eee : pb during ./pro2href.sh for <pro>...</pro>"
[233]435       exit 1
436    fi
[262]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
[176]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/*}
[186]451      fout=${fout%/*}/directory-overview.html
[188]452      cp ${file_html} ${fout}
[176]453    done
[253]454    # copy listings.css (needed by directory-overview.html files)
455    cp ../idldoc/resource/listings.css ${output}
[189]456    # add an id in idldoc-lib.adp
457    cat << EOF > /tmp/adp_modification
458<!-- \$Id\$ -->
459EOF
[191]460    sed -e "/<\/profile>/r /tmp/adp_modification" \
[189]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
[163]466    echo "iii : you can see log file in ${log}"
467    echo "iii : and look ${output}/idldoc-warnings.html#undoc"
[195]468    # check that the number of existing html files for each .pro file is 2!
469    for i in $( find ../.. -name "*.pro" )
[233]470    do
471      nhtml=$( find ../.. -name $( basename ${i} .pro ).html | wc -l )
472      if [ ${nhtml} -ne 2 ]
[195]473          then
[291]474          echo "ERROR there is not 2 $( basename ${i} .pro ).html files"
[233]475          find ../.. -name $( basename ${i} .pro ).html
[195]476          echo
477      fi
478    done
[86]479fi
[88]480#------------------------------------------------------------------
481if [ ${doTARsrc} -eq 1 ]
[86]482then
483    localtarbase=/tmp/savesaxo_${$}
484    mkdir  ${localtarbase}/
[87]485# clean backup files : *~
[88]486    find ${memopwd}/../../.. -name "*~" -exec rm {} \;
[87]487# prepare the source tar (without the svn...)
[86]488#
[87]489    cd ${memopwd}/../../..
[179]490    tar czf ${localtarbase}/SAXO_SRC_${ndate}r${rev}.tar.gz --exclude .svn SRC
[86]491#
[87]492#   informations
[89]493    echo "iii : following file may be copied on http://forge.ipsl.jussieu.fr/saxo/download/"
[87]494    ls -l ${localtarbase}
495fi
[88]496#------------------------------------------------------------------
497if [ ${doTARdata} -eq 1 ]
[87]498then
499    localtarbase=/tmp/savesaxo_${$}
500    mkdir  ${localtarbase}/
[86]501#
[87]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#
[86]507#   informations
[89]508    echo "iii : following file may be copied on http://forge.ipsl.jussieu.fr/saxo/download/"
[86]509    ls -l ${localtarbase}
510fi
[88]511#------------------------------------------------------------------
[86]512if [ ${doforge} -eq 1 ]
513then
[100]514    echo "iii : you will be asked ${lgforge}@forge.ipsl.jussieu.fr passwd two times"
[88]515    if [ ${doTARsrc} -ne 1 ]
[86]516    then
[89]517       localtarbase=${1}
[86]518    fi
[100]519    scp ${localtarbase}/SAXO_*.tar.gz ${lgforge}@forge.ipsl.jussieu.fr:/ipsl/forge/projets/saxo/download/
[86]520    echo "iii : do not forget to update getsaxo.html"
[345]521    echo "iii : \$ make ./getsaxo.html"
[86]522    echo "iii : do not forget to clean ${localtarbase}"
523fi
[88]524#------------------------------------------------------------------
[291]525if [[ (${doDTAlocean} -eq 1) || (${doDTAipsl} -eq 1) ]]
[88]526then
[100]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}')
[233]530    filedata=$(basename ${filedata})
[88]531    cat <<EOF > job_data_$$
[100]532#!/bin/bash
[88]533cd SAXO_DIR
[86]534#
[88]535rm -rf DATA
[233]536wget http://forge.ipsl.jussieu.fr/saxo/download/${filedata}
537gunzip ${filedata}
538tar vxf $( basename ${filedata} .gz )
539rm -f $( basename ${filedata} .gz )
[88]540#
541chmod -R 755 *
542exit
543#
[86]544EOF
[88]545fi
546#------------------------------------------------------------------
[291]547if [ ${doSRClocean} -eq 1 ]
[88]548then
549# update src on cerbere
[86]550#
[100]551    echo "iii : update src on cerbere"
[304]552    ssh smasson@cerbere.locean-ipsl.upmc.fr "svn update SAXO_DIR/SRC ; chmod -R 755 SAXO_DIR"
[88]553fi
554#------------------------------------------------------------------
[291]555if [ ${doDTAlocean} -eq 1 ]
[88]556then
557# update data on cerbere
558    echo "iii : update data on cerbere"
[304]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_$$"
[88]561fi
562#------------------------------------------------------------------
[233]563if [ ${doSRCipsl} -eq 1 ]
[100]564then
[116]565# update src on calcul2
[100]566#
[116]567    echo "iii : update src on calcul2"
568    ssh smlod@calcul2.ipsl.jussieu.fr "svn update SAXO_DIR/SRC ; chmod -R 755 SAXO_DIR"
[100]569fi
570#------------------------------------------------------------------
[233]571if [ ${doDTAipsl} -eq 1 ]
[100]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#------------------------------------------------------------------
[233]579if [ ${doSRCidris} -eq 1 ]
[88]580then
581# update src on rhodes
582    echo "iii : update src to rhodes"
[209]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"
[88]584fi
585#------------------------------------------------------------------
[233]586if [ ${doDTAidris} -eq 1 ]
[88]587then
[100]588# create the update script for rhodes
[291]589    if [[ (${doDTAlocean} -eq 0) && (${doDTAipsl} -eq 0) ]]
[100]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}')
[233]594        filedata=$(basename ${filedata})
[100]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"
[233]602scp ${lgforge}@forge.ipsl.jussieu.fr:/ipsl/forge/projets/saxo/download/${filedata} .
603gunzip ${filedata}
604tar vxf $( basename ${filedata} .gz )
605rm -f $( basename ${filedata} .gz )
[100]606#
607chmod -R 755 *
608exit
609#
610EOF
[88]611# update data on gaya
612    echo "iii : update data to gaya"
[100]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_$$"
[88]615fi
616#------------------------------------------------------------------
[188]617if [ ${dodocdownload} -eq 1 ]
618then
619    # ++ on pourrait peut-etre faire un rsync en enlevant les .sh et le .xsl
[189]620    # et faire le ménage des fichiers qui n'existent plus
[188]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_${$}/
[197]625    cp -rp ../xmldoc /tmp/download_${$}/
[188]626    cp -rp ../idldoc_html_output /tmp/download_${$}/
627    #
628    # remove svn files
629    find /tmp/download_${$}/ -name ".svn" -exec rm -rf {} \;
630    #
[191]631    # replace relative path
[189]632    # by http://forge.ipsl.jussieu.fr/saxo/browser/trunk/SRC/
[191]633    # on ulink lines containing some directories like ../../ToBeReviewed/ or ../../Test/ or file like newheader.txt
[188]634    list_html=$(find /tmp/download_${$}/ -name "*.html")
635    for file_html in ${list_html}
636    do
[191]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}
[188]645    done
[197]646    echo
[291]647    echo "give SAXO password if asked"
[197]648    scp -rp /tmp/download_${$}/* saxo@forge.ipsl.jussieu.fr:/ipsl/forge/projets/saxo/download/
[188]649    rm -rf /tmp/download_${$}/
650fi
651#------------------------------------------------------------------
652#------------------------------------------------------------------
[86]653#
[88]654[ -f job_src_$$ ] && rm -f job_src_$$
[100]655[ -f job_data_$$ ] && rm -f job_data_$$
656[ -f job_data_idris_$$ ] && rm -f job_data_idris_$$
[86]657#
[88]658exit
[86]659#
Note: See TracBrowser for help on using the repository browser.