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

Last change on this file since 180 was 179, checked in by smasson, 18 years ago

update getsaxo + revision number in SRC tar file + improve exit status of /mergeonline_help.sh

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