Changeset 28072 for other-projects


Ignore:
Timestamp:
2013-08-15T22:17:32+12:00 (11 years ago)
Author:
ak19
Message:

New variable use_local_rebuild, though not for nightly use, can speed up local testing of new tutorials to be committed.

File:
1 edited

Legend:

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

    r28005 r28072  
    3838my $setup_script = "setup"; # needs to become gs3-setup for GS3
    3939my $use_blat = 0; # if we ever get blat to send mail/attachments on Windows working, set this to 1
    40 my $use_static_model = 0; # set to 1 (true) if working with a non-svn model-collection
     40
     41my $use_local_rebuild = 0; # set to 1 (true) if we needn't copy model-collection over to the test collection again nor rebuild it (This is useful when having built the collection locally once before)
     42my $use_static_model = 0; # set to 1 (true) if working with a non-svn model-collection. Defaults to 1 if $use_local_rebuild is turned on
     43
     44# if use_local_rebuild is on, use_static_model should be on
     45if ($use_local_rebuild && !$use_static_model) {
     46    $use_static_model = 1;
     47}
    4148
    4249
     
    421428    # perform the requested subcommands, outputting xml information
    422429    print $xml_fh "<test time=\"$dateid\" id=\"$dateid\">\n";
    423    
     430   
     431    my $cmd;
    424432    # make sure that diffcol/model-collect is up to date before copying it over to greenstone-home
    425 
    426     print $xml_fh "Updating $ENV{'TASK_HOME'}/model-collect:\n";
    427     my $cmd = "svn up $ENV{'TASK_HOME'}/model-collect"; #chdir("$ENV{'TASK_HOME'}/model-collect");
    428     my $status = system "$cmd";
     433   
     434    if(!$use_local_rebuild) {   
     435        print $xml_fh "Updating $ENV{'TASK_HOME'}/model-collect:\n";
     436        $cmd = "svn up $ENV{'TASK_HOME'}/model-collect"; #chdir("$ENV{'TASK_HOME'}/model-collect");
     437        my $status = system "$cmd";
     438    }
    429439
    430440    # go to whichever greenstone_home we're using
     
    444454    #copy the model collections to the collect folder to be rebuilt
    445455    print STDERR "installing test collections and model collections to new $gsdl installation... ";
    446    
    447     #clean up
    448     if(-d "collect") {
    449     &File::Path::remove_tree("collect") || die "Error could not delete collect: $!";
    450     }
    451 
    452     if($use_static_model) {     
    453     #copy to collect and strip .svn subfolders
    454     &File::Path::make_path("collect"); # create the collect folder and copy contents from static model-collection across
    455     &copy_recursively("model-collect", "collect", ".svn");
    456 
    457     } else { # the default situation: where we check out the model-collect from svn
    458     &File::Path::remove_tree("model-collect");
    459    
    460     #copy to collect and strip .svn subfolders
    461     &File::Path::make_path("collect"); # create the folder and copy contents across
    462     &copy_recursively(&filename_concat("$ENV{'TASK_HOME'}","model-collect"), "collect", ".svn");
    463    
    464     #make the model copy
    465     &File::Path::make_path("model-collect");
    466     &copy_recursively("collect", "model-collect"); # copy contents across
    467     }
    468     print STDERR "done\n";   
    469    
     456
     457    if(!$use_local_rebuild) {   
     458        #clean up
     459        if(-d "collect") {
     460        &File::Path::remove_tree("collect") || die "Error could not delete collect: $!";
     461        }
     462
     463        if($use_static_model) {     
     464        #copy to collect and strip .svn subfolders
     465        &File::Path::make_path("collect"); # create the collect folder and copy contents from static model-collection across
     466        &copy_recursively("model-collect", "collect", ".svn");
     467
     468        } else { # the default situation: where we check out the model-collect from svn
     469        &File::Path::remove_tree("model-collect");
     470       
     471        #copy to collect and strip .svn subfolders
     472        &File::Path::make_path("collect"); # create the folder and copy contents across
     473        &copy_recursively(&filename_concat("$ENV{'TASK_HOME'}","model-collect"), "collect", ".svn");
     474       
     475        #make the model copy
     476        &File::Path::make_path("model-collect");
     477        &copy_recursively("collect", "model-collect"); # copy contents across
     478        }
     479
     480        print STDERR "done\n";
     481    }   
    470482
    471483    #for each collection, import, build and diff with its model counterpart
     
    484496    print $xml_fh "<collection-test name=\"$collection\">\n";
    485497
    486     #import
    487 # Ensure the OIDtype for importing is hash_on_full_filename
    488 # "to make document identifiers more stable across upgrades of the software,
    489 # although it means that duplicate documents contained in the collection are
    490 # no longer detected automatically."
    491     print STDERR "$collection - Importing:\n";
    492     print $xml_fh "<import>\n";
    493     &run_build_script("import.pl -removeold $collection"); #-OIDtype hash_on_full_filename
    494     print $xml_fh "</import>\n";
    495     print STDERR "done\n"; 
    496 
    497     #build
    498     print STDERR "$collection - Building:\n";
    499     print $xml_fh "<build>\n";
    500     &run_build_script("buildcol.pl -removeold $collection");
    501     print $xml_fh "</build>\n";
    502     print STDERR "done\n";
    503    
    504     #rename the intermediate 'building' directory 'index'
    505     print STDERR "$collection - Move \"building\" to \"index\"... ";
    506     my $index = &filename_concat("collect", $collection, "index");
    507     my $building = &filename_concat("collect", $collection, "building");
    508     &File::Path::remove_tree($index);
    509     # Renaming Directories, http://www.perlmonks.org/?node_id=177421
    510     move($building, $index) or die "copy failed: $!"; # File::Copy::move
    511     print STDERR "done\n";
    512 
     498    if(!$use_local_rebuild) {       
     499        #import
     500    # Ensure the OIDtype for importing is hash_on_full_filename
     501    # "to make document identifiers more stable across upgrades of the software,
     502    # although it means that duplicate documents contained in the collection are
     503    # no longer detected automatically."
     504        print STDERR "$collection - Importing:\n";
     505        print $xml_fh "<import>\n";
     506        &run_build_script("import.pl -removeold $collection"); #-OIDtype hash_on_full_filename
     507        print $xml_fh "</import>\n";
     508        print STDERR "done\n"; 
     509
     510        #build
     511        print STDERR "$collection - Building:\n";
     512        print $xml_fh "<build>\n";
     513        &run_build_script("buildcol.pl -removeold $collection");
     514        print $xml_fh "</build>\n";
     515        print STDERR "done\n";
     516       
     517        #rename the intermediate 'building' directory 'index'
     518        print STDERR "$collection - Move \"building\" to \"index\"... ";
     519        my $index = &filename_concat("collect", $collection, "index");
     520        my $building = &filename_concat("collect", $collection, "building");
     521        &File::Path::remove_tree($index);
     522        # Renaming Directories, http://www.perlmonks.org/?node_id=177421
     523        move($building, $index) or die "copy failed: $!"; # File::Copy::move
     524        print STDERR "done\n";
     525    }
    513526    #diffcol
    514527    print STDERR "$collection - Diffing:\n";
Note: See TracChangeset for help on using the changeset viewer.