root/branches/newmole/scripts/nightly_copy_source.pl

Revision 687, 5.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 from pc to linux cluster
4# This is a perl script to convert ascii pc source files into unix eol files
5
6# bring in the perl module that includes copy
7use File::Copy;
8
9# base name for where we are
10$basename = "c:/projects/cloudy/trunk/";
11
12# --------------------------------------------------------------------------
13# this block - set up paths to all targets on various machines
14
15# this is where the original source files live on my pc
16#$original_source_dir = "c:/projects/cloudy/trunk/source";
17$original_source_dir = "$basename"."source_hot";
18
19# the root dir where the unix files will live on the linux cluster
20$cluster_unix_source_dir = "u:/cloudy/trunk/source";
21
22# this is the ftp site on gradj
23$ftp_last = "u:/pub/gary/bleeding_edge/last/";
24
25# the root dir where the unix files will live on my pc
26#$local_unix_source_dir = "c:/projects/cloudy/trunk/unix/source";
27$local_unix_source_dir = "$basename"."unix/source";
28
29#$local_unix_main_dir = "c:/projects/cloudy/trunk/unix";
30$local_unix_main_dir = "$basename"."unix";
31
32# the win dir within the unix set
33#$local_win_source_dir = "c:/projects/cloudy/trunk/win/source";
34$local_win_source_dir = "$basename"."win/source";
35
36#this is where backup files will be dropped
37#$unixhome = "c:/projects/cloudy/trunk/unix";
38$unixhome = "$basename"."unix";
39
40#$winhome = "c:/projects/cloudy/trunk/win";
41$winhome = "$basename"."win";
42# end block - set up paths to all targets on various machines
43
44# --------------------------------------------------------------------------
45# --------------------------------------------------------------------------
46# this block - clean out the target directories so we get fresh copies
47# move to the old unix source directory, where we will delete all files
48#
49# move to pc unix source dir
50chdir( "$local_unix_source_dir" ) or die " invalid pc unix target directory for source\n";
51print(" moved to pc unix target source directory, about to delete all files\n");
52# remove the unix source files
53unlink <*> ;
54
55# move to win source dir
56chdir( "$local_win_source_dir" ) or die " invalid win target directory for source\n";
57print(" moved to win target source directory, about to delete all files\n");
58# remove the win source files
59unlink <*> ;
60
61# move to the cluster source directory
62chdir( "$cluster_unix_source_dir" ) or die " invalid cluster target directory for source\n";
63print(" moved to unix target source directory, about to delete all files\n");
64# remove the old source files
65unlink <*.cpp> ;
66
67
68# --------------------------------------------------------------------------
69# move to where the original source files live
70chdir( "$original_source_dir" ) or die " invalid original target directory for source\n";
71
72# this loops over all files in the original source directory
73# and copies unix eol version to subdir unix, which is now empty
74# also copies win version to subdir win/source, which is now empty
75while( defined( $input = glob("*") ) )
76{
77        print( "$input going to " );
78        $output = "$local_unix_source_dir"."/"."$input";
79        print("$output\n");
80        # actually execute the code
81        system "dos2unix < $input  > $output";
82#
83#       now do win version
84        print( "$input going to " );
85        $output = "$local_win_source_dir"."/"."$input";
86        print("$output\n");
87        # simply copy the source here
88        copy( $input  , $output );
89}
90
91# this jpeg file was damaged above, so now copy straight version over
92copy( "clouds.jpg" , "$local_unix_source_dir"."/"."clouds.jpg" );
93
94print("\n=========================\n");
95print("All source files have been copies to unix/source subdir\n");
96print("=========================\n");
97
98# move to local unix source directory with unix eol source
99chdir( $local_unix_source_dir ) or die " invalid local unix source directory for input\n";
100
101# this loops over all files in the local unix source directory
102# and copies unix version to cluster source, which should be empty
103while( defined( $input = glob("*") ) )
104{
105        print( "$input going to " );
106        $output = "$cluster_unix_source_dir"."/"."$input";
107        print("$output\n");
108        # actually execute the code
109        copy( $input  , $output);
110}
111# we have now clobbered the path.cpp file, and need to copy a valid one from 1 dir up
112# so that version on unix cluster will compile & execute
113copy( "u:/cloudy/trunk/path.cpp" , "u:/cloudy/trunk/source/path.cpp" );
114
115# ----------------------------------------------------------
116# now create compressed archives of the files we created
117chdir( "$unixhome" ) or die " invalid unix home directory for source\n";
118print(" moved to unix home directory\n");
119
120# remove old gzipd file if it exists
121if( -e "source.tar.gz" )
122{
123   unlink("source.tar.gz" );
124}
125
126#   tar the files
127chdir( "$local_unix_source_dir" ) or die " invalid directory for local unix source\n";
128$tarfile = "../"."source.tar";
129system "tar -cf $tarfile * ";
130print( "about to gzip $tarfile\n" );
131system "gzip $tarfile ";
132
133
134# move to main dir so that we can copy tar.gz files to ftp site
135chdir( "$local_unix_main_dir" ) or die " invalid directory for main unix\n";
136# finally copy the newly created files to the ftp site
137copy( "source.tar.gz" , $ftp_last );
138
139# how go to win home and zip the win source dir
140#
141# move to win home directory
142chdir( "$winhome" ) or die " invalid directory for win home\n";
143if( -e "source.zip" )
144{
145   unlink("source.zip" );
146}
147
148# win source
149system "c:\\u\\wzzip source.zip $local_win_source_dir ";
150
151# finally copy the newly created files to the ftp site
152copy( "source.zip" , $ftp_last );
153
154print("\n=========================\n");
Note: See TracBrowser for help on using the browser.