Ignore:
Timestamp:
2010-07-19T13:59:55+12:00 (11 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

File:
1 edited

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