Changeset 22431

Show
Ignore:
Timestamp:
19.07.2010 13:59:55 (10 years ago)
Author:
davidb
Message:

Correction to caching technique to work with input file rather than output file in terms of working out when the cached file needs to be regenerated

Location:
main/trunk/greenstone2/perllib
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/convertutil.pm

    r22350 r22431  
    119119    $monitor_deinit = "monitor_deinit"; 
    120120    } 
     121 
     122   my ($cpackage,$cfilename,$cline,$csubr,$chas_args,$cwantarray) = caller(4); 
     123   print STDERR "Calling method; $cfilename:$cline $cpackage->$csubr:$cline\n"; 
    121124 
    122125    print $outhandle "$message_prefix: $command\n" if ($verbosity > 3); 
     
    213216sub regenerate_general_cmd 
    214217{ 
    215     my ($command,$ofilename,$options) = @_; 
     218    my ($command,$ifilename,$ofilename,$options) = @_; 
    216219 
    217220    my $regenerated = 1; 
     
    256259sub run_cached_general_cmd 
    257260{ 
    258     my ($command,$ofilename,$options) = @_; 
     261    my ($command,$ifilename,$ofilename,$options) = @_; 
    259262 
    260263    my $outhandle = $options->{'outhandle'}; 
     
    270273    if ((!-e $ofilename) || (!-e $args_filename)) { 
    271274    ($regenerated,$result,$had_error)  
    272         = regenerate_general_cmd($command,$ofilename,$options); 
    273     } 
    274     elsif (-M $ofilename < -M $args_filename) { 
     275        = regenerate_general_cmd($command,$ifilename,$ofilename,$options); 
     276    } 
     277    elsif (-M $ifilename < -M $args_filename) { 
    275278    # Source files has been updated/changed in some way 
    276279    # => regenerate 
    277     print $outhandle "$ofilename modified more recently than cached version\n"; 
     280    print $outhandle "$ifilename modified more recently than cached version\n"; 
    278281 
    279282    ($regenerated,$result,$had_error)  
    280         = regenerate_general_cmd($command,$ofilename,$options);  
     283        = regenerate_general_cmd($command,$ifilename,$ofilename,$options); 
    281284    } 
    282285    else { 
     
    294297            # need to rerun command 
    295298            ($regenerated,$result,$had_error)  
    296             = regenerate_general_cmd($command,$ofilename,$options); 
     299            = regenerate_general_cmd($command,$ifilename,$ofilename,$options); 
    297300        } 
    298301        else { 
     
    328331        print $outhandle "  $message_prefix: No cached previous args found.  Regenerating $ofilename\n"; 
    329332 
    330         ($regenerated,$result,$had_error) = regenerate_general_cmd($command,$ofilename,$options); 
     333        ($regenerated,$result,$had_error)  
     334        = regenerate_general_cmd($command,$ifilename,$ofilename,$options); 
    331335    } 
    332336    } 
  • main/trunk/greenstone2/perllib/plugins/BaseMediaConverter.pm

    r22351 r22431  
    153153{ 
    154154    my $self = shift @_; 
    155     my ($command,$ofilename,$print_info) = @_; 
     155    my ($command,$ifilename,$ofilename,$print_info) = @_; 
    156156 
    157157    if (!defined $print_info->{'verbosity'}) { 
     
    172172    my $self = shift @_; 
    173173 
    174     my ($command,$ofilename,$print_info) = @_; 
     174    my ($command,$ifilename,$ofilename,$print_info) = @_; 
    175175 
    176176    return $self->run_general_cmd($command,$print_info); 
     
    183183    my $self = shift @_; 
    184184 
    185     my ($command,$ofilename,$print_info) = @_; 
     185    my ($command,$ifilename,$ofilename,$print_info) = @_; 
    186186 
    187187    if (!defined $print_info->{'verbosity'}) { 
     
    202202    my $self = shift @_; 
    203203 
    204     my ($command,$ofilename,$print_info) = @_; 
     204    my ($command,$ifilename,$ofilename,$print_info) = @_; 
    205205 
    206206    my $result; 
     
    210210    if ($self->{'enable_cache'}) { 
    211211    ($regenerated,$result,$had_error) 
    212         = $self->run_cached_general_cmd($command,$ofilename,$print_info); 
     212        = $self->run_cached_general_cmd($command,$ifilename,$ofilename,$print_info); 
    213213    } 
    214214    else {