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

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

Add new documentations about evolution of commons (disseappeared, translated, transformed) see infoupdatecm;Add svn:keyword Id in Documentation/xmldoc/*.html, *.xml, *.sh and *.css; in savesaxo.sh modify *.html produced by idldoc to have preformated examples

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