115 | | } |
| 118 | |
| 119 | # run_test action can take a subaction: nosvn|justdiff. |
| 120 | # nosvn: uses the model-collect as static and copies it over to collect, rebuilding what's currently in model-collect instead of copying |
| 121 | # it out from the svn model-collect again. |
| 122 | # justdiff: same as nosvn, but doesn't copy over model-collection to collect, and doesn't rebuild either of them. Just does the diff part. |
| 123 | if($action eq "run_test" && scalar(@ARGV) >= 2) { |
| 124 | push(@collections, @ARGV); |
| 125 | shift @collections; # remove action from array |
| 126 | |
| 127 | if($ARGV[1] =~ m@^--@) { |
| 128 | shift @collections; # remove subaction from array |
| 129 | |
| 130 | $subaction = $ARGV[1]; |
| 131 | if($subaction eq "--justdiff") { |
| 132 | $use_local_rebuild = $use_static_model = 1; |
| 133 | } elsif ($subaction eq "--nosvn") { |
| 134 | $use_static_model = 1; |
| 135 | } else { |
| 136 | print STDERR "Bad subaction.\n"; |
| 137 | &printusage; |
| 138 | exit -1; |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | # foreach my $col (@collections) { |
| 143 | # print STDERR "Collection: $col\n"; |
| 144 | # } |
| 145 | } |
| 146 | } |
| 147 | |
454 | | #make two copies of the model-collect directory in gsdl |
455 | | #one to be rebuilt and one as the basis for comparison |
456 | | #strip both of all .svn directories |
457 | | |
458 | | #copy the model collections to the collect folder to be rebuilt |
459 | | print STDERR "installing test collections and model collections to new $gsdl installation... "; |
460 | | |
461 | | if(!$use_local_rebuild) { |
| 500 | if(!$use_local_rebuild) { |
| 501 | |
| 502 | #make two copies of the model-collect directory in gsdl |
| 503 | #one to be rebuilt and one as the basis for comparison |
| 504 | #strip both of all .svn directories |
| 505 | |
| 506 | #copy the model collections to the collect folder to be rebuilt |
| 507 | print STDERR "installing test collections and model collections to new $gsdl installation... "; |
| 508 | |
468 | | #copy to collect and strip .svn subfolders |
469 | | &File::Path::make_path("collect"); # create the collect folder and copy contents from static model-collection across |
470 | | ©_recursively("model-collect", "collect", ".svn"); |
| 517 | for my $col (@collections) { |
| 518 | #copy to collect and strip .svn subfolders |
| 519 | &File::Path::make_path("collect$col"); # create the collect folder and copy contents from static model-collection across |
| 520 | ©_recursively("model-collect$col", "collect$col", ".svn"); |
| 521 | } |
473 | | &File::Path::remove_tree("model-collect"); |
474 | | |
475 | | #copy to collect and strip .svn subfolders |
476 | | &File::Path::make_path("collect"); # create the folder and copy contents across |
477 | | ©_recursively(&filename_concat("$ENV{'TASK_HOME'}","model-collect"), "collect", ".svn"); |
478 | | |
479 | | #make the model copy |
480 | | &File::Path::make_path("model-collect"); |
481 | | ©_recursively("collect", "model-collect"); # copy contents across |
| 524 | for my $col (@collections) { |
| 525 | &File::Path::remove_tree("model-collect$col"); |
| 526 | |
| 527 | #copy to collect and strip .svn subfolders |
| 528 | &File::Path::make_path("collect$col"); # create the folder and copy contents across |
| 529 | ©_recursively(&filename_concat("$ENV{'TASK_HOME'}","model-collect$col"), "collect$col", ".svn"); |
| 530 | |
| 531 | #make the model copy |
| 532 | &File::Path::make_path("model-collect$col"); |
| 533 | ©_recursively("collect$col", "model-collect$col"); # copy contents across |
| 534 | } |
487 | | #for each collection, import, build and diff with its model counterpart |
488 | | opendir my($collect_handle), "collect" or die "Could not open dir $greenstone_home/collect: $!"; |
489 | | for my $collection (readdir $collect_handle) { |
490 | | next if ($collection eq "." || $collection eq ".."); |
491 | | next if ($collection eq "modelcol"); |
492 | | # next if ($collection ne "Section-Tagging"); ## TEMPORARY, FOR TESTING THIS SCRIPT |
493 | | # next if ($collection !~ m/MARC/); ## TEMPORARY, FOR TESTING THIS SCRIPT |
| 540 | #for each collection, import, build and diff with its model counterpart |
| 541 | |
| 542 | # if working with all collections, read the list of collections from the folders in collect |
| 543 | if($num_cols == 0) { |
| 544 | @collections = (); # get rid of the empty string put in the array to represent "all collections" |
| 545 | |
| 546 | opendir my($collect_handle), "collect" or die "Could not open dir $greenstone_home/collect: $!"; |
| 547 | |
| 548 | for my $collection (readdir $collect_handle) { |
| 549 | next if ($collection eq "." || $collection eq ".."); |
| 550 | next if ($collection eq "modelcol"); |
| 551 | push(@collections, $collection); |
| 552 | } |
| 553 | closedir $collect_handle; # close handle to collect dir |
| 554 | } |
| 555 | |
| 556 | for my $collection (@collections) { |
| 557 | |
| 558 | # next if ($collection ne "Demo-Lucene"); ## TEMPORARY, FOR TESTING THIS SCRIPT |
| 559 | # next if ($collection !~ m/OAI|METS|DSpace|MGPP|Lucene/); ## TEMPORARY, FOR TESTING THIS SCRIPT |