Ignore:
Timestamp:
09/06/13 22:03:08 (7 years ago)
Author:
ak19
Message:

Modifications to handle placeholders for Greenstone standard path prefixes when the suffix of such a path is of the form of a Windows shortfilename. This occurs in archiveinf-doc.gdb on Windows, and possibly archiveinf-src.gdb too. Need to first reconstruct the full path locally (without placeholder), then convert it to a windows long filename, then stick the placeholder back into its place and do the diff between the test and model databases.

Location:
other-projects/nightly-tasks/diffcol/trunk/diffcol
Files:
2 edited

Legend:

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

    r28172 r28238  
    293293    my $strModelGdb =  &FileUtils::filenameConcatenate($strModelCol,"index","text","$strColName.gdb");
    294294    my $strTestGdb =  &FileUtils::filenameConcatenate($strTestCol,"index","text","$strColName.gdb");   
    295     my $strGdbError = &GdbDiff($strModelGdb,$strTestGdb,$strOutputFormat,$intLevel,$strColName); # returns 0 if no error
     295    my $strGdbError = &GdbDiff($strModelGdb,$strTestGdb,$strOutputFormat,$intLevel,$strColName,$strTestCol,$strModelCol); # returns 0 if no error
    296296    if($strGdbError) {
    297297        push(@Errors,$strGdbError);
     
    301301    $strModelGdb =  &FileUtils::filenameConcatenate($strModelCol,"archives","archiveinf-doc.gdb");
    302302    $strTestGdb =  &FileUtils::filenameConcatenate($strTestCol,"archives","archiveinf-doc.gdb");   
    303     $strGdbError = &GdbDiff($strModelGdb,$strTestGdb,$strOutputFormat,$intLevel,$strColName);
     303    $strGdbError = &GdbDiff($strModelGdb,$strTestGdb,$strOutputFormat,$intLevel,$strColName,$strTestCol,$strModelCol);
    304304    if($strGdbError) {
    305305        push(@Errors,$strGdbError);
     
    308308    $strModelGdb =  &FileUtils::filenameConcatenate($strModelCol,"archives","archiveinf-src.gdb");
    309309        $strTestGdb =  &FileUtils::filenameConcatenate($strTestCol,"archives","archiveinf-src.gdb");
    310         $strGdbError = &GdbDiff($strModelGdb,$strTestGdb,$strOutputFormat,$intLevel,$strColName);
     310        $strGdbError = &GdbDiff($strModelGdb,$strTestGdb,$strOutputFormat,$intLevel,$strColName,$strTestCol,$strModelCol);
    311311        if($strGdbError) {
    312312            push(@Errors,$strGdbError);
     
    322322sub GdbDiff
    323323{
    324     my ($strModelGdb,$strTestGdb,$strOutputFormat,$intLevel,$strColName) = @_;
     324    my ($strModelGdb,$strTestGdb,$strOutputFormat,$intLevel,$strColName,$strTestCol,$strModelCol) = @_;
    325325
    326326    my $strGdbError = 0;
     
    329329    {
    330330    #my $strGdbError = gdbdiff::test_gdb($strModelGdb, $strTestGdb);
    331     $strGdbError = gdbdiff::test_gdb($strModelGdb, $strTestGdb, $strColName,$gv_test_os, $gv_model_os);
     331    $strGdbError = gdbdiff::test_gdb($strModelGdb, $strTestGdb, $strColName,$gv_test_os, $gv_model_os,$strTestCol,$strModelCol);
    332332    if($strGdbError ne "")
    333333    {
  • other-projects/nightly-tasks/diffcol/trunk/diffcol/gdbdiff.pm

    r28224 r28238  
    4646sub test_gdb
    4747{
    48     my ($full_modeldb, $full_testdb, $strColName, $test_os, $model_os) = @_;
     48    my ($full_modeldb, $full_testdb, $strColName, $test_os, $model_os, $strTestCol, $strModelCol) = @_;
    4949
    5050   # print "Now is testing database\n";
     
    105105   
    106106        my ($win_text, $lin_text); # references
     107        my $collection_path = $strTestCol; # full path to a windows collection
     108       
    107109        if($testIsWin) {
     110            $collection_path = $strTestCol; # test collection path is windows
    108111            $win_text = \$test_text;
    109112            $lin_text = \$model_text;
    110113        } else {
     114            $collection_path = $strModelCol; # model collection path is windows
    111115            $win_text = \$model_text;
    112116            $lin_text = \$test_text;
     
    114118       
    115119        if($dbname =~ m/archiveinf-doc/) {
     120           
     121            (my $collection_path_re = $collection_path) =~ s@\\@\\\\@g;
     122           
    116123            my $tmp = ""; # rebuild windows file's set of lines after processing them one by one
    117124   
     
    122129                # assoc-file and meta-file contain filepaths, ensure these are long windows file paths now (will later convert to linux slashes)   
    123130                if($line =~ m@^<(assoc-file|meta-file|src-file)>(.*)(\s+)@s) {
     131                    my ($field, $value, $suffix) = ($1, $2, $3);
     132                    $line = $value; # it may be a short file name   
    124133                   
    125                     if($2 !~ m/^\@/) { # if the path doesn't use a "relative" @GSPATH@ placeholder string, but is an absolute path instead
    126                         $line = $2; # it may be a short file name
    127                         # perhaps test here if it is a shortfilename? should match /CAPS....~number(.ext)/
    128                        
    129                         $line = "<$1>".&Win32::GetLongPathName($line)."$3"; # make it a long file name and prefix assoc-file/meta-file tagname to it again                 
     134                    if($line !~ m/^\@/) { # if the path doesn't use a "relative" @GSPATH@ placeholder string, but is an absolute path instead                       
     135                        # perhaps test here if it is a shortfilename? should match /CAPS....~number(.ext)/                     
     136                        $line = "<$field>".&Win32::GetLongPathName($line)."$suffix"; # make it a long file name and prefix assoc-file/meta-file tagname to it again                 
     137                    }
     138                    else { # if $line contains @THISCOLLECTIONPATH@, still need to deal with DOS filenames suffixes:
     139                        # replace placeholder with absolute path and expand to long filename, then insert placeholder in its original place again                       
     140                        $line =~ s/\@THISCOLLECTPATH\@/$collection_path/;
     141                        $line = &Win32::GetLongPathName($line);
     142                        $line =~ s/^$collection_path_re/\@THISCOLLECTPATH\@/;
     143                        $line = "<$field>".$line."$suffix";
    130144                    }
    131145                }
Note: See TracChangeset for help on using the changeset viewer.