Changeset 1853


Ignore:
Timestamp:
2001-01-22T15:37:46+13:00 (23 years ago)
Author:
kjm18
Message:

adapted to work with both mg and mgpp building. THe default is to use mg.
You can select mgpp in the collect.cfg ("buildtype mgpp") or pass it as
an option ("-buildtype mgpp").

File:
1 edited

Legend:

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

    r1761 r1853  
    6464    &util::filename_cat ($ENV{'GSDLHOME'}, "collect") . ")\n";
    6565    print STDERR "   -out                  Filename or handle to print output status to.\n";
    66     print STDERR "                         The default is STDERR\n\n";
     66    print STDERR "                         The default is STDERR\n";
     67    print STDERR "   -buildtype mg|mgpp    THis will override the config file setting. (default is mg)\n";
     68    print STDERR "   -no_strip_html        Do not strip the html tags from the indexed text (only used for mgpp collections).\n\n";
    6769}
    6870
     
    7274    my ($verbosity, $archivedir, $cachedir, $builddir, $maxdocs,
    7375    $debug, $mode, $indexname, $keepold, $allclassifications,
    74     $create_images, $collectdir, $out);
     76    $create_images, $collectdir, $out, $buildtype, $textindex,
     77    $no_strip_html);
    7578    if (!parsargv::parse(\@ARGV,
    7679             'verbosity/\d+/2', \$verbosity,
     
    8689             'create_images', \$create_images,
    8790             'collectdir/.*/', \$collectdir,
    88              'out/.*/STDERR', \$out)) {
     91             'out/.*/STDERR', \$out,
     92             'no_strip_html', \$no_strip_html,
     93             'buildtype/^(mg|mgpp)$/', \$buildtype)) {
    8994    &print_usage();
    9095    die "\n";
    9196    }
    9297
     98    $textindex = "";
    9399    my $close_out = 0;
    94100    if ($out !~ /^(STDERR|STDOUT)$/i) {
     
    106112
    107113    # read the configuration file
    108     $textindex = "section:text";
     114
    109115    $configfilename = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "etc", "collect.cfg");
    110116    if (-e $configfilename) {
    111117    $collectcfg = &colcfg::read_collect_cfg ($configfilename);
     118
     119    if (defined $collectcfg->{'buildtype'} && $buildtype eq "") {
     120        $buildtype = $collectcfg->{'buildtype'};
     121    }
     122    if ($buildtype eq "") {
     123        $buildtype = "mg"; # mg is the default
     124    }
    112125    if (defined $collectcfg->{'archivedir'} && $archivedir eq "") {
    113126        $archivedir = $collectcfg->{'archivedir'};
     
    119132        $builddir = $collectcfg->{'builddir'};
    120133    }
     134    if ($buildtype eq "mgpp" && defined $collectcfg->{'textcompress'}) {
     135        $textindex = $collectcfg->{'textcompress'};
     136    }
     137   
    121138    } else {
    122139    die "Couldn't find the configuration file $configfilename\n";
    123140    }
    124141   
     142    #mgpp doesn't work yet on windows
     143    if ($buildtype eq "mgpp" && $ENV{'GSDLOS'} =~ /^windows$/) {
     144    die "mgpp doesn't work on windows\n";
     145    }
     146   
     147    #set the text index
     148    if ($buildtype eq "mgpp") {
     149    if ($textindex eq "") {
     150        $textindex = "text";
     151    }
     152    }
     153    else {
     154    $textindex = "section:text";
     155    }
     156
    125157    # create default images if required
    126158    if ($create_images) {
     
    165197
    166198    # if a builder class has been created for this collection, use it
    167     # otherwise, use the mg builder
     199    # otherwise, use the mg or mgpp builder
    168200    if (-e "$ENV{'GSDLCOLLECTDIR'}/perllib/${collection}builder.pm") {
    169201    $builderdir = "$ENV{'GSDLCOLLECTDIR'}/perllib";
     
    171203    } else {
    172204    $builderdir = "$ENV{'GSDLHOME'}/perllib";
    173     $buildertype = "mgbuilder";
     205    if ($buildtype eq "mgpp") {
     206        $buildertype = "mgppbuilder";
     207    }
     208    else {
     209        $buildertype = "mgbuilder";
     210    }
    174211    }
    175212   
     
    183220    $builder->init();
    184221
     222    if ($buildertype eq "mgppbuilder" && $no_strip_html) {
     223    $builder->set_strip_html(0);
     224    }
    185225    if ($mode =~ /^all$/i) {
    186226    $builder->compress_text($textindex);
     
    261301    close CFGFILE;
    262302}
     303
Note: See TracChangeset for help on using the changeset viewer.