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

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

new savesaxo.sh to have paragraph written wtih a non-proportional
font in some idldoc html files

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