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