Ignore:
Timestamp:
2010-03-09T15:57:52+13:00 (14 years ago)
Author:
oranfry
Message:

different method for uploading

File:
1 edited

Legend:

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

    r21709 r21774  
    9393
    9494    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...)";
    9696    }
     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";
    97103
    98104    @files = <$release_dir/products/*>;
     
    100106    for my $file ( @files ) {
    101107        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        }
    103112
    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'" );
    124116    }
     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";
    125122}
Note: See TracChangeset for help on using the changeset viewer.