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

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

add files for xxx documentation see mini_notice.html

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