Changeset 783


Ignore:
Timestamp:
1999-11-15T17:52:11+13:00 (24 years ago)
Author:
sjboddie
Message:

removed gettext.pl - added debug, mode and index options to buildcol.pl,
added debug option to import.pl

Location:
trunk/gsdl/bin/script
Files:
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/bin/script/buildcol.pl

    r632 r783  
    4747    print STDERR "   -builddir directory   Where to put the built indexes\n";
    4848    print STDERR "   -maxdocs number       Maximum number of documents to build\n";
     49    print STDERR "   -debug                print output to STDOUT\n";
     50    print STDERR "   -mode all|compress_text|build_index|infodb\n";
     51    print STDERR "   -index indexname      index to build (will build all in config file if not set)\n";
    4952    print STDERR "   -allclassifications   Don't remove empty classifications\n\n";
    5053}
     
    5356sub main
    5457{
     58    my ($verbosity, $archivedir, $cachedir, $builddir, $maxdocs,
     59    $debug, $mode, $indexname, $allclassifications);
    5560    if (!parsargv::parse(\@ARGV,
    5661             'verbosity/\d+/2', \$verbosity,
     
    5964             'builddir/.*/', \$builddir,
    6065             'maxdocs/\d+/', \$maxdocs,
     66             'debug', \$debug,
     67             'mode/^(all|compress_text|build_index|infodb)$/all', \$mode,
     68             'index/.*/', \$indexname,
    6169             'allclassifications', \$allclassifications)) {
    6270    &print_usage();
     
    6977    die "\n";
    7078    }
    71 
    72     # only here to prevent a perl warning
    73     $maxdocs = "" if $maxdocs !~ /\d/;
    74     $allclassifications = 0 unless $allclassifications == 1;
    7579
    7680    # read the configuration file
     
    141145    eval("\$builder = new $buildertype(\$collection, " .
    142146     "\$realarchivedir, \$realbuilddir, \$verbosity, " .
    143      "\$maxdocs, \$allclassifications)");
     147     "\$maxdocs, \$debug, \$allclassifications)");
    144148    die "$@" if $@;
    145149
    146150    $builder->init();
    147     $builder->compress_text($textindex);
    148     $builder->build_indexes();
    149     $builder->make_infodatabase();
    150     $builder->collect_specific();
    151     $builder->make_auxiliary_files();
     151
     152    if ($mode =~ /^all$/i) {
     153    $builder->compress_text($textindex);
     154    $builder->build_indexes($indexname);
     155    $builder->make_infodatabase();
     156    $builder->collect_specific();
     157    } elsif ($mode =~ /^compress_text$/i) {
     158    $builder->compress_text($textindex);
     159    } elsif ($mode =~ /^build_index$/i) {
     160    $builder->build_indexes($indexname);   
     161    } elsif ($mode =~ /^infodb$/i) {
     162    $builder->make_infodatabase();
     163    } else {
     164    die "unknown mode: $mode\n";
     165    }
     166
     167    $builder->make_auxiliary_files() if !$debug;
    152168    $builder->deinit();
    153 
    154 
    155     if ($realbuilddir ne $builddir) {
     169   
     170    if (($realbuilddir ne $builddir) && !$debug) {
    156171    print STDERR "Copying back the cached build\n" if ($verbosity >= 1);
    157172    &util::rm_r ($builddir);
  • trunk/gsdl/bin/script/import.pl

    r538 r783  
    4040use plugin;
    4141use docsave;
     42use docprint;
    4243use util;
    4344use parsargv;
     
    5455    print STDERR "                          directory -- use with care\n";
    5556    print STDERR "   -gzip                  Use gzip to compress resulting gml documents\n";
     57    print STDERR "   -debug                 Print imported text to STDOUT\n";
    5658    print STDERR "   -maxdocs number        Maximum number of documents to import\n\n";
    5759}
     
    6163
    6264sub main {
     65    my ($verbosity, $importdir, $archivedir, $keepold,
     66    $removeold, $gzip, $debug, $maxdocs);
    6367    if (!parsargv::parse(\@ARGV,
    6468             'verbosity/\d+/2', \$verbosity,
     
    6872             'removeold', \$removeold,
    6973             'gzip', \$gzip,
     74             'debug', \$debug,
    7075             'maxdocs/\d+/', \$maxdocs)) {
    7176    &print_usage();
     
    133138
    134139    # read the archive information file
    135     $archive_info_filename = &util::filename_cat ($archivedir, "archives.inf");
    136     $archive_info = new arcinfo ();
    137     $archive_info->load_info ($archive_info_filename);
     140    if (!$debug) {
     141    $archive_info_filename = &util::filename_cat ($archivedir, "archives.inf");
     142    $archive_info = new arcinfo ();
     143    $archive_info->load_info ($archive_info_filename);
    138144
    139     # create a docsave object to process the documents
    140     $processor = new docsave ($collection, $archive_info, $verbosity, $gzip);
    141     $processor->setarchivedir ($archivedir);
     145    # create a docsave object to process the documents
     146    $processor = new docsave ($collection, $archive_info, $verbosity, $gzip);
     147    $processor->setarchivedir ($archivedir);
     148    } else {
     149    $processor = new docprint ();
     150    }
    142151
    143152    # process the import directory
     
    146155   
    147156    # write out the archive information file
    148     $archive_info->save_info($archive_info_filename);
     157    if (!$debug) {
     158    $archive_info->save_info($archive_info_filename);
     159    }
    149160}
Note: See TracChangeset for help on using the changeset viewer.