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

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

update tar files in getsaxo

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