Changeset 14199


Ignore:
Timestamp:
2007-06-29T12:41:53+12:00 (17 years ago)
Author:
xiao
Message:

et the $buildcfg->{'disable_OAI'} argument in the sub make_auxiliary_files(), whcih is passed from buildcol.pl.

File:
1 edited

Legend:

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

    r14112 r14199  
    2626package basebuilder;
    2727
    28 use strict;
    29 no strict 'refs'; # allow filehandles to be variables and viceversa
    30 
    3128use classify;
    3229use cfgread;
     
    5754    $maxdocs, $debug, $keepold, $incremental, $incremental_dlc,
    5855    $remove_empty_classifications,
    59     $outhandle, $no_text, $failhandle, $gli) = @_;
    60 
    61     $outhandle = *STDERR unless defined $outhandle;
     56    $outhandle, $no_text, $failhandle, $gli, $disable_OAI) = @_;
     57
     58    $outhandle = STDERR unless defined $outhandle;
    6259    $no_text = 0 unless defined $no_text;
    63     $failhandle = *STDERR unless defined $failhandle;
     60    $failhandle = STDERR unless defined $failhandle;
    6461
    6562    # create a builder object
     
    7875              'failhandle'=>$failhandle,
    7976              'notbuilt'=>{},    # indexes not built
    80               'gli'=>$gli
     77              'gli'=>$gli,
     78              'disable_OAI'=>$disable_OAI
    8179              }, $class;
    8280
    8381    $self->{'gli'} = 0 unless defined $self->{'gli'};
    84 
    85     # Read in the collection configuration file.
    86     my ($colcfgname);
    87     ($colcfgname, $gs_mode) = &colcfg::get_collect_cfg_name($outhandle);
    88     if ($gs_mode eq "gs2") {
    89         $self->{'collect_cfg'} = &colcfg::read_collect_cfg ($colcfgname);
    90     } elsif ($gs_mode eq "gs3") {
    91     $self->{'collect_cfg'} = &colcfg::read_collection_cfg_xml ($colcfgname);
     82    $self->{'disable_OAI'} = 0 unless defined $self->{'disable_OAI'};
     83   
     84    # read in the collection configuration file
     85    my $colcfgname = "$ENV{'GSDLCOLLECTDIR'}/etc/collect.cfg";
     86    if (-e $colcfgname) {
     87      ##$self->{'collect_cfg'} = &colcfg::read_collection_cfg_xml ($colcfgname);
     88      $self->{'collect_cfg'} = &colcfg::read_collect_cfg ($colcfgname);
     89      $gs_mode = "gs2";
     90    }
     91    else {
     92      my $colcfgname = "$ENV{'GSDLCOLLECTDIR'}/etc/collectionConfig.xml";
     93      if (!-e $colcfgname) {
     94    die "mgbuilder::new - couldn't find collectionConfig.xml for collection $collection\n";
     95      }
     96      else {
     97    #$self->{'collect_cfg'} = &colcfg::read_collect_cfg ($colcfgname);
     98        $self->{'collect_cfg'} = &colcfg::read_collection_cfg_xml ($colcfgname);
     99    $gs_mode = "gs3";
     100      }
    92101    }
    93102   
     
    187196    my ($buildprocdir, $buildproctype);
    188197    my $collection = $self->{'collection'};
    189     if (-e "$ENV{'GSDLCOLLECTDIR'}/custom/${collection}/perllib/custombuildproc.pm") {
    190     $buildprocdir = "$ENV{'GSDLCOLLECTDIR'}/custom/${collection}/perllib";
    191     $buildproctype = "custombuildproc";
    192     } elsif (-e "$ENV{'GSDLCOLLECTDIR'}/perllib/custombuildproc.pm") {
    193     $buildprocdir = "$ENV{'GSDLCOLLECTDIR'}/perllib";
    194     $buildproctype = "custombuildproc";
    195     } elsif (-e "$ENV{'GSDLCOLLECTDIR'}/perllib/${collection}buildproc.pm") {
     198    if (-e "$ENV{'GSDLCOLLECTDIR'}/perllib/${collection}buildproc.pm") {
    196199    $buildprocdir = "$ENV{'GSDLCOLLECTDIR'}/perllib";
    197200    $buildproctype = "${collection}buildproc";
     
    237240    $self->{'maxnumeric'} = $maxnumeric;
    238241}
     242# It seems we don't need this sub
     243#sub set_disable_OAI {
     244#    my $disable_OAI = shift (@_);
     245#    my ($disable_OAI = @_;
     246#
     247#    $self->{'disable_OAI'} = $disable_OAI;
     248#}
    239249sub set_strip_html {
    240250    my $self = shift (@_);
     
    269279    # and their directory names (includes subcolls and langs)
    270280    $self->{'index_mapping'} = $self->create_index_mapping ($indexes);
    271    
     281
     282    my $indexmap = $self->{'index_mapping'}->{'indexmap'};
     283
    272284    # build each of the indexes
    273285    foreach my $index (@$indexes) {
     
    339351    my ($handle);
    340352    if ($self->{'debug'}) {
    341     $handle = *STDOUT;
     353    $handle = STDOUT;
    342354    } else {
    343355    if (!-e "$txt2db_exe" || !open (PIPEOUT, "| txt2db$exe \"$fulldbname\"")) {
     
    345357        die "builder::make_infodatabase - couldn't run $txt2db_exe\n";
    346358    }
    347     $handle = *PIPEOUT;
     359    $handle = basebuilder::PIPEOUT;
    348360    }
    349361   
     
    427439    $build_cfg->{'numsections'} = $self->{'buildproc'}->get_num_sections();
    428440    $build_cfg->{'numbytes'} = $self->{'buildproc'}->get_num_bytes();
    429    
     441
     442    # store whether to disable OAI service
     443    $build_cfg->{'disable_OAI'} = $self->{'disable_OAI'};
     444       
    430445    # store the mapping between the index names and the directory names
    431446    # the index map is used to determine what indexes there are, so any that are not built should not be put into the map.
     
    463478
    464479    if ($gs_mode eq "gs2") {
    465       &colcfg::write_build_cfg("$self->{'build_dir'}/build.cfg", $build_cfg);
     480      &colcfg::write_build_cfg_xml("$self->{'build_dir'}/buildConfig.xml", $build_cfg, $self->{'collect_cfg'});
     481      ##&colcfg::write_build_cfg("$self->{'build_dir'}/build.cfg", $build_cfg);
    466482    }
    467483    if ($gs_mode eq "gs3") {
     484      ##&colcfg::write_build_cfg("$self->{'build_dir'}/build.cfg", $build_cfg);
    468485      &colcfg::write_build_cfg_xml("$self->{'build_dir'}/buildConfig.xml", $build_cfg, $self->{'collect_cfg'});
    469486    }   
Note: See TracChangeset for help on using the changeset viewer.