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
RevLine 
[144]1#!/bin/bash
[111]2#
[123]3# update :
4# $Id$
[156]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
[144]14# fplod 2006-07-21T08:23:52Z aedon.locean-ipsl.upmc.fr (Darwin)
15# add mini_notice production
[140]16# fplod 2006-07-11T08:26:05Z aedon.locean-ipsl.upmc.fr (Darwin)
17# commented tidy in dohtml section is moved in makehtml
[135]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
[123]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"
[111]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' \
[123]32#     -e 's/\(src=".*\)\(\.html\)\("\)/\1\2?format=raw\3/g' \
[111]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
[109]41# fplod 2006-06-14T12:41:37Z aedon.locean-ipsl.upmc.fr (Darwin)
[111]42# add embed paramater idldoc instructions to try to fix ticket#17
[91]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
[90]46# fplod 2006-06-07T10:57:35Z aedon.locean-ipsl.upmc.fr (Darwin)
47# add ?format=raw in idldoc production for frames
[89]48# fplod 2006-06-07T08:14:15Z aedon.locean-ipsl.upmc.fr (Darwin)
49# add action for idldochtml
[86]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#
[138]58docompileall=1
[86]59dohtml=0
60dooldtest=0
[107]61doidlwavedoc=0
[138]62doidldoc_html=0
[86]63doidldoc_assistant=0
[116]64doTARsrc=0
[88]65doTARdata=0
[116]66doforge=0
[88]67doSRClodyc=0
68doDTAlodyc=0
[100]69doSRCipsl=0
70doDTAipsl=0
71doSRCidris=0
72doDTAidris=0
[86]73#
[100]74case $( whoami ) in
75    smasson)
76        lgforge=smasson
77    ;;
78    floseb)
79        lgforge=smasson
80    ;;
81    *)
82        lgforge=saxo
83    ;;
84esac
[88]85#
[100]86if [ ${lgforge} != smasson ]
87then
88    doSRClodyc=0
89    doDTAlodyc=0
90    doSRCipsl=0
91    doDTAipsl=0
92    doSRCidris=0
93    doDTAidris=0
94fi   
95#
[88]96# get the date in a nice format
97#
98ndate=`date +%Y%m%d`
[86]99# memorize current directory
100memopwd=$(pwd) # should be <working space>/SRC/Documentation/xmldoc
[100]101#
[88]102#------------------------------------------------------------------
[100]103if [ ${docompileall} -eq 1 ]
104    then
105    cat <<EOF > /tmp/compileall${$}.pro
[114]106.reset_session 
107;
[100]108!path = expand_path('+' + '../..') + ':' + expand_path('+' + !dir)
[115]109resolve_all, resolve_either='def_myuniquetmpdir', skip_routines = ['xxx2ps','trends', 'label_gmt']
110resolve_all, resolve_either = 'find', skip_routines = ['xxx2ps','trends', 'label_gmt']
[114]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;
[115]121resolve_all, resolve_either='keep_compatibility', skip_routines = ['xxx2ps','trends', 'label_gmt']
[114]122;
[100]123EOF
124#
[115]125    for i in $( find ${memopwd}/../.. -name "*.pro" | grep -iv label_gmt )
[100]126      do
[115]127# does it contains pro or function ?
128      egrep -iq '^ *    *(pro|function)' $i
[100]129      if [ $? -eq 0 ]
130          then
[115]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
[100]133      fi
134    done
135    echo exit >> /tmp/compileall${$}.pro
136    IDL_STARTUP=/tmp/compileall${$}.pro
[120]137    ${IDL_DIR}/bin/idl &> /tmp/compileallerr_${$}
[100]138    echo
139    echo
[114]140    grep -i "error" /tmp/compileallerr_${$}
141#    grep -q "Compilation error(s)" /tmp/compileallerr_${$}
[105]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_${$}"
[115]149     more /tmp/compileallerr_${$}
[105]150     exit 1
151    fi
[100]152    echo
153    echo
154fi
155#------------------------------------------------------------------
[86]156if [ ${dohtml} -eq 1 ]
157then
158#
159# redo the html file
160#
161    cd ${memopwd}
[144]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
[86]163    do
[140]164      ./makehtml.sh $(basename ${docxml} .xml)
[86]165    done
166    exit 0
167fi
[88]168#------------------------------------------------------------------
[86]169if [ ${dooldtest} -eq 1 ]
170then
171# make the old test
172#
173    cd ${memopwd}/../../Tests/
174    ./makeold.sh
175    exit 0
176fi
[88]177#------------------------------------------------------------------
[86]178if  [ ${doidlwavedoc} -eq 1 ]
179then
180#
181# redo idlwave doc
182#
[107]183    cd ${memopwd}/../..
[86]184    Documentation/idlwave_catalog -v -f saxo
185    exit 0
186fi
[88]187#------------------------------------------------------------------
[86]188if  [ ${doidldoc_html} -eq 1 ]
189then
190#
[89]191    # build a idl file to launch idldoc
[111]192    output=../idldoc_html_output/
193    log="/tmp/idldochtlm_${$}.log"
194    pro="/tmp/idldochtlm_${$}.pro"
195    cat <<EOF > ${pro}
[89]196!path = expand_path('+' + '../idldoc/')
197print,!path
[111]198idldoc,root="../../",title="SAXO Documentation", $
199LOG_FILE="${log}", $
200output="${output}", /preformat, /embed
[89]201exit
202EOF
203    # launch idl with the file built above
[120]204    IDL_STARTUP=${pro};${IDL_DIR}/bin/idl
[111]205    /bin/rm ${pro}
[89]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
[111]226    # add ?format=raw to links on html files
[156]227    cat << EOF > /tmp/css_modification
228p.preformat {
229  font-family: Courier;
230}
231EOF
[111]232    list_html=$(find ${output} -name "*.html")
[89]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" \
[111]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' \
[123]244     -e 's@<div class="value">@<div class="preformat">@' \
[135]245     -e 's/div\#file_comments {/div\#file_comments { white-space: pre;/' \
[156]246     -e 's@^; <fixe>@<p class="preformat">@' \
247     -e 's@^; </fixe>@</p>@' \
248     -e '/Main styles/r /tmp/css_modification' \
[89]249     ${file_html} > ${file_html}_modify
250     mv ${file_html}_modify ${file_html}
251    done
[156]252    rm /tmp/css_modification
[111]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"
[86]265    exit 1
266fi
[88]267#------------------------------------------------------------------
[86]268if  [ ${doidldoc_assistant} -eq 1 ]
269then
270#
271    echo "eee : pas encore ecrit"
272    exit 1
273fi
[88]274#------------------------------------------------------------------
275if [ ${doTARsrc} -eq 1 ]
[86]276then
277    localtarbase=/tmp/savesaxo_${$}
278    mkdir  ${localtarbase}/
[87]279# clean backup files : *~
[88]280    find ${memopwd}/../../.. -name "*~" -exec rm {} \;
[87]281# prepare the source tar (without the svn...)
[86]282#
[87]283    cd ${memopwd}/../../..
284    tar czf ${localtarbase}/SAXO_SRC_${ndate}.tar.gz --exclude .svn SRC
[86]285#
[87]286#   informations
[89]287    echo "iii : following file may be copied on http://forge.ipsl.jussieu.fr/saxo/download/"
[87]288    ls -l ${localtarbase}
289fi
[88]290#------------------------------------------------------------------
291if [ ${doTARdata} -eq 1 ]
[87]292then
293    localtarbase=/tmp/savesaxo_${$}
294    mkdir  ${localtarbase}/
[86]295#
[87]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#
[86]301#   informations
[89]302    echo "iii : following file may be copied on http://forge.ipsl.jussieu.fr/saxo/download/"
[86]303    ls -l ${localtarbase}
304fi
[88]305#------------------------------------------------------------------
[86]306if [ ${doforge} -eq 1 ]
307then
[100]308    echo "iii : you will be asked ${lgforge}@forge.ipsl.jussieu.fr passwd two times"
[88]309    if [ ${doTARsrc} -ne 1 ]
[86]310    then
[89]311       localtarbase=${1}
[86]312    fi
[100]313    scp ${localtarbase}/SAXO_*.tar.gz ${lgforge}@forge.ipsl.jussieu.fr:/ipsl/forge/projets/saxo/download/
[86]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
[88]318#------------------------------------------------------------------
[100]319if [[ ($doDTAlodyc -eq 1) || ($doDTAipsl -eq 1) ]]
[88]320then
[100]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)
[88]325    cat <<EOF > job_data_$$
[100]326#!/bin/bash
[88]327cd SAXO_DIR
[86]328#
[88]329rm -rf DATA
330wget http://forge.ipsl.jussieu.fr/saxo/download/$filedata
[114]331gunzip $filedata
332tar vxf $( basename $filedata .gz )
333rm -f $( basename $filedata .gz )
[88]334#
335chmod -R 755 *
336exit
337#
[86]338EOF
[88]339fi
340#------------------------------------------------------------------
341if [ $doSRClodyc -eq 1 ]
342then
343# update src on cerbere
[86]344#
[100]345    echo "iii : update src on cerbere"
[115]346    ssh smasson@cerbere.lodyc.jussieu.fr "svn update SAXO_DIR/SRC ; chmod -R 755 SAXO_DIR"
[88]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#------------------------------------------------------------------
[100]357if [ $doSRCipsl -eq 1 ]
358then
[116]359# update src on calcul2
[100]360#
[116]361    echo "iii : update src on calcul2"
362    ssh smlod@calcul2.ipsl.jussieu.fr "svn update SAXO_DIR/SRC ; chmod -R 755 SAXO_DIR"
[100]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#------------------------------------------------------------------
[88]373if [ $doSRCidris -eq 1 ]
374then
375# update src on rhodes
376    echo "iii : update src to rhodes"
[115]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"
[88]378fi
379#------------------------------------------------------------------
380if [ $doDTAidris -eq 1 ]
381then
[100]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
[88]405# update data on gaya
406    echo "iii : update data to gaya"
[100]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_$$"
[88]409fi
410#------------------------------------------------------------------
[86]411#
[88]412[ -f job_src_$$ ] && rm -f job_src_$$
[100]413[ -f job_data_$$ ] && rm -f job_data_$$
414[ -f job_data_idris_$$ ] && rm -f job_data_idris_$$
[86]415#
[88]416exit
[86]417#
Note: See TracBrowser for help on using the repository browser.