root/branches/newmole/scripts/nightly_copy_files_original.pl

Revision 687, 18.4 kB (checked in by peter, 2 years ago)

Merge changes from mainline upto r685.

This branch is now fully merged. Any remaining problems in doxygen, scripts
and tsuite should now be resolved.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1#!perl -w
2
3# This script copies source and test suite from pc to linux cluster
4
5# This is a perl script to convert ascii pc source files into unix eol files
6
7# bring in the perl module that includes copy
8use File::Copy;
9
10
11# --------------------------------------------------------------------------
12# this block - set up paths to all targets on various machines
13
14# this is where the original source files live on my pc
15$original_source_dir = "c:/projects/cloudy/trunk/source";
16$original_data_dir =   "c:/projects/cloudy/trunk/data";
17$original_tsuite_dir = "c:/projects/cloudy/trunk/tsuite/auto";
18
19# this is the current debug exe, will bail out if $local_unix_source_dir/source.tar.gz source
20# is younger than this
21$original_exe = "c:/projects/cloudy/trunk/debug/trunk.exe";
22
23
24# the root dir where the unix files will live on the linux cluster
25$cluster_unix_source_dir = "u:/cloudy/trunk/source";
26$cluster_unix_tsuite_dir = "u:/cloudy/trunk/tsuite";
27$cluster_unix_data_dir =   "u:/cloudy/trunk/data";
28
29# this is the ftp site on gradj
30$ftp_last = "u:/pub/gary/bleeding_edge/last/";
31
32# the root dir where the unix files will live on my pc
33$local_unix_source_dir = "c:/projects/cloudy/trunk/unix/source";
34$local_unix_tsuite_dir = "c:/projects/cloudy/trunk/unix/tsuite";
35$local_unix_data_dir = "c:/projects/cloudy/trunk/unix/data";
36$local_unix_main_dir = "c:/projects/cloudy/trunk/unix";
37
38# this is the last source.tar.gz, will compare this time stamp with debug exe
39# and bail if tar file is younger than exe
40$local_unix_sourcetar = "$local_unix_main_dir"."/source.tar.gz";
41
42# the win dir within the unix set
43$local_win_source_dir = "c:/projects/cloudy/trunk/win/source";
44$local_win_tsuite_dir = "c:/projects/cloudy/trunk/win/tsuite";
45$local_win_data_dir = "c:/projects/cloudy/trunk/win/data";
46
47#this is where backup files will be dropped
48$unixhome = "c:/projects/cloudy/trunk/unix";
49$winhome = "c:/projects/cloudy/trunk/win";
50
51# do we want to check timestamp?
52$lgCheckTime=1;
53# end block - set up paths to all targets on various machines
54
55# now compare ages of debug exe and last source.tar.gz, and bail if
56# debug has not been updated
57if( $lgCheckTime && (-M $local_unix_sourcetar) < (-M $original_exe ) )
58{
59      # no need to run tests, just quit
60      exit;
61}
62
63
64# --------------------------------------------------------------------------
65# --------------------------------------------------------------------------
66# this block - clean out the target directories so we get fresh copies
67# move to the old unix source directory, where we will delete all files
68#
69# dir that are cleaned out:
70#  unix source
71#  unix tsuite
72#
73# --------
74#
75# move to pc unix source dir
76if( !chdir( "$local_unix_source_dir" ) )
77{
78       printf(" invalid pc unix target directory for source\n");
79       exit(1);
80}
81print(" moved to pc unix target source directory, about to delete all files\n");
82# remove the unix source files
83unlink <*> ;
84
85# move to win source dir
86if( !chdir( "$local_win_source_dir" ) )
87{
88       printf(" invalid win target directory for source\n");
89       exit(1);
90}
91print(" moved to win target source directory, about to delete all files\n");
92# remove the win source files
93unlink <*> ;
94
95# move to the cluster source directory
96if( !chdir( "$cluster_unix_source_dir" ) )
97{
98       printf(" invalid cluster target directory for source\n");
99       exit(1);
100}
101print(" moved to unix target source directory, about to delete all files\n");
102# remove the old source files
103unlink <*.cpp> ;
104#
105# --------
106#
107# move to the pc unix tsuite dir
108if( !chdir( "$local_unix_tsuite_dir" ) )
109{
110       printf(" invalid directory for pc unix target tsuite\n");
111       exit(1);
112}
113print(" moved to tsuite unix target directory, about to delete all files\n");
114# remove the unix tsuite files
115unlink <*> ;
116
117# move to the win tsuite directory
118if( !chdir( "$local_win_tsuite_dir" ) )
119{
120       printf(" invalid directory for win target tsuite\n");
121       exit(1);
122}
123print(" moved to tsuite win target directory, about to delete all files\n");
124# remove the win tsuite files
125unlink <*> ;
126
127# move to cluster tsuite directory
128if( !chdir( "$cluster_unix_tsuite_dir" ) )
129{
130       printf(" invalid directory for cluster target tsuite\n");
131       exit(1);
132}
133print(" moved to tsuite unix target directory, about to delete all files\n");
134# remove the old unix tsuite files - do not do * since want to keep perl files
135unlink <*.in>;
136# do not remove the *.out since a job may be running
137# unlink <*.out>;
138
139#
140# --------
141#
142# move to pc unix data dir
143if( !chdir( "$local_unix_data_dir" ) )
144{
145       printf(" invalid unix data directory for data\n");
146       exit(1);
147}
148print(" moved to unix target data directory, about to delete all files\n");
149# remove the unix data files
150unlink <*> ;
151
152# move to win data dir
153if( !chdir( "$local_win_data_dir" ) )
154{
155       printf(" invalid win data directory for data\n");
156       exit(1);
157}
158print(" moved to win target data directory, about to delete all files\n");
159# remove the win data files
160unlink <*> ;
161
162# do not remove data files, since need compiled stars files
163# move to cluster data dir
164#if( !chdir( "$cluster_unix_data_dir" ) )
165#{
166#       printf(" invalid directory for cluster data\n");
167#       exit(1);
168#}
169#print(" moved to cluster data target directory, about to delete all files\n");
170# remove the old unix tsuite files
171#unlink <*> ;
172
173
174# end block - all target directories cleaned out the so we get fresh copies
175
176# --------------------------------------------------------------------------
177# --------------------------------------------------------------------------
178#
179# this block, copy source to various places
180#
181# move to where the original source files live
182if( !chdir( "$original_source_dir" ) )
183{
184       printf(" invalid original target directory for source\n");
185       exit(1);
186}
187# this loops over all files in the original source directory
188# and copies unix eol version to subdir unix, which is now empty
189# also copies win version to subdir win/source, which is now empty
190while( defined( $input = glob("*") ) )
191{
192        print( "$input going to " );
193        $output = "$local_unix_source_dir"."/"."$input";
194        print("$output\n");
195        # actually execute the code
196        system "dos2unix < $input  > $output";
197#
198#       now do win version
199        print( "$input going to " );
200        $output = "$local_win_source_dir"."/"."$input";
201        print("$output\n");
202        # simply copy the source here
203        copy( $input  , $output );
204}
205
206# this jpeg file was damaged above, so now copy straight version over
207copy( "clouds.jpg" , "$local_unix_source_dir"."/"."clouds.jpg" );
208
209print("\n=========================\n");
210print("All source files have been copies to unix/source subdir\n");
211print("=========================\n");
212
213#
214#------------ tsuite loop
215#
216# move to original tsuite directory
217if( !chdir( "$original_tsuite_dir" ) )
218{
219       printf(" invalid directory for original tsuite directory\n");
220       exit(1);
221}
222# this loops over all input files in the original tsuite directory
223# and copies unix eol version to subdir unix, which is now empty
224# and windows eol version to subdir win/tsuite, which is not empty
225# later we will copy the pc unix version to the cluster
226while( defined( $input = glob("*.in") ) )
227{
228        print( "$input going to " );
229        $output = "$local_unix_tsuite_dir"."/"."$input";
230        print("$output\n");
231        # actually copy the file
232        system "dos2unix < $input  > $output";
233#
234#       now do win version
235        print( "$input going to " );
236        $output = "$local_win_tsuite_dir"."/"."$input";
237        print("$output\n");
238        # actually execute the code
239        copy( $input  , $output );
240}
241
242
243# now copy all dat files scripts
244while( defined( $input = glob("*.htm") ) )
245{
246        print( "$input going to " );
247        $output = "$local_unix_tsuite_dir"."/"."$input";
248        print("$output\n");
249        # actually execute the code
250        system "dos2unix < $input  > $output";
251        $output = "$local_win_tsuite_dir"."/"."$input";
252        print("$output\n");
253        # actually execute the code
254        copy( $input , $output );
255}
256# copy all ascii html documents
257#$input = "readme_tests.htm";
258#$output = "$local_unix_tsuite_dir"."/"."$input";
259#system "dos2unix < $input  > $output" ;
260#$output = "$local_win_tsuite_dir"."/"."$input";
261#copy( $input  , $output );
262
263# lowd.dat moved to data files
264#$input = "lowd.dat";
265#$output = "$local_unix_tsuite_dir"."/"."$input";
266#system "dos2unix < $input  > $output" ;
267#$output = "$local_win_tsuite_dir"."/"."$input";
268#copy( $input  , $output );
269
270
271# now copy all dat files scripts
272while( defined( $input = glob("*.dat") ) )
273{
274        print( "$input going to " );
275        $output = "$local_unix_tsuite_dir"."/"."$input";
276        print("$output\n");
277        # actually execute the code
278        system "dos2unix < $input  > $output";
279        $output = "$local_win_tsuite_dir"."/"."$input";
280        print("$output\n");
281        # actually execute the code
282        copy( $input , $output );
283}
284#$input = "starburst99.dat";
285#$output = "$local_unix_tsuite_dir"."/"."$input";
286#system "dos2unix < $input  > $output" ;
287#$output = "$local_win_tsuite_dir"."/"."$input";
288#copy( $input  , $output );
289
290# the clouds image is a binary file do a straight copy
291copy( "clouds.jpg" , "$local_unix_tsuite_dir"."/"."clouds.jpg" );
292# the clouds image is a binary file
293copy( "clouds.jpg" , "$local_win_tsuite_dir"."/"."clouds.jpg" );
294
295# now copy all perl scripts
296while( defined( $input = glob("*.pl") ) )
297{
298        print( "$input going to " );
299        $output = "$local_unix_tsuite_dir"."/"."$input";
300        print("$output\n");
301        # actually execute the code
302        system "dos2unix < $input  > $output";
303        $output = "$local_win_tsuite_dir"."/"."$input";
304        print("$output\n");
305        # actually execute the code
306        copy( $input , $output );
307}
308
309# now copy all ini files scripts
310while( defined( $input = glob("*.ini") ) )
311{
312        print( "$input going to " );
313        $output = "$local_unix_tsuite_dir"."/"."$input";
314        print("$output\n");
315        # actually execute the code
316        system "dos2unix < $input  > $output";
317        $output = "$local_win_tsuite_dir"."/"."$input";
318        print("$output\n");
319        # actually execute the code
320        copy( $input , $output );
321}
322
323
324print("\n=========================\n");
325print("All tsuite files have been copied to unix/tsuite subdir\n");
326print("=========================\n");
327
328
329# move to original data directory
330if( !chdir( $original_data_dir ) )
331{
332       printf(" invalid directory for input\n");
333       exit(1);
334}
335
336# now do all data files in data dir
337# there is a different set of data files tar'd into data.tar in tsuite/auto, this is done
338# by the autorun.pl script
339$input = "readme_data.htm";
340$output = "$local_unix_data_dir"."/"."readme_data.htm";
341system "dos2unix < $input  > $output" ;
342$output = "$local_win_data_dir"."/"."$input";
343# simply copy the source here
344copy( $input  , $output );
345
346# treate this as a binary file
347copy( "clouds.jpg" , "$local_unix_data_dir"."/"."clouds.jpg" );
348copy( "clouds.jpg" , "$local_win_data_dir"."/"."clouds.jpg" );
349
350# the tex and pdf file for P van Hoof's writeup on the new grains
351# first do the pdf version as a binary file
352copy( "vanhoof_grain_model.pdf" , "$local_unix_data_dir"."/"."vanhoof_grain_model.pdf" );
353copy( "vanhoof_grain_model.pdf" , "$local_win_data_dir"."/"."vanhoof_grain_model.pdf" );
354# next the tex master document
355$input = "vanhoof_grain_model.tex";
356$output = "$local_unix_data_dir"."/"."vanhoof_grain_model.tex";
357# convert eol for unix version
358system "dos2unix < $input  > $output" ;
359$output = "$local_win_data_dir"."/"."$input";
360# simply copy the source to the win dir
361copy( $input  , $output );
362# next the ps output
363$input = "vanhoof_grain_model.ps";
364$output = "$local_unix_data_dir"."/"."vanhoof_grain_model.ps";
365# convert eol for unix version
366system "dos2unix < $input  > $output" ;
367$output = "$local_win_data_dir"."/"."$input";
368# simply copy the source to the win dir
369copy( $input  , $output );
370
371# copy all data files
372while( defined( $input = glob("*.dat") ) )
373{
374        print( "$input going to " );
375        $output = "$local_unix_data_dir"."/"."$input";
376        print("$output\n");
377        # actually execute the code
378        system "dos2unix < $input  > $output";
379#
380#       now do win version
381        print( "$input going to " );
382        $output = "$local_win_data_dir"."/"."$input";
383        print("$output\n");
384        # simply copy the source here
385        copy( $input  , $output );
386}
387
388# copy all opacity files
389while( defined( $input = glob("*.opc") ) )
390{
391        print( "$input going to " );
392        $output = "$local_unix_data_dir"."/"."$input";
393        print("$output\n");
394        # actually execute the code
395        system "dos2unix < $input  > $output";
396#
397#       now do win version
398        print( "$input going to " );
399        $output = "$local_win_data_dir"."/"."$input";
400        print("$output\n");
401        # simply copy the source here
402        copy( $input  , $output );
403}
404
405# copy all input scripts
406while( defined( $input = glob("*.in") ) )
407{
408        print( "$input going to " );
409        $output = "$local_unix_data_dir"."/"."$input";
410        print("$output\n");
411        # actually execute the code
412        system "dos2unix < $input  > $output";
413#
414#       now do win version
415        print( "$input going to " );
416        $output = "$local_win_data_dir"."/"."$input";
417        print("$output\n");
418        # simply copy the source here
419        copy( $input  , $output );
420}
421
422# copy all ini scripts
423while( defined( $input = glob("*.ini") ) )
424{
425        print( "$input going to " );
426        $output = "$local_unix_data_dir"."/"."$input";
427        print("$output\n");
428        # actually execute the code
429        system "dos2unix < $input  > $output";
430#
431#       now do win version
432        print( "$input going to " );
433        $output = "$local_win_data_dir"."/"."$input";
434        print("$output\n");
435        # simply copy the source here
436        copy( $input  , $output );
437}
438
439# copy all rfi scripts
440while( defined( $input = glob("*.rfi") ) )
441{
442        print( "$input going to " );
443        $output = "$local_unix_data_dir"."/"."$input";
444        print("$output\n");
445        # actually execute the code
446        system "dos2unix < $input  > $output";
447#
448#       now do win version
449        print( "$input going to " );
450        $output = "$local_win_data_dir"."/"."$input";
451        print("$output\n");
452        # simply copy the source here
453        copy( $input  , $output );
454}
455
456# copy all szd scripts
457while( defined( $input = glob("*.szd") ) )
458{
459        print( "$input going to " );
460        $output = "$local_unix_data_dir"."/"."$input";
461        print("$output\n");
462        # actually execute the code
463        system "dos2unix < $input  > $output";
464#
465#       now do win version
466        print( "$input going to " );
467        $output = "$local_win_data_dir"."/"."$input";
468        print("$output\n");
469        # simply copy the source here
470        copy( $input  , $output );
471}
472
473
474print("\n=========================\n");
475print("All data files have been copied to trunk/unix/data subdir\n");
476print("=========================\n");
477
478print( "data, source, tsuite files copied to win and pc unix \n");
479
480#
481#------------ source loop
482#
483
484# move to local unix source directory with unix eol source
485if( !chdir( $local_unix_source_dir ) )
486{
487       printf(" invalid local unix source directory for input\n");
488       exit(1);
489}
490
491# this loops over all files in the trunk directory
492# and copies unix version to subdir unix, which should be empty
493while( defined( $input = glob("*") ) )
494{
495        print( "$input going to " );
496        $output = "$cluster_unix_source_dir"."/"."$input";
497        print("$output\n");
498        # actually execute the code
499        copy( $input  , $output);
500}
501# we have now clobbered the path.cpp file, and need to copy a valid one from 1 dir up
502copy( "u:/cloudy/trunk/path.cpp" , "u:/cloudy/trunk/source/path.cpp" );
503
504# move to pc unix tsuite directory
505if( !chdir( $local_unix_tsuite_dir ) )
506{
507       printf(" invalid directory for local unix tsuite directory\n");
508       exit(1);
509}
510# this loops over all files in the pc unix tsuite directory
511# and copies unix version to subdir unix on cluster, which is now empty
512while( defined( $input = glob("*") ) )
513{
514        print( "$input going to " );
515        $output = "$cluster_unix_tsuite_dir"."/"."$input";
516        print("$output\n");
517        # actually copy the file
518        copy( $input  , $output );
519}
520
521
522# move to pc unix data directory
523if( !chdir( $local_unix_data_dir ) )
524{
525       printf(" invalid directory for local unix data directory\n");
526       exit(1);
527}
528# this loops over all files in the pc unix data directory
529# and copies unix version to subdir unix on cluster, which is now empty
530while( defined( $input = glob("*") ) )
531{
532        print( "$input going to " );
533        $output = "$cluster_unix_data_dir"."/"."$input";
534        print("$output\n");
535        # actually copy the file
536        copy( $input  , $output );
537}
538
539# now zip up the files we created
540if( !chdir( "$unixhome" ) )
541{
542       printf(" invalid unix home directory for source\n");
543       exit(1);
544}
545print(" moved to unix home directory\n");
546
547# remove old gzipd file if it exists
548if( -e "source.tar.gz" )
549{
550   unlink("source.tar.gz" );
551}
552# remove old gzipd file if it exists
553if( -e "tsuite.tar.gz" )
554{
555   unlink("tsuite.tar.gz" );
556}
557# remove old gzipd file if it exists
558if( -e "data.tar.gz" )
559{
560   unlink("data.tar.gz" );
561}
562
563# ----------------------------------------------------------
564#   tar the files
565#
566#  unix source
567#
568# tar pc unix source
569if( !chdir( "$local_unix_source_dir" ) )
570{
571       printf(" invalid directory for local unix source\n");
572       exit(1);
573}
574$tarfile = "../"."source.tar";
575system "tar -cf $tarfile * ";
576print( "about to gzip $tarfile\n" );
577system "gzip $tarfile ";
578
579# tar pc unix source
580if( !chdir( "$local_unix_tsuite_dir" ) )
581{
582       printf(" invalid directory for local tsuite source\n");
583       exit(1);
584}
585$tarfile = "../"."tsuite.tar";
586system "tar -cf $tarfile * ";
587print( "about to gzip $tarfile\n" );
588system "gzip $tarfile ";
589
590# tar pc unix data
591if( !chdir( "$local_unix_data_dir" ) )
592{
593       printf(" invalid directory for local data source\n");
594       exit(1);
595}
596$tarfile = "../"."data.tar";
597system "tar -cf $tarfile * ";
598print( "about to gzip $tarfile\n" );
599system "gzip $tarfile ";
600
601# move to main dir so that we can copy tar.gz files to ftp site
602if( !chdir( "$local_unix_main_dir" ) )
603{
604       printf(" invalid directory for main unix\n");
605       exit(1);
606}
607# finally copy the newly created files to the ftp site
608#copy( "source.tar.gz" , "u:/pub/gjf/source.tar.gz" );
609#copy( "tsuite.tar.gz" , "u:/pub/gjf/tsuite.tar.gz" );
610#copy( "data.tar.gz" , "u:/pub/gjf/data.tar.gz" );
611copy( "source.tar.gz" , $ftp_last );
612copy( "tsuite.tar.gz" , $ftp_last );
613copy( "data.tar.gz" , $ftp_last );
614
615# how go to win home and zip the win source dir
616#
617# move to win home directory
618if( !chdir( "$winhome" ) )
619{
620       printf(" invalid directory for win home\n");
621       exit(1);
622}
623if( -e "source.zip" )
624{
625   unlink("source.zip" );
626}
627# remove old gzipd file if it exists
628if( -e "tsuite.zip" )
629{
630   unlink("tsuite.zip" );
631}
632# remove old gzipd file if it exists
633if( -e "data.zip" )
634{
635   unlink("data.zip" );
636}
637
638# win source
639system "c:\\u\\wzzip source.zip $local_win_source_dir ";
640system "c:\\u\\wzzip tsuite.zip $local_win_tsuite_dir ";
641system "c:\\u\\wzzip   data.zip $local_win_data_dir ";
642
643# finally copy the newly created files to the ftp site
644#copy( "source.zip" , "u:/pub/gjf/source.zip" );
645#copy( "tsuite.zip" , "u:/pub/gjf/tsuite.zip" );
646#copy( "data.zip"   , "u:/pub/gjf/data.zip" );
647copy( "source.zip" , $ftp_last );
648copy( "tsuite.zip" , $ftp_last );
649copy( "data.zip"   , $ftp_last );
650
651print("\n=========================\n");
Note: See TracBrowser for help on using the browser.