Changeset 19743


Ignore:
Timestamp:
2009-06-05T10:51:46+12:00 (12 years ago)
Author:
davidb
Message:

incremental-buildcol.pl now looks for change of indexer between last and current build. Switches to full build if needed.

File:
1 edited

Legend:

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

    r19620 r19743  
    3939
    4040use strict;
     41no strict 'refs'; # allow filehandles to be variables and vice versa
     42no strict 'subs'; # allow barewords (eg STDERR) as function arguments
    4143
    4244use util;
    43 
     45use colcfg;
    4446
    4547sub main
     
    6163    my $collect = pop @argv;
    6264
    63 
    6465    my @filtered_argv = ();
    6566
    6667    my $collect_dir = undef;
    6768    my $build_dir  = undef;
     69    my $site = undef;
    6870
    6971    while (my $arg = shift @argv) {
     
    7577        $build_dir = shift @argv;
    7678        push(@filtered_argv,$arg,$build_dir);
     79    }
     80    elsif ($arg eq "-site") {
     81        $site = shift @argv;
     82        push(@filtered_argv,$arg,$site);
    7783    }
    7884    else {
     
    114120
    115121    if (-e $build_cfg_filename) {
    116     $buildcol_cmd .= " -incremental";
     122
     123    # figure out if there has been a change of indexer
     124    # (e.g. collect.cfg now says lucene, but build.cfg says mgpp)
     125
     126    if ((&colcfg::use_collection($site, $collect, $collect_dir)) eq "") {
     127        print STDERR "Unable to use collection \"$collect\" within \"$collect_dir\"\n";
     128        exit -1;
     129    }
     130    # Read in the collection configuration file.
     131    my ($collect_cfg_filename, $gs_mode) = &colcfg::get_collect_cfg_name(STDERR);
     132    my $collectcfg = &colcfg::read_collection_cfg ($collect_cfg_filename,$gs_mode);
     133
     134    my $buildcfg = &colcfg::read_build_cfg ($build_cfg_filename);
     135
     136    if ($buildcfg->{'buildtype'} ne $collectcfg->{'buildtype'}) {
     137        print STDERR "*****\n";
     138        print STDERR "* Change of indexer detected. Switching to full buildcol.pl.\n";
     139        print STDERR "*****\n";
     140        $buildcol_cmd .= " -removeold";
     141    }
     142    else {
     143
     144        $buildcol_cmd .= " -incremental";
     145    }
    117146    }
    118147    else {
    119 ### print STDERR "$build_cfg_filename does not exist.\n";
     148    # build.cfg doesn't exit
    120149    print STDERR "*****\n";
    121150    print STDERR "* First time built. Switching to full buildcol.pl.\n";
Note: See TracChangeset for help on using the changeset viewer.