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

Last change on this file since 163 was 163, checked in by navarro, 18 years ago

header improvements : type of parameters and keywords, default values, spell checking + idldoc assistant (IDL online_help)

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