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

Last change on this file since 135 was 135, checked in by pinsard, 18 years ago

modif of savesaxo.sh for a better presentation of file_comments
in idldoc html ouptut

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