Ignore:
Timestamp:
2013-09-06T22:03:08+12:00 (11 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.