Show
Ignore:
Timestamp:
09.03.2010 15:57:52 (6 months ago)
Author:
oranfry
Message:

different method for uploading

Files:
1 modified

Legend:

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

    r21773 r21774  
    2727if ( ! exists $ENV{'DATA_DIR'} ) { 
    2828        $ENV{'DATA_DIR'} = "$ENV{'HOME'}/snapshots"; 
     29} 
     30 
     31#default identity dir 
     32if ( ! exists $ENV{'IDENTITY_DIR'} ) { 
     33        $ENV{'IDENTITY_DIR'} = "$ENV{'HOME'}/.ssh"; 
    2934} 
    3035 
     
    5964#setup based on mode 
    6065if ( $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"; 
    6267 
    6368        if ( $major_version == 2 ) { 
     
    7681        $ENV{'SERVER_EXE_LOCATION'} = "http://www.greenstone.org/caveat-emptor/server-$ENV{'snapshot_id2'}-candidate-" . get_date() . ".exe"; 
    7782 
    78 } else { 
    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"; 
    8186 
    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; 
    10797                } 
    10898        } 
    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        } 
    110113 
    111114        #set the path to server.exe 
     
    113116} 
    114117 
     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 
    115123#always rename the log not to clash with other files on puka 
    116124$ENV{'munges'} = $ENV{'munges'} . " s/\.out/-" . get_date() . "-log.txt/"; 
    117  
    118  
    119125 
    120126#choose a snapshot ID