root/branches/newmole/scripts/copy_programs.pl

Revision 121, 7.2 kB (checked in by gary, 3 years ago)

minor changes in formatting, fabden now aborts rather than pressing on, as appropriate for release code.

  • 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# it will convert ascii pc source files into unix eol files
5# tar and zip files are created in the pc directory
6
7# bring in the perl module that includes copy
8use File::Copy;
9
10# --------------------------------------------------------------------------
11# set up path names to all targets on various machines
12# the dir above the working copies of the tsuite
13$trunk_dir = "c:/projects/cloudy/trunk/tsuite";
14
15# the root directories for the tsuites - zip/tar files will end up here
16$unix_copy_dir    = "c:/projects/cloudy/trunk/unix/tsuite";
17$unix_copy_basedir    = "c:/projects/cloudy/trunk/unix";
18$win_copy_dir     = "c:/projects/cloudy/trunk/win/tsuite";
19$win_copy_basedir     = "c:/projects/cloudy/trunk/win";
20$cluster_copy_dir = "u:/cloudy/trunk/tsuite";
21
22# ftp site on cluster
23$ftp_last = "u:/pub/gary/bleeding_edge/last";
24
25# the subdirectories under tsuite
26@subdirs=("auto","slow");
27
28# end block - set up path names to all targets on various machines
29# --------------------------------------------------------------------------
30
31# array index for dirs below tsuite
32for ($ndir=0; $ndir<2; $ndir++)
33{
34
35# --------------------------------------------------------------------------
36# this block - clean out the target directories so we get fresh copies
37#
38# move to the pc unix tsuite dir
39$dir = "$unix_copy_dir"."/"."$subdirs[$ndir]";
40chdir( "$dir" ) or die " could not move to test suite directory \n";
41print(" moved to tsuite unix target directory, about to delete all files\n");
42# remove all files
43unlink <*> ;
44
45# move to the win tsuite directory
46$dir = "$win_copy_dir"."/"."$subdirs[$ndir]";
47chdir( "$dir" ) or die " could not move to test suite directory \n";
48print(" moved to tsuite win target directory, about to delete all files\n");
49# remove the win tsuite files
50unlink <*> ;
51
52# move to cluster tsuite directory
53$dir = "$cluster_copy_dir"."/"."$subdirs[$ndir]";
54chdir( "$dir" ) or die " could not move to cluster target directory \n";
55print(" moved to cluster tsuite directory, about to delete in files\n");
56# remove the old unix tsuite files - do not do * since want to keep perl files
57unlink <*.in>;
58# do not remove the *.out since a job may be running
59
60# end block - all target directories cleaned out the so we get fresh copies
61# --------------------------------------------------------------------------
62
63
64# --------------------------------------------------------------------------
65# now copy files from trunk to copy dirs
66#
67# move to original tsuite directory
68$dir = "$trunk_dir"."/"."$subdirs[$ndir]";
69chdir( "$dir" ) or die " could not move to trunk directory \n";
70
71# this loops over all input files in the original tsuite directory
72# and copies unix eol version to subdir unix, which is now empty
73# and windows eol version to subdir win/tsuite, which is empty
74while( defined( $input = glob("*.in") ) )
75{
76        print( "$input going to " );
77        $output = "$unix_copy_dir"."/"."$subdirs[$ndir]"."/"."$input";
78        print("$output\n");
79        # actually copy the file
80        system "dos2unix < $input  > $output";
81#
82#       now do win version
83        print( "$input going to " );
84        $output = "$win_copy_dir"."/"."$subdirs[$ndir]"."/"."$input";
85        print("$output\n");
86        # actually execute the code
87        copy( $input  , $output );
88}
89
90# now copy all html files
91while( defined( $input = glob("*.htm") ) )
92{
93        print( "$input going to " );
94        $output = "$unix_copy_dir"."/"."$subdirs[$ndir]"."/"."$input";
95        print("$output\n");
96        # actually execute the code
97        system "dos2unix < $input  > $output";
98        $output = "$win_copy_dir"."/"."$subdirs[$ndir]"."/"."$input";
99        print("$output\n");
100        # actually execute the code
101        copy( $input , $output );
102}
103
104# now copy all ini files
105while( defined( $input = glob("*.ini") ) )
106{
107        print( "$input going to " );
108        $output = "$unix_copy_dir"."/"."$subdirs[$ndir]"."/"."$input";
109        print("$output\n");
110        # actually execute the code
111        system "dos2unix < $input  > $output";
112        $output = "$win_copy_dir"."/"."$subdirs[$ndir]"."/"."$input";
113        print("$output\n");
114        # actually execute the code
115        copy( $input , $output );
116}
117
118# now copy all dat files
119while( defined( $input = glob("*.dat") ) )
120{
121        print( "$input going to " );
122        $output = "$unix_copy_dir"."/"."$subdirs[$ndir]"."/"."$input";
123        print("$output\n");
124        # actually execute the code
125        system "dos2unix < $input  > $output";
126        $output = "$win_copy_dir"."/"."$subdirs[$ndir]"."/"."$input";
127        print("$output\n");
128        # actually execute the code
129        copy( $input , $output );
130}
131
132# the clouds image is a binary file do a straight copy
133copy( "clouds.jpg" , "$unix_copy_dir"."/"."$subdirs[$ndir]"."/"."clouds.jpg" );
134# the clouds image is a binary file
135copy( "clouds.jpg" , "$win_copy_dir"."/"."$subdirs[$ndir]"."/"."clouds.jpg" );
136
137# now copy all perl scripts
138while( defined( $input = glob("*.pl") ) )
139{
140        print( "$input going to " );
141        $output = "$unix_copy_dir"."/"."$subdirs[$ndir]"."/"."$input";
142        print("$output\n");
143        # actually execute the code
144        system "dos2unix < $input  > $output";
145        $output = "$win_copy_dir"."/"."$subdirs[$ndir]"."/"."$input";
146        print("$output\n");
147        # actually execute the code
148        copy( $input , $output );
149}
150
151print("All tsuite files have been copied to pc unix and win subdirs\n");
152
153# move to pc unix copy tsuite directory and copy across to cluster
154$dir = "$unix_copy_dir"."/"."$subdirs[$ndir]";
155chdir( "$dir" ) or die " could not move to pc unix directory \n";
156# this loops over all files in the pc unix tsuite directory
157# and copies unix version to subdir unix on cluster, which is now empty
158while( defined( $input = glob("*") ) )
159{
160        print( "$input going to " );
161        $output = "$cluster_copy_dir"."/"."$subdirs[$ndir]"."/"."$input";
162        print("$output\n");
163        # actually copy the file
164        copy( $input  , $output );
165}
166# end copying files around
167# --------------------------------------------------------------------------
168
169
170# now zip up the directories we created - move into each do it from there
171# so that dir name is not included
172
173# base name of tar file
174$tarfile_basename = "tsuite_"."$subdirs[$ndir]";
175
176$dir = "$unix_copy_dir"."/"."$subdirs[$ndir]";
177chdir( "$dir" ) or die " could not move to pc unix directory \n";
178print(" moved to unix copy directory\n");
179
180$tarfile = "$unix_copy_basedir"."/"."$tarfile_basename".".tar";
181# remove old gzipd file if it exists
182if( -e "$tarfile" )
183{
184   unlink("$tarfile" );
185}
186
187#   tar the files
188#   NB we must do this in the directory so that we do not keep the dir structure, just names
189# the cygwin tar chocked on the fully resolved tarfile name
190#system "tar -cf $tarfile * ";
191system "C:\\u\\mks\\mksnt\\tar_mks.exe -cf $tarfile * ";
192print( "about to gzip $tarfile\n" );
193# remove old gzipd file if it exists
194if( -e "$tarfile".".gz" )
195{
196   unlink("$tarfile".".gz" );
197}
198system "gzip $tarfile ";
199
200# copy to the ftp site
201copy( "$tarfile".".gz" , $ftp_last );
202
203# how go to win home and zip the win source dir
204$dir = "$win_copy_dir"."/"."$subdirs[$ndir]";
205chdir( "$dir" ) or die " could not move to pc win directory \n";
206print(" moved to win copy directory\n");
207
208# remove old gzipd file if it exists
209$tarfile = "$win_copy_basedir"."/"."$tarfile_basename".".zip";
210if( -e "$tarfile" )
211{
212   unlink("$tarfile" );
213}
214
215# create zip file
216#system "c:\\u\\wzzip $tarfile  ";
217system "wzzip $tarfile  ";
218
219# finally copy the newly created files to the ftp site
220copy( "$tarfile" , $ftp_last );
221
222print("\ndone\n");
223
224}
Note: See TracBrowser for help on using the browser.