Changeset 21723


Ignore:
Timestamp:
2010-02-22T14:48:36+13:00 (12 years ago)
Author:
oranfry
Message:

stable not to proceed unless tag is fresh

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

Legend:

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

    r21709 r21723  
    1 #where to keep snapshots
    2 $ENV{'DATA_DIR'}="/data/snapshots";
     1$ENV{'PATH'} = "/programs/release-kits/bin:$ENV{'PATH'}";
    32
    4 #where to find release kits and ant
    5 $ENV{'PATH'} = "$ENV{'PATH'}:/programs/release-kits/bin";
    6 
    7 #java
    8 $ENV{'JAVA_HOME'} = "/usr/lib/jvm/java-1.5.0";
    9 $ENV{'PATH'} = "$ENV{'JAVA_HOME'}/bin:$ENV{'PATH'}";
    10 
  • other-projects/nightly-tasks/snapshot/trunk/task.pl

    r21709 r21723  
    22do "$ENV{'TASK_HOME'}/lib.pl";
    33
    4 #check key environment vars are set
    5 die "Please set a DATA_DIR in the nightly snapshot environment\n"
    6     if ! exists $ENV{'DATA_DIR'};
    74die "Could not determine your operating system"
    85    unless ( $^O =~ "linux|darwin|MSWin32" );
     
    2522if ( exists $ARGV[1] ) {
    2623    die "too many arguments to snapshot task\n";
     24}
     25
     26#default data dir
     27if ( ! exists $ENV{'DATA_DIR'} ) {
     28    $ENV{'DATA_DIR'} = "$ENV{'HOME'}/snapshots";
    2729}
    2830
     
    5860if ( $ENV{'TASK_NAME'} =~ "caveat\$" ) {
    5961    $ENV{'UPLOAD_DIR'}="nzdl\@puka.cs.waikato.ac.nz:/greenstone/greenstone.org/base/caveat-emptor";
    60    
    61     if ( $major_version == 2 ) {
    62         $ENV{'snapshot_id2'} = `wget -O - http://www.greenstone.org/next-release.txt 2>nul`;
    63         chomp($ENV{'snapshot_id2'});
    64     } else {
    65         $ENV{'snapshot_id3'} = `wget -O - http://www.greenstone.org/next-release-greenstone3.txt 2>nul`;
    66         chomp($ENV{'snapshot_id3'});
    67     }
     62    $ENV{'snapshot_id2'}=`ssh nzdl\@puka.cs.waikato.ac.nz cat /greenstone/greenstone.org/base/next-release.txt`;
     63
     64    #TODO: generalise this for all oses!
     65    chomp($ENV{'snapshot_id2'});
     66    $ENV{'snapshot_id3'}=`ssh nzdl\@puka.cs.waikato.ac.nz cat /greenstone/greenstone.org/base/next-release-greenstone3.txt`;
     67    chomp($ENV{'snapshot_id3'});
    6868
    6969    #change the filenames to have the date in them
     
    7777    if ( $ENV{'TASK_NAME'} =~ "stable\$" ) {
    7878        $ENV{'BRANCH_PATH'}="stable";
     79
     80        #dont proceed if main/stable is old
     81        #get last changed date from svn
     82        open( INFO, "svn info http://svn.greenstone.org/main/stable|" )
     83            or die "Cant determine age of stable tag";
     84        my $changed_date;
     85        while ( my $line = <INFO>) {
     86            chomp($line);
     87            if ( $line =~ /^Last Changed Date:/ ) {
     88                $changed_date = $line;
     89                break;
     90            }
     91        }
     92        close(INFO);
     93        #change the format
     94        $changed_date =~ s/.*: ([^ ]+) .*/\1/g;
     95        if ( $changed_date !~ /^20[0-9]{2}-[0-9]{2}-[0-9]{2}$/ ) {
     96            die "Cant determine age of stable tag";
     97        }
     98        $changed_date =~ s/-/./g;
     99        #check if main/stable is new
     100        if ( $changed_date ne get_date() ) {
     101            print "main/stable is old, will not create snapshot\n";
     102            exit;
     103        } else {
     104            print "main/stable is fresh, will create snapshot\n";
     105        }
    79106    }
    80107    $ENV{'UPLOAD_DIR'}="nzdl\@puka.cs.waikato.ac.nz:/greenstone/greenstone.org/base/release-snapshots";
     
    85112
    86113#always rename the log not to clash with other files on puka
    87 $ENV{'munges'} = $ENV{'munges'} . " s/\.out/-" . get_date() . "-" . $^O . "-log.txt/";
     114$ENV{'munges'} = $ENV{'munges'} . " s/\.out/-" . get_date() . "-log.txt/";
     115
     116
    88117
    89118#choose a snapshot ID
Note: See TracChangeset for help on using the changeset viewer.