Changeset 21798

Show
Ignore:
Timestamp:
16.03.2010 17:30:00 (10 years ago)
Author:
oranfry
Message:

made the snapshot task work in windows

Location:
other-projects/nightly-tasks/snapshot/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • other-projects/nightly-tasks/snapshot/trunk/lib.pl

    r21797 r21798  
     1my $sep = $^O eq "MSWin32" ? "\\" : "/"; 
     2 
    13sub get_date { 
    24    local ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); 
     
    9395 
    9496    #copy products to a temporary folder, giving them their new names 
    95         if ( ! -d "$release_dir/uploads" ) { 
    96         system( "rm -rf '$release_dir/uploads'" ); 
     97    if ( ! -d "$release_dir${sep}uploads" ) { 
     98        system( "rm -rf '$release_dir${sep}uploads'" ); 
    9799    } 
    98     mkdir "$release_dir/uploads"; 
     100    mkdir "$release_dir${sep}uploads"; 
    99101 
    100102    my @files; 
    101     if ( -d "$release_dir/products" ) { 
    102         @files = <$release_dir/products/*>; 
     103    if ( -d "$release_dir${sep}products" ) { 
     104        @files = <$release_dir${sep}products/*>; 
     105    } 
     106    push( @files, "$release_dir${sep}$rk.out" ); 
     107 
     108    for my $file ( @files ) { 
     109        if ( -e $file ) { 
     110            my $filename = basename($file); 
     111            #munge 
     112            for my $m ( @munges ) { 
     113                $doit="\$filename =~ $m"; eval "$doit"; 
     114            } 
     115            #upload 
     116            print "Will upload '" . basename($file) . "' to '$filename'\n"; 
     117            system("copy \"$file\" \"${release_dir}${sep}uploads${sep}$filename\""); 
     118        } 
     119 
    103120    } 
    104121 
    105     push( @files, "$release_dir/$rk.out" ); 
    106     for my $file ( @files ) { 
    107         my $filename = basename($file); 
    108         #munge 
    109         for my $m ( @munges ) { 
    110             $doit="\$filename =~ $m"; eval "$doit"; 
    111         } 
    112  
    113         #upload 
    114         print "Will upload '" . basename($file) . "' to '$filename'\n"; 
    115         system( "cp '$file' '$release_dir/uploads/$filename'" ); 
    116     } 
    117     my $command = "cd $release_dir/uploads && tar -c * | "; 
    118     $command .= ($^O eq "MSWin32" ? "putty" : "ssh"); 
    119     $command .= " -i '$ENV{'IDENTITY_FILE'}' nzdl\@puka.cs.waikato.ac.nz"; 
    120     print "$command\n"; 
     122    my $command = "cd \"${release_dir}${sep}uploads\" && tar -c * | "; 
     123    $command .= ($^O eq "MSWin32" ? "plink" : "ssh"); 
     124    $command .= " -T -i \"$ENV{'IDENTITY_FILE'}\" nzdl\@puka.cs.waikato.ac.nz"; 
     125    #print "$command\n"; 
    121126    system("$command"); 
    122127} 
  • other-projects/nightly-tasks/snapshot/trunk/task.pl

    r21797 r21798  
    11use File::Basename; 
     2my $sep = $^O eq "MSWin32" ? "\\" : "/"; 
    23do "$ENV{'TASK_HOME'}/lib.pl"; 
    34 
     
    2627#default data dir 
    2728if ( ! exists $ENV{'DATA_DIR'} ) { 
    28     $ENV{'DATA_DIR'} = "$ENV{'HOME'}/snapshots"; 
     29    $ENV{'DATA_DIR'} = "$ENV{'HOME'}${sep}snapshots"; 
    2930} 
    3031 
    3132#default identity dir 
    3233if ( ! exists $ENV{'IDENTITY_DIR'} ) { 
    33     $ENV{'IDENTITY_DIR'} = "$ENV{'HOME'}/.ssh"; 
     34    $ENV{'IDENTITY_DIR'} = "$ENV{'HOME'}${sep}.ssh"; 
    3435} 
    3536 
     
    121122#use the  correct key for uploading 
    122123$ENV{'IDENTITY_FILE'} = 
    123     "$ENV{'IDENTITY_DIR'}/upload-" . $ENV{'SNAPSHOT_MODE'} . ($^O eq "MSWin32" ? ".ppk" : ""); 
     124    "$ENV{'IDENTITY_DIR'}${sep}upload-" . $ENV{'SNAPSHOT_MODE'} . ($^O eq "MSWin32" ? ".ppk" : ""); 
    124125 
    125126 
     
    137138 
    138139#set a release directory 
    139 $release_dir = "$ENV{'DATA_DIR'}/$ENV{'TASK_NAME'}/from-" . get_date(); 
     140$release_dir = "$ENV{'DATA_DIR'}${sep}$ENV{'TASK_NAME'}${sep}from-" . get_date(); 
    140141 
    141142print "creating a snapshot release\n";