Changeset 28661 for other-projects

Show
Ignore:
Timestamp:
20.11.2013 17:34:45 (6 years ago)
Author:
ak19
Message:

Committing the next installment of code to handle diffcol for GS3. Now it successfully compiles up GS3, while diffcol still works for GS2.

Location:
other-projects/nightly-tasks/diffcol/trunk
Files:
3 modified

Legend:

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

    r28609 r28661  
    5050my ($gv_test_os, $gv_model_os); # still just file globals 
    5151 
    52 $gv_strModelColRoot = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'},"/model-collect"); 
    53 $gv_strTestColRoot = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'},"/collect"); 
     52if($ENV{'GSDL3SRCHOME'}) { 
     53    $gv_strModelColRoot = &FileUtils::filenameConcatenate($ENV{'GSDL3SRCHOME'},"web","sites","localsite","/model-collect"); 
     54    $gv_strTestColRoot = &FileUtils::filenameConcatenate($ENV{'GSDL3SRCHOME'},"web","sites","localsite","/collect"); 
     55} else { 
     56    $gv_strModelColRoot = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'},"/model-collect"); 
     57    $gv_strTestColRoot = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'},"/collect"); 
     58} 
    5459 
    5560$gv_blnErrorStop = "false"; 
  • other-projects/nightly-tasks/diffcol/trunk/diffcol/gdbdiff.pm

    r28238 r28661  
    3434} 
    3535 
     36sub read_db  
     37{ 
     38    # need to sort text output of both test and model col database files, to normalise them for the comparison 
     39    # the -sort option to db2txt was added specifically to support diffcol 
     40    my($db_file) = @_; 
     41    my $db_cmd = "db2txt -sort $db_file 2>&1"; 
     42    if($db_file =~ m/\.jdb$/) { 
     43    print STDERR "NOT YET IMPLEMENTED\n"; 
     44    #$db_cmd = "jdb2txt -sort $db_file 2>&1"; 
     45    } 
     46 
     47    my $db_text = readin_gdb($db_cmd); 
     48    return $db_text; 
     49} 
     50 
     51sub text_to_db_to_text 
     52{ 
     53    my($db_text, $db_filename) = @_; 
     54 
     55    # http://stackoverflow.com/questions/1909262/how-can-i-pipe-input-into-a-java-command-from-perl 
     56    open PIPE, "| txt2db $db_filename"; 
     57    print PIPE "$db_text"; 
     58    close(PIPE); 
     59     
     60    return &read_db("$db_filename"); 
     61} 
     62 
    3663# for debugging. Prints txt contents of db to file 
    3764sub print_string_to_file  
    3865{ 
    39     my ($text, $outfile) = @_; 
    40      
    41     open(FOUT, ">$outfile") or die "ERROR failed to write to $outfile: $!\n"; 
     66    my ($text, $outfile) = @_; 
     67     
     68    open(FOUT, ">$outfile") or die "ERROR failed to write to $outfile: $!\n"; 
    4269    print FOUT $text; 
    4370    close(FOUT); 
     
    5178    my ($dbname, $dirname, $suffix)= &File::Basename::fileparse($full_testdb, "\\.[^\\.]+\$"); 
    5279    
    53     # need to sort text output of both test and model col database files, to normalise them for the comparison 
    54     # the -sort option to db2txt was added specifically to support diffcol 
    55     my $model_cmd = "db2txt -sort $full_modeldb 2>&1"; 
    56     my $test_cmd  = "db2txt -sort $full_testdb 2>&1"; 
    57  
    58     my $model_text = readin_gdb($model_cmd); 
    59     my $test_text = readin_gdb($test_cmd); 
     80    my $model_text = read_db($full_modeldb); 
     81    my $test_text = read_db($full_testdb); 
    6082 
    6183#   my $savepath = &getcwd."/../"; # TASK_HOME env var does not exist at this stage, but it's one level up from current directory 
     
    244266        # so that we get the tmp files in the same order in both model and test collections 
    245267         
    246         # http://stackoverflow.com/questions/1909262/how-can-i-pipe-input-into-a-java-command-from-perl 
    247         open PIPE, "| txt2db model.gdb"; 
    248         print PIPE "$model_text"; 
    249         close(PIPE); 
    250         open PIPE, "| txt2db test.gdb"; 
    251         print PIPE "$test_text"; 
    252         close(PIPE); 
    253          
    254         $model_cmd = " db2txt -sort model.gdb 2>&1"; 
    255         $test_cmd  = "db2txt -sort test.gdb 2>&1"; 
    256         $model_text = readin_gdb($model_cmd); 
    257         $test_text = readin_gdb($test_cmd); 
     268        $model_text = text_to_db_to_text($model_text, "model.gdb"); 
     269        $test_text = text_to_db_to_text($test_text, "test.gdb"); 
    258270    }    
    259271 
  • other-projects/nightly-tasks/diffcol/trunk/task.pl

    r28634 r28661  
    4747my $pathsep = $isWin ? ";" : ":"; 
    4848#my $script_ext = $isWin ? ".bat" : ".bash"; 
    49 my $setup_script = "setup"; # needs to become gs3-setup for GS3 
     49my $setup_script = "setup"; # will become gs3-setup for GS3 
    5050my $use_blat = 0; # if we ever get blat to send mail/attachments on Windows working, set this to 1 
    5151 
     
    126126    } elsif($ARGV[$i] =~ m/--gs(2|3)/) { 
    127127    $install_version = $1; 
     128    $setup_script = $install_version eq "3" ? "gs3-setup" : "setup"; # needs to become gs3-setup for GS3 
    128129    splice @ARGV, $i, 1; # remove the element from the argument array 
    129130    } 
     
    190191} 
    191192 
    192 #print STDERR "Install type $install_type\n"; 
    193 #print STDERR "Install version $install_version\n"; 
    194  
     193print STDERR "Install type $install_type\n"; 
     194print STDERR "Install version $install_version\n"; 
    195195 
    196196#check key environment vars are set 
     
    239239 
    240240#set the location of the full report                                                
    241 my $xmlout=filename_concat($ENV{'DATA_DIR'}, "full-report-$dateid.xml"); 
     241my $xmlout=filename_concat($ENV{'DATA_DIR'}, "full-report-$install_version-$dateid.xml"); 
    242242##print STDERR "XML: $xmlout\n"; 
    243243 
    244244# the toplevel folder of the greenstone installation being used 
    245 my $greenstone_home=""; 
     245my $greenstone3_home=""; 
     246my $greenstone_home=""; # gs2build for gs3, toplevel install folder for gs2 
    246247# gsdl is the checkout folder and can be greenstone2 or greenstone3 
    247248my $gsdl="greenstone2"; 
    248249 
    249  
    250250# Check if using existing compiled-up greenstone installation 
    251251# and set the greenstone_home location accordingly 
     
    253253if(defined $ENV{'GSDL3SRCHOME'} || defined $ENV{'GSDLHOME'}) { 
    254254    print STDERR "Found existing Greenstone home, will use that instead\n"; 
    255     $greenstone_home=$ENV{'GSDLHOME'}; 
     255    $greenstone_home=$ENV{'GSDLHOME'} if defined $ENV{'GSDLHOME'}; 
     256 
     257    if(defined $ENV{'GSDL3SRCHOME'}) { 
     258    print STDERR "*** GSDL3SRCHOME set, changing to using installed GS3\n"; 
     259    $gsdl = "greenstone3"; 
     260    $install_version = "3"; 
     261    $greenstone3_home=$ENV{'GSDL3SRCHOME'}; 
     262    $greenstone_home=filename_concat($greenstone3_home, "gs2build") unless defined $ENV{'GSDLHOME'};     
     263    } 
    256264} else { 
    257     $greenstone_home=filename_concat($ENV{'DATA_DIR'}, $gsdl); 
     265    if($install_version eq "3") { 
     266    $gsdl = "greenstone3"; 
     267    $greenstone3_home=filename_concat($ENV{'DATA_DIR'}, $gsdl); 
     268    $greenstone_home=filename_concat($greenstone3_home, "gs2build"); 
     269    } else { 
     270    $greenstone_home=filename_concat($ENV{'DATA_DIR'}, $gsdl); 
     271    } 
    258272} 
    259273##print STDERR "GSHOME: $greenstone_home\n"; 
     
    300314sub setup_greenstone 
    301315{ 
     316    if($install_version eq "3" && !defined $ENV{'JAVA_HOME'}) { 
     317    print "*** JAVA_HOME not set. Set it and add its bin folder to the PATH\n"; 
     318    exit 0; 
     319    } 
     320 
    302321    #clean up from previous tests 
    303322    print STDERR "about to clean up any old tests (Ctrl-C to cancel)"; # no newline 
     
    310329    # http://perldoc.perl.org/File/Path.html 
    311330    print STDERR "cleaning up previous tests\n"; 
    312     &File::Path::remove_tree($ENV{'DATA_DIR'}); 
    313  
     331    #&File::Path::remove_tree($ENV{'DATA_DIR'}); 
     332    if(-d $greenstone_home && $install_version eq "2") { 
     333    &File::Path::remove_tree($greenstone_home); 
     334    } 
     335    if(-d $greenstone3_home && $install_version eq "3") { 
     336    &File::Path::remove_tree($greenstone3_home); 
     337    } 
     338    unlink glob "$ENV{'DATA_DIR'}$sep"."*report-$install_version*"; 
     339    unlink "$ENV{'DATA_DIR'}$sep"."compilation-errors"; 
    314340    print STDERR "creating the data dir\n"; 
    315     &File::Path::make_path($ENV{'DATA_DIR'}); # works like mkdir -p 
     341    #&File::Path::make_path($ENV{'DATA_DIR'}); # works like mkdir -p 
    316342 
    317343    chdir($ENV{'DATA_DIR'}); 
     
    324350 
    325351    # Else checkout a GS from svn into DATA_DIR 
     352    if($install_type eq "svn") { 
     353    &checkout_gs_from_svn(); 
     354    ##print STDERR "$ENV{'DATA_DIR'}$sep$gsdl\n"; 
     355 
     356    if($install_version eq "2") { 
     357        &compile_gs2_svn(); 
     358    } else { 
     359        &compile_gs3_svn(); 
     360    } 
     361    } 
     362 
     363} 
     364 
     365sub checkout_gs_from_svn { 
    326366 
    327367    #svn checkout of main gsdl directory                                        
    328368    print STDERR "checkout $gsdl:\n"; 
    329     my $cmd = "svn co ".$ENV{'SVN_OPT_REV'}." http://svn.greenstone.org/main/trunk/greenstone2 $gsdl"; 
     369    my $cmd = "svn co ".$ENV{'SVN_OPT_REV'}." http://svn.greenstone.org/main/trunk/greenstone$install_version $gsdl"; 
    330370    ##print STDERR "Checkout CMD: $cmd\n"; 
    331371 
     
    333373    # http://stackoverflow.com/questions/758611/how-to-flush-output-in-backticks-in-perl?rq=1 
    334374    my $status = system "$cmd"; #my $status = `$cmd`; 
    335     if($status != 0) { 
    336         print STDERR "@@@ SVN checkout of $gsdl failed\n"; 
    337         exit -1; 
    338     }    
     375    if($status != 0) { 
     376    print STDERR "@@@ SVN checkout of $gsdl failed\n"; 
     377    exit -1; 
     378    }    
    339379    print STDERR "done\n"; 
    340  
    341     ##print STDERR "$ENV{'DATA_DIR'}$sep$gsdl\n"; 
    342  
    343     chdir("$ENV{'DATA_DIR'}$sep$gsdl"); 
    344  
    345     ##print STDERR "@@@ OS:  $^O.|".$Config{'archname64'}."|\n"; 
    346      
    347     if($isWin) { 
    348         print STDERR "Compiling $gsdl using makegs2.bat running in auto (silent) mode\n"; 
    349      
    350         # we're now in the GS2 folder, call makegs2 with silent param 
    351         $cmd = "makegs2.bat silent 2>> $ENV{'DATA_DIR'}/compilation-errors"; # STDERR is sent to compilation-errors file 
    352         $status = system $cmd; 
    353         if($status != 0) { 
    354             print STDERR "Greenstone compilation on Windows failed\n"; 
    355             exit -1; 
    356         } 
    357          
    358     } else { # if we're on linux/darwin, need gnome-lib for the correct architecture. And need imagemagick to build imgs in collections 
     380} 
     381 
     382sub getImageMagickBins { 
     383    my ($cmd, $status); 
     384    my $imagickzip = ""; 
     385 
     386    chdir ("$greenstone_home"); 
     387    if(!$isWin) { # if we're on linux/darwin, need gnome-lib for the correct architecture. And need imagemagick to build imgs in collections 
    359388        
    360389    my $bit_arch=`uname -m`; 
    361  
    362     # imagmagick binary 
     390     
     391    # imagemagick binary 
    363392    print STDERR "Getting imagemagick binary\n"; 
    364  
     393     
    365394    my $os = $isMac ? "darwin" : "linux"; 
    366     my $imagickzip = "imagemagick-$os"; 
     395    $imagickzip = "imagemagick-$os"; 
    367396     
    368397    if($isMac) { 
    369 #       $imagickzip .= "-10.5.tar.gz"; 
     398#       $imagickzip .= "-10.5.tar.gz"; 
    370399        # at present, only the Imagemagick binaries created by Max for darwin work on the Macs 
    371         &File::Path::make_path($ENV{'DATA_DIR'}."$sep$gsdl$sep$os"); # need to ensure gsdl/bin/darwin exists 
     400#       &File::Path::make_path("$greenstone_home$sep"."bin"."$sep$os"); # need to ensure gsdl/bin/darwin exists 
    372401        $cmd = "svn export http://svn.greenstone.org/main/trunk/binaries/mac/intel/imagemagick bin/darwin/imagemagick"; 
    373402        $status = system($cmd); 
    374         if($status != 0) { 
    375             print STDERR "@@@ Unable to get imagemagick for darwin\n"; 
    376         } 
    377  
    378         # need ghostscript mac binary too for pdf to img conversions on mac 
     403        if($status != 0) { 
     404        print STDERR "@@@ Unable to get imagemagick for darwin\n"; 
     405        } 
     406         
     407        # need ghostscript mac binary too for pdf to img conversions on mac 
    379408        $cmd = "svn export http://svn.greenstone.org/main/trunk/binaries/mac/intel/ghostscript bin/darwin/ghostscript"; 
    380409        $status = system($cmd); 
    381         if($status != 0) { 
    382             print STDERR "@@@ Unable to get ghostscript for darwin\n"; 
    383         } 
    384  
    385         # the imagemagick and ghostscript binaries have been set to executable on svn trac now 
    386 #       system("chmod -R u+x $ENV{'DATA_DIR'}/$gsdl/bin/darwin/imagemagick/bin/*"); 
    387 #       system("chmod -R u+x $ENV{'DATA_DIR'}/$gsdl/bin/darwin/ghostscript/bin/*"); 
     410        if($status != 0) { 
     411        print STDERR "@@@ Unable to get ghostscript for darwin\n"; 
     412        } 
     413         
     414        # the imagemagick and ghostscript binaries have been set to executable on svn trac now 
     415#       system("chmod -R u+x $greenstone_home/bin/darwin/imagemagick/bin/*"); 
     416#       system("chmod -R u+x $greenstone_home/bin/darwin/ghostscript/bin/*"); 
    388417    } else { # linux 
    389418        my $extension64 = ($bit_arch =~ m/64$/) ? "-x64" : ""; 
     
    395424        system("cd ext && tar -xvzf $imagickzip"); 
    396425    } 
     426    } 
     427    return $imagickzip; 
     428} 
     429 
     430sub getGnomeLibExt 
     431{ 
     432    my ($cmd, $status); 
     433    my $bit_arch=`uname -m`; 
     434    my $os = $isMac ? "darwin" : "linux"; 
    397435 
    398436    # gnomelib binary 
     
    412450 
    413451    #svn checkout gnome-lib for this linux/darwin 
    414     chdir("$ENV{'DATA_DIR'}$sep$gsdl$sep"."ext"); #cd $DATA_DIR/$gsdl/ext 
     452    chdir("$greenstone_home$sep"."ext"); #cd $DATA_DIR/$gsdl/ext 
    415453 
    416454    ##print STDERR "**** gnomelib: $gnome_lib_file\n"; 
     
    423461    system ("tar -xvzf gl.tar.gz"); 
    424462 
    425     chdir("gnome-lib-minimal"); 
    426463    ##print STDERR "*** ARCH: $bit_arch\n"; 
    427  
     464} 
     465 
     466 
     467 
     468sub compile_gs3_svn() { 
     469    my ($cmd, $status); 
     470    chdir ("$greenstone3_home"); 
     471 
     472    $cmd = "ant"; # creates the build.properties file from the .in template 
     473    $status = system $cmd; 
     474    if($status != 0) { 
     475    print STDERR "Unable to run the ant command: $status\n"; 
     476    exit -1; 
     477    } 
     478     
     479    $cmd = "ant -Dproperties.ok=y -Dcheckout.gnomelib.ext=true prepare"; # pass in confirmation to ant prepare step 
     480    $status = system $cmd; 
     481    if($status != 0) { 
     482    print STDERR "Failed to run $cmd command: $status\n"; 
     483    exit -1; 
     484    } 
     485 
     486    my $imagickzip = &getImageMagickBins(); 
     487    chdir ("$greenstone3_home"); 
     488 
     489    $cmd = "ant -Dcheckout.gnomelib.ext=true install"; # Compile with gnome-lib. 
     490    $status = system $cmd; 
     491    if($status != 0) { 
     492    print STDERR "Failed to run $cmd command: $status\n"; 
     493    exit -1; 
     494    } 
     495} 
     496 
     497sub compile_gs2_svn() {     
     498    my $imagickzip = &getImageMagickBins(); 
     499    &getGnomeLibExt();  
     500 
     501    my ($cmd, $status); 
     502    my $os = $isMac ? "darwin" : "linux"; 
     503 
     504    chdir("$greenstone_home"); #chdir("$ENV{'DATA_DIR'}$sep$gsdl"); # goes into toplevel gs2 or gs3 folder 
     505 
     506    ##print STDERR "@@@ OS:  $^O.|".$Config{'archname64'}."|\n"; 
     507     
     508    if($isWin) { 
     509    print STDERR "Compiling $gsdl using makegs2.bat running in auto (silent) mode\n"; 
     510     
     511    # we're now in the GS2 folder, call makegs2 with silent param 
     512    $cmd = "makegs2.bat silent 2>> $ENV{'DATA_DIR'}/compilation-errors"; # STDERR is sent to compilation-errors file 
     513    $status = system $cmd; 
     514    if($status != 0) { 
     515        print STDERR "Greenstone compilation on Windows failed\n"; 
     516        exit -1; 
     517    } 
     518     
     519    } else { # if we're on linux/darwin, need gnome-lib for the correct architecture. And need imagemagick to build imgs in collections 
     520     
     521    chdir("ext$sep"."gnome-lib-minimal"); 
     522     
    428523    # need to run source devel.bash on gnome-lib followed by configure, make, make install  
    429524    # in one go, in order to preserve the compile environment set up by sourcing devel.bash 
     
    464559 
    465560    if(!$isMac) { # Linux 
    466         # Moving imagemagick after instead of before compilation, since bin/darwin gets overwritten during compilation 
    467         move("$ENV{'DATA_DIR'}$sep$gsdl$sep"."ext/imagemagick/$os", "$ENV{'DATA_DIR'}$sep$gsdl$sep"."bin/$os/imagemagick"); # http://www.perlmonks.org/?node_id=586537 
    468         unlink "$ENV{'DATA_DIR'}/$gsdl"."/ext/$imagickzip" or warn "Could not unlink ext/$imagickzip: $!"; 
    469         &File::Path::remove_tree("$ENV{'DATA_DIR'}$sep$gsdl$sep"."ext/imagemagick"); # the untarred parent folder 
    470     } 
    471  
    472     } 
    473      
    474     if($status != 0) { 
    475         print STDERR "@@@ Compilation of Greenstone on Linux/Mac failed\n"; 
    476         exit -1; 
    477     } 
    478  
    479     &getIsisGdl("$ENV{'DATA_DIR'}/$gsdl"); 
     561        # Moving imagemagick after instead of before compilation, since bin/darwin and bin/linux gets overwritten during compilation 
     562        move("$greenstone_home$sep"."ext/imagemagick/$os", "$greenstone_home$sep"."bin/$os/imagemagick"); # http://www.perlmonks.org/?node_id=586537 
     563        unlink "$greenstone_home$sep"."ext$sep$imagickzip" or warn "Could not unlink ext/$imagickzip: $!"; 
     564        &File::Path::remove_tree("$greenstone_home$sep"."ext$sep"."imagemagick"); # the untarred parent folder 
     565    } 
     566 
     567    } 
     568     
     569    if($status != 0) { 
     570    print STDERR "@@@ Compilation of Greenstone on Linux/Mac failed\n"; 
     571    exit -1; 
     572    } 
     573     
     574    &getIsisGdl("$greenstone_home"); #&getIsisGdl("$ENV{'DATA_DIR'}/$gsdl"); 
    480575     
    481576    # set the path to the greenstone_home variable                              
    482     $greenstone_home="$ENV{'DATA_DIR'}$sep$gsdl"; 
    483      
     577    #$greenstone_home="$ENV{'DATA_DIR'}$sep$gsdl";   
    484578} 
    485579 
     
    542636     
    543637    if(!$isWin) { 
     638    chdir($greenstone_home); 
    544639    my $bit_arch=`uname -m`; 
    545640    if ($bit_arch =~ m/64$/) { 
     
    560655# http://stackoverflow.com/questions/3377879/how-do-i-receive-command-output-immediately 
    561656sub run_test 
    562 {    
     657{ 
     658    my $collect_parent = $greenstone_home; 
     659    my $model_collect = "model-collect"; 
     660    my $build_options = ""; 
     661    if($install_version eq "3") { 
     662    $collect_parent = &filename_concat($greenstone3_home,"web","sites","localsite");     
     663    $model_collect = "gs3-model-collect"; 
     664    $build_options = " -site localsite "; 
     665    chdir($greenstone3_home); 
     666    } else { 
     667    chdir($greenstone_home); 
     668    } 
     669 
    563670    my $num_cols = scalar(@collections); # remember the empty case 
    564671     
     
    594701     
    595702    if(!$use_local_rebuild) {    
    596         print $xml_fh "Updating $ENV{'TASK_HOME'}/model-collect:\n"; 
     703        print $xml_fh "Updating $ENV{'TASK_HOME'}/$model_collect:\n"; 
    597704        for my $col (@collections) { 
    598             $cmd = "svn up $ENV{'TASK_HOME'}/model-collect$col"; #chdir("$ENV{'TASK_HOME'}/model-collect"); 
     705            $cmd = "svn up $ENV{'TASK_HOME'}/$model_collect$col"; #chdir("$ENV{'TASK_HOME'}/$model_collect"); 
    599706            $status = system "$cmd"; 
    600707        } 
    601708    } 
    602709 
    603     # go to whichever greenstone_home we're using 
    604     chdir($greenstone_home); 
     710    # go to whichever collecthome parent we're using 
     711    chdir($collect_parent); 
    605712 
    606713    # get svn info 
     
    619726        #copy the model collections to the collect folder to be rebuilt 
    620727        print STDERR "installing test collections and model collections to new $gsdl installation... "; 
    621      
    622728        #clean up 
    623729        if(-d "collect") { 
     
    642748                #copy to collect and strip .svn subfolders 
    643749                &File::Path::make_path("collect$col"); # create the folder and copy contents across 
    644                 &copy_recursively(&filename_concat("$ENV{'TASK_HOME'}","model-collect$col"), "collect$col", ".svn"); 
     750                &copy_recursively(&filename_concat("$ENV{'TASK_HOME'}","$model_collect$col"), "collect$col", ".svn"); 
    645751                 
    646752                #make the model copy 
     
    659765        @collections = (); # get rid of the empty string put in the array to represent "all collections" 
    660766         
    661         opendir my($collect_handle), "collect" or die "Could not open dir $greenstone_home/collect: $!"; 
     767        opendir my($collect_handle), "collect" or die "Could not open dir $collect_parent/collect: $!"; 
    662768     
    663769        for my $collection (readdir $collect_handle) { 
     
    687793    print STDERR "*** Found collection $collection\n"; 
    688794    print $xml_fh "<collection-test name=\"$collection\">\n"; 
     795 
     796    # run the building scripts from the toplevel of the GS installation 
     797    if($install_version eq "3") { 
     798        chdir($greenstone3_home); 
     799    } else { 
     800        chdir($greenstone_home); 
     801    } 
    689802 
    690803    if(!$use_local_rebuild) {        
     
    696809        print STDERR "$collection - Importing:\n"; 
    697810        print $xml_fh "<import>\n"; 
    698         &run_build_script("import.pl -removeold $collection"); #-OIDtype hash_on_full_filename 
     811        &run_build_script("import.pl $build_options -removeold $collection"); #-OIDtype hash_on_full_filename 
    699812        print $xml_fh "</import>\n"; 
    700813        print STDERR "done\n";   
     
    703816        print STDERR "$collection - Building:\n"; 
    704817        print $xml_fh "<build>\n"; 
    705         &run_build_script("buildcol.pl -removeold $collection"); 
     818        &run_build_script("buildcol.pl $build_options -removeold $collection"); 
    706819        print $xml_fh "</build>\n"; 
    707820        print STDERR "done\n"; 
     
    709822        #rename the intermediate 'building' directory 'index' 
    710823        print STDERR "$collection - Move \"building\" to \"index\"... "; 
    711         my $index = &filename_concat("collect", $collection, "index"); 
    712         my $building = &filename_concat("collect", $collection, "building"); 
     824        my $index = &filename_concat($collect_parent, "collect", $collection, "index"); 
     825        my $building = &filename_concat($collect_parent, "collect", $collection, "building"); 
    713826        &File::Path::remove_tree($index); 
    714827        # Renaming Directories, http://www.perlmonks.org/?node_id=177421 
     
    720833    my $diffcol_dir = &filename_concat($ENV{'TASK_HOME'},"diffcol"); 
    721834     
     835#   chdir($collect_parent); # this is actually where we are 
    722836    # help diffcol to know on what os the model cols were generated 
    723837    # and what os this test machine is (on which the test cols will be generated) 
     
    725839    &run_diff_script($cmd, $xml_fh, $diffcol_dir); 
    726840 
    727     chdir($greenstone_home); # this is actually where we are 
     841    if($install_version eq "3") { 
     842        chdir($greenstone3_home); # this is actually where we are 
     843    } else { 
     844        chdir($greenstone_home); # this is actually where we are 
     845    } 
    728846    print STDERR "done\n"; 
    729847    print $xml_fh "</collection-test>\n"; 
     
    741859    my ($cmd, $fh, $diffcol_dir) = @_; 
    742860 
     861    my $linux_ext = ($install_version eq "3") ? "sh" : "bash"; 
     862 
    743863    # we're in greenstone_home now 
    744864    if(!$isWin) {    
    745     $cmd = "bash -c \"export GSDLHOME=&& source $setup_script.bash && cd $diffcol_dir && ./$cmd\""; 
     865    $cmd = "bash -c \"export GSDL3SRCHOME=&& export GSDLHOME=&& source $setup_script.$linux_ext && cd $diffcol_dir && ./$cmd\""; 
    746866 
    747867    } else { # Need to prefix cmd -c/-k as necessary 
    748     $cmd = "cmd /c \"set GSDLHOME=&& $setup_script.bat && cd $diffcol_dir && perl -S $cmd\""; 
     868    $cmd = "cmd /c \"set GSDL3SRCHOME=&& set GSDLHOME=&& $setup_script.bat && cd $diffcol_dir && perl -S $cmd\""; 
    749869##  print STDERR "@@@@ Going to call command: $cmd\n";   
    750870    } 
     
    756876sub run_build_script {     
    757877    my ($cmd, $fh) = @_; 
     878    my $linux_ext = ($install_version eq "3") ? "sh" : "bash"; 
    758879 
    759880#    chdir($greenstone_home); 
    760881    # we are in $greenstone_home already, can directly run the build cmd on the collection 
    761882    if(!$isWin) { 
    762     $cmd = "bash -c \"export GSDLHOME=&& source $setup_script.bash && $cmd\""; 
     883    $cmd = "bash -c \"export GSDL3SRCHOME=&& export GSDLHOME=&& source $setup_script.$linux_ext && $cmd\""; 
    763884 
    764885    } else { # Need to prefix cmd -c/-k as necessary 
    765     $cmd = "cmd /c \"set GSDLHOME=&& $setup_script.bat && perl -S $cmd\""; 
     886    $cmd = "cmd /c \"set GSDL3SRCHOME=&& set GSDLHOME=&& $setup_script.bat && perl -S $cmd\""; 
    766887    } 
    767888##     print STDERR "@@@@ Going to call command: $cmd\n"; 
     
    845966    # make a summarised Xml report 
    846967    print STDERR "Summarizing the xml report... "; 
    847     my $cmd = "java org.apache.xalan.xslt.Process -IN $xmlout -XSL $ENV{'TASK_HOME'}/xsl/xml-report.xsl -OUT $ENV{'DATA_DIR'}/report-$dateid.xml"; 
     968    my $cmd = "java org.apache.xalan.xslt.Process -IN $xmlout -XSL $ENV{'TASK_HOME'}/xsl/xml-report.xsl -OUT $ENV{'DATA_DIR'}/report-$install_version-$dateid.xml"; 
    848969    my $status = system($cmd); 
    849970    print STDERR "done\n"; 
     
    851972    # make a summarised HTMl report 
    852973    print STDERR "Creating an html summary report... "; 
    853     $cmd = "java org.apache.xalan.xslt.Process -IN $ENV{'DATA_DIR'}/report-$dateid.xml -XSL $ENV{'TASK_HOME'}/xsl/html-report.xsl -OUT $ENV{'DATA_DIR'}/report-$dateid.html"; 
     974    $cmd = "java org.apache.xalan.xslt.Process -IN $ENV{'DATA_DIR'}/report-$install_version-$dateid.xml -XSL $ENV{'TASK_HOME'}/xsl/html-report.xsl -OUT $ENV{'DATA_DIR'}/report-$install_version-$dateid.html"; 
    854975    $status = system($cmd); 
    855976    print STDERR "done\n"; 
     
    8801001    for my $entry (readdir $dh) { 
    8811002    next if ($entry !~ m/(\.xml|\.html?)$/); 
     1003    next if ($entry !~ m/(report-$install_version)/); 
    8821004 
    8831005    # copy the reports across with different names: with OS prefixed to them. And for the HTML file on Win, rename to HTM 
     
    9231045    # if you need to touch the file on windows: http://stackoverflow.com/questions/51435/windows-version-of-the-unix-touch-command 
    9241046     
    925     # the report we want to upload is actually just os-diffcol-report-$dateid.html 
     1047    # the report we want to upload is actually just os-diffcol-report-$install_version-$dateid.html 
    9261048    my $command = "cd \"$ENV{'UPLOAD_DIR'}\" && tar -c *.htm* | "; #&& cat *.html | "; # && tar -c * | 
    9271049    $command .= ($^O eq "MSWin32" ? "plink" : "ssh"); 
     
    9551077    my $msg = "$gsdl regression test for $dateid failed"; 
    9561078    my $subject = "Regression Test Failed"; #"$gsdl regression test for $dateid failed\n"; 
    957     my $attach_file = &filename_concat($ENV{'DATA_DIR'}, "report-$dateid.html"); 
     1079    my $attach_file = &filename_concat($ENV{'DATA_DIR'}, "report-$install_version-$dateid.html"); 
    9581080 
    9591081    if($isWin) {