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