Ignore:
Timestamp:
2014-09-22T20:38:05+12:00 (10 years ago)
Author:
ak19
Message:

Better debugging: if verbosity is >= 4, then mgbuilder and mgppbuilder will print the mg(pp) cmds they are going to run. Related to commits 28119, 28121 which checked for errors after executing mg(pp) cmds

File:
1 edited

Legend:

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

    r28375 r29328  
    208208    }
    209209    else {
    210     if (!-e "$mgpp_passes_exe" ||
    211         !open($handle, "| mgpp_passes$exe  -M $maxnumeric $mgpp_passes_sections -f \"$fulltextprefix\" -T1 $osextra")) {
     210    my $mgpp_passes_cmd = "mgpp_passes$exe  -M $maxnumeric $mgpp_passes_sections -f \"$fulltextprefix\" -T1 $osextra";
     211    print $outhandle "\ncmd: $mgpp_passes_cmd\n"  if ($self->{'verbosity'} >= 4);
     212    if (!-e "$mgpp_passes_exe" || !open($handle, "| $mgpp_passes_cmd")) {
    212213        print STDERR "<FatalError name='NoRunMGPasses'>\n</Stage>\n" if $self->{'gli'};
    213214        die "mgppbuilder::compress_text - couldn't run $mgpp_passes_exe\n";
     
    242243    # note: these options are left over from mg version
    243244    if (!$self->{'debug'}) {
     245    my $compdict_cmd = "mgpp_compression_dict$exe -f \"$fulltextprefix\" -S -H -2 -k 5120 $osextra";   
    244246    print $outhandle "\n    creating the compression dictionary\n"  if ($self->{'verbosity'} >= 1);
     247    print $outhandle "\ncmd: $compdict_cmd\n"  if ($self->{'verbosity'} >= 4);
    245248    print STDERR "<Phase name='CreatingCompress'/>\n" if $self->{'gli'};
    246249    if (!-e "$mgpp_compression_dict_exe") {
     
    248251        die "mgppbuilder::compress_text - couldn't run $mgpp_compression_dict_exe\n";
    249252    }
    250     my $comp_dict_status = system ("mgpp_compression_dict$exe -f \"$fulltextprefix\" -S -H -2 -k 5120 $osextra");
     253    my $comp_dict_status = system ($compdict_cmd);
    251254    if($comp_dict_status != 0) {
    252255        print $outhandle "\nmgppbuilder::compress_text - Warning: there's no compressed text\n";
     
    257260
    258261    if (!$self->{'debug'}) {
    259         if (!-e "$mgpp_passes_exe" ||
    260         !open ($handle, "| mgpp_passes$exe  -M $maxnumeric $mgpp_passes_sections -f \"$fulltextprefix\" -T2 $osextra")) {
     262        my $mgpp_passes_cmd = "mgpp_passes$exe -M $maxnumeric $mgpp_passes_sections -f \"$fulltextprefix\" -T2 $osextra";
     263        print $outhandle "\ncmd: $mgpp_passes_cmd\n"  if ($self->{'verbosity'} >= 4);
     264
     265        if (!-e "$mgpp_passes_exe" || !open ($handle, "| $mgpp_passes_cmd")) {
    261266        print STDERR "<FatalError name='NoRunMGPasses'/>\n</Stage>\n" if $self->{'gli'};
    262267        die "mgppbuilder::compress_text - couldn't run $mgpp_passes_exe\n";
     
    474479    }
    475480    else {
    476     if (!-e "$mgpp_passes_exe" ||
    477         !open($handle, "| mgpp_passes$exe -M $maxnumeric $mgpp_passes_sections -f \"$fullindexprefix\" -I1 $osextra")) {
     481        my $mgpp_passes_cmd = "mgpp_passes$exe -M $maxnumeric $mgpp_passes_sections -f \"$fullindexprefix\" -I1 $osextra";
     482        print $outhandle "\ncmd: $mgpp_passes_cmd\n"  if ($self->{'verbosity'} >= 4);
     483    if (!-e "$mgpp_passes_exe" || !open($handle, "| $mgpp_passes_cmd")) {
    478484        print STDERR "<FatalError name='NoRunMGPasses'/>\n</Stage>\n" if $self->{'gli'};
    479485        die "mgppbuilder::build_index - couldn't run $mgpp_passes_exe\n";
     
    530536       
    531537    }
    532    
    533     if (!-e "$mgpp_passes_exe" ||
    534         !open ($handle, "| mgpp_passes$exe -M $maxnumeric $mgpp_passes_sections -f \"$fullindexprefix\" -I2 $osextra")) {
     538
     539    my $mgpp_passes_cmd = "mgpp_passes$exe -M $maxnumeric $mgpp_passes_sections -f \"$fullindexprefix\" -I2 $osextra";
     540        print $outhandle "\ncmd: $mgpp_passes_cmd\n"  if ($self->{'verbosity'} >= 4);
     541    if (!-e "$mgpp_passes_exe" || !open ($handle, "| $mgpp_passes_cmd")) {
    535542        print STDERR "<FatalError name='NoRunMGPasses'/>\n</Stage>\n" if $self->{'gli'};
    536543        die "mgppbuilder::build_index - couldn't run $mgpp_passes_exe\n";
     
    581588        die "mgppbuilder::build_index - couldn't run $mgpp_invf_dict_exe\n";
    582589    }
    583     my $invdict_status = system ("mgpp_invf_dict$exe -f \"$fullindexprefix\" $osextra" );
     590        my $invdict_cmd = "mgpp_invf_dict$exe -f \"$fullindexprefix\" $osextra";
     591    print $outhandle "\ncmd: $invdict_cmd\n"  if ($self->{'verbosity'} >= 4);
     592        my $invdict_status = system ($invdict_cmd);
    584593    # check that it worked - if not, don't carry on
    585594    if ($invdict_status !=0) {
     
    600609    my $accent_folding_enabled = 1;
    601610    if ($self->{'accentfold'}) {
     611        my $accentfold_cmd = "mgpp_stem_idx$exe -b 4096 -s4 -f \"$fullindexprefix\" $osextra";
     612        print $outhandle "\ncmd: $accentfold_cmd\n"  if ($self->{'verbosity'} >= 4);
    602613        # the first time we do this, we test for accent folding enabled
    603         my $accent_status = system ("mgpp_stem_idx$exe -b 4096 -s4 -f \"$fullindexprefix\" $osextra");
     614        my $accent_status = system ($accentfold_cmd);
    604615        if ($accent_status == 2) {
    605616        # accent folding has not been enabled in mgpp
     
    614625    }
    615626    if ($self->{'casefold'}) {
    616         my $casefold_status = system ("mgpp_stem_idx$exe -b 4096 -s1 -f \"$fullindexprefix\" $osextra");
     627        my $casefold_cmd = "mgpp_stem_idx$exe -b 4096 -s1 -f \"$fullindexprefix\" $osextra";
     628        print $outhandle "\ncmd: $casefold_cmd\n"  if ($self->{'verbosity'} >= 4);
     629        my $casefold_status = system ($casefold_cmd);
    617630        if ($casefold_status != 0) {
    618631        print $outhandle "\nCase folding failed: mgpp_stem_idx exit status $casefold_status\n" if ($self->{'verbosity'} >= 4);
     
    622635       
    623636        elsif ($accent_folding_enabled && $self->{'accentfold'}) {
    624         my $status = system ("mgpp_stem_idx$exe -b 4096 -s5 -f \"$fullindexprefix\" $osextra");
     637            my $accent_casefold_cmd = "mgpp_stem_idx$exe -b 4096 -s5 -f \"$fullindexprefix\" $osextra";
     638            print $outhandle "\ncmd: $accent_casefold_cmd\n"  if ($self->{'verbosity'} >= 4);
     639        my $status = system ($accent_casefold_cmd);
    625640        if($status != 0) {
    626641            print $outhandle "\nAccent folding (with casefolding) failed: mgpp_stem_idx exit status $status\n" if ($self->{'verbosity'} >= 4);
     
    631646    }
    632647    if ($self->{'stem'}) {
    633         my $stem_status = system ("mgpp_stem_idx$exe -b 4096 -s2 -f \"$fullindexprefix\" $osextra");
     648            my $stem_cmd = "mgpp_stem_idx$exe -b 4096 -s2 -f \"$fullindexprefix\" $osextra";
     649            print $outhandle "\ncmd: $stem_cmd\n"  if ($self->{'verbosity'} >= 4);
     650        my $stem_status = system ($stem_cmd);
    634651        if ($stem_status != 0) {
    635652        print $outhandle "\nStemming failed: mgpp_stem_idx exit status $stem_status\n" if ($self->{'verbosity'} >= 4);
     
    638655        }
    639656        elsif ($accent_folding_enabled && $self->{'accentfold'}) {
    640         my $status = system ("mgpp_stem_idx$exe -b 4096 -s6 -f \"$fullindexprefix\" $osextra");
     657                my $accent_stem_cmd = "mgpp_stem_idx$exe -b 4096 -s6 -f \"$fullindexprefix\" $osextra";
     658                print $outhandle "\ncmd: $accent_stem_cmd\n"  if ($self->{'verbosity'} >= 4);
     659            my $status = system ($accent_stem_cmd);
    641660        if($status != 0) {
    642661            print $outhandle "\nAccent folding (with stemming) failed: mgpp_stem_idx exit status $status\n" if ($self->{'verbosity'} >= 4);
     
    647666    }
    648667    if ($self->{'casefold'} && $self->{'stem'}) {
    649         my $case_and_stem_status = system ("mgpp_stem_idx$exe -b 4096 -s3 -f \"$fullindexprefix\" $osextra");
     668            my $case_stem_cmd = "mgpp_stem_idx$exe -b 4096 -s3 -f \"$fullindexprefix\" $osextra";
     669            print $outhandle "\ncmd: $case_stem_cmd\n"  if ($self->{'verbosity'} >= 4);
     670        my $case_and_stem_status = system ($case_stem_cmd);
    650671        if ($case_and_stem_status != 0) {
    651672        print $outhandle "\nCasefolding and stemming failed: mgpp_stem_idx exit status $case_and_stem_status\n" if ($self->{'verbosity'} >= 4);
     
    655676        }
    656677        elsif ($accent_folding_enabled && $self->{'accentfold'}) {
    657         my $status = system ("mgpp_stem_idx$exe -b 4096 -s7 -f \"$fullindexprefix\" $osextra");
     678        my $accent_case_stem_cmd = "mgpp_stem_idx$exe -b 4096 -s7 -f \"$fullindexprefix\" $osextra";
     679                print $outhandle "\ncmd: $accent_case_stem_cmd\n"  if ($self->{'verbosity'} >= 4);
     680        my $status = system ($accent_case_stem_cmd);
    658681        if($status != 0) {
    659682            print $outhandle "\nAccent folding (with stemming and casefolding) failed: mgpp_stem_idx exit status $status\n" if ($self->{'verbosity'} >= 4);
Note: See TracChangeset for help on using the changeset viewer.