Ignore:
Timestamp:
2010-03-16T17:30:00+13:00 (12 years ago)
Author:
oranfry
Message:

made the snapshot task work in windows

File:
1 edited

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}
Note: See TracChangeset for help on using the changeset viewer.