Changeset 21774 for other-projects
- Timestamp:
- 2010-03-09T15:57:52+13:00 (14 years ago)
- Location:
- other-projects/nightly-tasks/snapshot/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/nightly-tasks/snapshot/trunk/lib.pl
r21709 r21774 93 93 94 94 if ( ! -d "$release_dir/products" ) { 95 die "error: products directory doesn't exist, exiting \n";95 die "error: products directory doesn't exist, exiting. (Well, not that exciting, a bit of a downer really...)"; 96 96 } 97 98 #copy products to a temporary folder, giving them their new names 99 if ( ! -d "$release_dir/uploads" ) { 100 system( "rm -rf '$release_dir/uploads'" ); 101 } 102 mkdir "$release_dir/uploads"; 97 103 98 104 @files = <$release_dir/products/*>; … … 100 106 for my $file ( @files ) { 101 107 my $filename = basename($file); 102 if ( !$only_upload || $filename =~ $only_upload ) { 108 #munge 109 for my $m ( @munges ) { 110 $doit="\$filename =~ $m"; eval "$doit"; 111 } 103 112 104 #munge 105 for my $m ( @munges ) { 106 $doit="\$filename =~ $m"; eval "$doit"; 107 } 108 109 #upload 110 print "Uploading '" . basename($file) . "' to '$filename'\n"; 111 my $command = "scp"; 112 if ( $^O eq "MSWin32" ) { 113 $command = "pscp"; 114 } 115 if ( exists $ENV{'UPLOAD_IDENTITY_FILE'} ) { 116 $command .= " -i \"$ENV{'UPLOAD_IDENTITY_FILE'}\""; 117 } 118 $command .= " \"$file\" \"$ENV{'UPLOAD_DIR'}/$filename\""; 119 system($command); 120 121 } else { 122 print "Skipping upload of '$filename'\n"; 123 } 113 #upload 114 print "Will upload '" . basename($file) . "' to '$filename'\n"; 115 system( "cp '$file' '$release_dir/uploads/$filename'" ); 124 116 } 117 my $command = "cd $release_dir/uploads && tar -cz * | "; 118 $command .= ($^O eq "MSWin32" ? "putty" : "ssh"); 119 $command .= " -i '$ENV{'IDENTITY_FILE'}' nzdl\@puka.cs.waikato.ac.nz"; 120 #system("$command"); 121 print "$command\n"; 125 122 } -
other-projects/nightly-tasks/snapshot/trunk/task.pl
r21773 r21774 27 27 if ( ! exists $ENV{'DATA_DIR'} ) { 28 28 $ENV{'DATA_DIR'} = "$ENV{'HOME'}/snapshots"; 29 } 30 31 #default identity dir 32 if ( ! exists $ENV{'IDENTITY_DIR'} ) { 33 $ENV{'IDENTITY_DIR'} = "$ENV{'HOME'}/.ssh"; 29 34 } 30 35 … … 59 64 #setup based on mode 60 65 if ( $ENV{'TASK_NAME'} =~ "caveat\$" ) { 61 $ENV{' UPLOAD_DIR'}="nzdl\@puka.cs.waikato.ac.nz:/greenstone/greenstone.org/base/caveat-emptor";66 $ENV{'SNAPSHOT_MODE'} = "caveat"; 62 67 63 68 if ( $major_version == 2 ) { … … 76 81 $ENV{'SERVER_EXE_LOCATION'} = "http://www.greenstone.org/caveat-emptor/server-$ENV{'snapshot_id2'}-candidate-" . get_date() . ".exe"; 77 82 78 } els e{79 if ( $ENV{'TASK_NAME'} =~ "stable\$" ) {80 $ENV{'BRANCH_PATH'}="tags/stable";83 } elsif ( $ENV{'TASK_NAME'} =~ "stable\$" ) { 84 $ENV{'SNAPSHOT_MODE'} = "stable"; 85 $ENV{'BRANCH_PATH'} = "tags/stable"; 81 86 82 #dont proceed if main/stable is old 83 #get last changed date from svn 84 open( INFO, "svn info http://svn.greenstone.org/main/$ENV{'BRANCH_PATH'}|" ) 85 or die "Cant determine age of stable tag"; 86 my $changed_date; 87 while ( my $line = <INFO>) { 88 chomp($line); 89 if ( $line =~ /^Last Changed Date:/ ) { 90 $changed_date = $line; 91 break; 92 } 93 } 94 close(INFO); 95 #change the format 96 $changed_date =~ s/.*: ([^ ]+) .*/\1/g; 97 if ( $changed_date !~ /^20[0-9]{2}-[0-9]{2}-[0-9]{2}$/ ) { 98 die "Cant determine age of stable tag"; 99 } 100 $changed_date =~ s/-/./g; 101 #check if main/stable is new 102 if ( $changed_date ne get_date() ) { 103 print "main/stable is old, will not create snapshot\n"; 104 exit; 105 } else { 106 print "main/stable is fresh, will create snapshot\n"; 87 #dont proceed if main/stable is old 88 #get last changed date from svn 89 open( INFO, "svn info http://svn.greenstone.org/main/$ENV{'BRANCH_PATH'}|" ) 90 or die "Cant determine age of stable tag"; 91 my $changed_date; 92 while ( my $line = <INFO>) { 93 chomp($line); 94 if ( $line =~ /^Last Changed Date:/ ) { 95 $changed_date = $line; 96 break; 107 97 } 108 98 } 109 $ENV{'UPLOAD_DIR'}="nzdl\@puka.cs.waikato.ac.nz:/greenstone/greenstone.org/base/release-snapshots"; 99 close(INFO); 100 #change the format 101 $changed_date =~ s/.*: ([^ ]+) .*/\1/g; 102 if ( $changed_date !~ /^20[0-9]{2}-[0-9]{2}-[0-9]{2}$/ ) { 103 die "Cant determine age of stable tag"; 104 } 105 $changed_date =~ s/-/./g; 106 #check if main/stable is new 107 if ( $changed_date ne get_date() ) { 108 print "main/stable is old, will not create snapshot\n"; 109 exit; 110 } else { 111 print "main/stable is fresh, will create snapshot\n"; 112 } 110 113 111 114 #set the path to server.exe … … 113 116 } 114 117 118 #use the correct key for uploading 119 $ENV{'IDENTITY_FILE'} = 120 "$ENV{'IDENTITY_DIR'}/upload-" . $ENV{'SNAPSHOT_MODE'} . ($^O eq "MSWin32" ? ".ppk" : ""); 121 122 115 123 #always rename the log not to clash with other files on puka 116 124 $ENV{'munges'} = $ENV{'munges'} . " s/\.out/-" . get_date() . "-log.txt/"; 117 118 119 125 120 126 #choose a snapshot ID
Note:
See TracChangeset
for help on using the changeset viewer.