Changeset 27668

Show
Ignore:
Timestamp:
19.06.2013 22:00:17 (6 years ago)
Author:
kjdon
Message:

task.pl works for windows now, except for the upload/emailing function. Diffcol still has several issues.

Files:
1 modified

Legend:

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

    r27667 r27668  
    3838# TASK_HOME should be the toplevel diffcol folder 
    3939$ENV{'TASK_HOME'} = getcwd unless defined $ENV{'TASK_HOME'}; 
     40$ENV{'TASK_HOME'} =~ s@\/@\\@g if $isWin; 
    4041##    print STDERR "@@@ TASK_HOME: ".$ENV{'TASK_HOME'}."\n"; 
    4142 
    4243 
    43 $ENV{'DATA_DIR'} = filename_concat($ENV{'TASK_HOME'}, "diffcol-data"); 
    44 $ENV{'UPLOAD_DIR'} = filename_concat($ENV{'TASK_HOME'}, "diffcol-reports"); 
     44$ENV{'DATA_DIR'} = &filename_concat($ENV{'TASK_HOME'}, "diffcol-data"); 
     45$ENV{'UPLOAD_DIR'} = &filename_concat($ENV{'TASK_HOME'}, "diffcol-reports"); 
    4546$ENV{'MONITOR_EMAIL'} = "greenstone_team\@cs.waikato.ac.nz"; # need to escape @ sign 
    4647$ENV{'GSDL_SMTP'} = ""; 
     
    115116my @files = <$jar_lib_path/*.jar>; # /full/path/to/diffcol/lib/*jar 
    116117foreach my $file (@files) { 
     118    $file =~ s@\/@\\@g if $isWin; 
    117119    $ENV{'CLASSPATH'}=$file.$pathsep.$ENV{'CLASSPATH'}; 
    118120} 
     
    169171    print STDERR "Run as: $0 (help|setup_greenstone|run_test|summarise|upload|all)\n"; 
    170172} 
    171  
    172173 
    173174#http://stackoverflow.com/questions/7427262/read-a-file-and-save-it-in-variable-using-shell-script 
     
    208209    # http://stackoverflow.com/questions/758611/how-to-flush-output-in-backticks-in-perl?rq=1 
    209210    my $status = system "$cmd"; #my $status = `$cmd`; 
     211    if($status != 0) { 
     212        print STDERR "@@@ SVN checkout of $gsdl failed\n"; 
     213        exit -1; 
     214    }    
    210215    print STDERR "done\n"; 
    211216 
     
    216221    ##print STDERR "@@@ OS:  $^O.|".$Config{'archname64'}."|\n"; 
    217222 
    218     # if we're on linux/darwin, need gnome-lib for the correct architecture. 
    219     if(!$isWin) { 
    220  
     223     
     224    if($isWin) { 
     225        print STDERR "Compiling $gsdl using makegs2.bat running in auto (silent) mode\n"; 
     226     
     227        # we're now in the GS2 folder, call makegs2 with silent param 
     228        $cmd = "makegs2.bat silent 2>> $ENV{'DATA_DIR'}/compilation-errors"; # STDERR is sent to compilation-errors file 
     229        $status = system $cmd; 
     230         
     231    } else { # if we're on linux/darwin, need gnome-lib for the correct architecture. 
     232     
    221233    print STDERR "setting up gnome-lib-minimal for compilation\n"; 
    222234 
     
    282294     
    283295    $cmd .= "\""; # close off cmd to bash and run it 
    284     system $cmd;     
    285     } 
    286  
     296    $status = system $cmd; 
     297    } 
     298     
     299    if($status != 0) { 
     300        print STDERR "@@@ Compile failed\n"; 
     301        exit -1; 
     302    } 
     303     
    287304    # set the path to the greenstone_home variable                              
    288305    $greenstone_home="$ENV{'DATA_DIR'}$sep$gsdl"; 
     
    293310sub run_test 
    294311{ 
    295     open (my $xml_fh, '>'.$xmlout) || die "Could not open xml file $xmlout for appending: $!\n";    
     312    open (my $xml_fh, '>'.$xmlout) || die "Could not open xml file $xmlout for appending: $!\n"; 
    296313 
    297314    # perform the requested subcommands, outputting xml information 
     
    309326    print STDERR "getting svn info: $xmlout\n"; 
    310327    print $xml_fh "<svn-info>\n"; 
    311     run_and_print_cmd("svn info", $xml_fh); 
     328    &run_and_print_cmd("svn info", $xml_fh); 
    312329    print $xml_fh "</svn-info>\n"; 
    313330    print STDERR "done\n"; 
     
    405422 
    406423    } else { # Need to prefix cmd -c/-k as necessary 
    407     $cmd = "cd $greenstone_home && set GSDLHOME=&& source $setup_script.bat && cd $diffcol_dir && $cmd"; 
     424    $cmd = "cmd /c \"set GSDLHOME=&& $setup_script.bat && cd $diffcol_dir && perl -S $cmd\""; 
     425##  print STDERR "@@@@ Going to call command: $cmd\n";   
    408426    } 
    409427 
     
    422440 
    423441    } else { # Need to prefix cmd -c/-k as necessary 
    424     $cmd = "set GSDLHOME=&& source $setup_script.bat && $cmd"; 
    425     } 
    426  
    427     return system($cmd);  
     442    $cmd = "cmd /c \"set GSDLHOME=&& $setup_script.bat && perl -S $cmd\""; 
     443##  print STDERR "@@@@ Going to call command: $cmd\n"; 
     444     
     445    } 
     446 
     447    return system($cmd); 
    428448    #return &run_and_print_cmd($cmd, $fh); # doesn't work on cmds chained with bash -c 
    429449} 
     
    630650  ##system("/bin/bash -c \"./task @ARGV\""); 
    631651  ##print STDERR "/bin/bash -c ../etc/tasks/diffcol/task @ARGV" 
     652