Ignore:
Timestamp:
2013-11-20T17:34:45+13:00 (10 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/diffcol
Files:
2 edited

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
Note: See TracChangeset for help on using the changeset viewer.