Changeset 1252


Ignore:
Timestamp:
2000-06-29T11:28:17+12:00 (24 years ago)
Author:
sjboddie
Message:

Building code now extracts a couple more statistics from mg and inserts
them in the build.cfg file (i.e. number of sections and number of words
in collection).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/mgbuilder.pm

    r1251 r1252  
    654654    $build_cfg->{'numbytes'} = $self->{'buildproc'}->get_num_bytes();
    655655
     656    # get additional stats from mg
     657    my $exedir = "$ENV{'GSDLHOME'}/bin/$ENV{'GSDLOS'}";
     658    my $exe = &util::get_os_exe ();
     659    my $mgstat_exe = &util::filename_cat($exedir, "mgstat$exe");
     660    my $input_file = &util::filename_cat ("text", $self->{'collection'});
     661    if (!-e "$mgstat_exe" || !open (PIPEIN, "$mgstat_exe -d $self->{'build_dir'} -f $input_file |")) {
     662    print STDERR "Warning: Couldn't open pipe to $mgstat_exe to get additional stats\n";
     663    } else {
     664    my $line = "";
     665    while (defined ($line = <PIPEIN>)) {
     666        if ($line =~ /^Words in collection \[dict\]\s+:\s+(\d+)/) {
     667        ($build_cfg->{'numwords'}) = $1;
     668        } elsif ($line =~ /^Documents\s+:\s+(\d+)/) {
     669        ($build_cfg->{'numsections'}) = $1;
     670        }
     671    }
     672    close PIPEIN;
     673    }
     674
    656675    # store the mapping between the index names and the directory names
    657676    my @indexmap = ();
     
    679698    # write out the build information
    680699    &cfgread::write_cfg_file("$self->{'build_dir'}/build.cfg", $build_cfg,
    681                  '^(builddate|numdocs|numbytes)$',
     700                 '^(builddate|numdocs|numbytes|numwords|numsections)$',
    682701                             '^(indexmap|subcollectionmap|languagemap|notbuilt)$');
    683702
Note: See TracChangeset for help on using the changeset viewer.