Changeset 14111


Ignore:
Timestamp:
05/30/07 17:53:17 (14 years ago)
Author:
sjboddie
Message:

Added support for additional collection customisation code to be put in
collect/COLLECTION/custom/COLLECTION. buildcol.pl and import.pl were
modified to look in the new location first for a collect.cfg file.

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

Legend:

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

    r14028 r14111  
    347347    unshift (@INC, "$ENV{'GSDLCOLLECTDIR'}/perllib/plugins");
    348348
    349     # read the configuration file (for gs2)
    350     $configfilename = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "etc", "collect.cfg");
     349    # Read in the collection configuration file.
    351350    my ($collectcfg, $buildtype);
    352 
    353     if (-e $configfilename) {
    354       $collectcfg = &colcfg::read_collect_cfg ($configfilename);
    355       $gs_mode = "gs2"; 
    356     }
    357     else {
    358 
    359       # If it is gs3
    360       $configfilename = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "etc", "collectionConfig.xml");
    361 
    362       if (!-e $configfilename) {
    363     &gsprintf($out, "{common.cannot_find_cfg_file}\n", $configfilename) && die;
    364       }
    365       else {
     351    ($configfilename, $gs_mode) = &colcfg::get_collect_cfg_name($out);
     352    if ($gs_mode eq "gs2") {
     353        $collectcfg = &colcfg::read_collect_cfg ($configfilename);
     354    } elsif ($gs_mode eq "gs3") {
    366355    $collectcfg = &colcfg::read_collection_cfg_xml ($configfilename);
    367     $gs_mode = "gs3";
    368       }
    369     }
    370    
     356    }
     357
    371358    if ($verbosity !~ /\d+/) {
    372359    if (defined $collectcfg->{'verbosity'} && $collectcfg->{'verbosity'} =~ /\d+/) {
     
    530517    # if a builder class has been created for this collection, use it
    531518    # otherwise, use the mg or mgpp builder
    532     if (-e "$ENV{'GSDLCOLLECTDIR'}/perllib/${collection}builder.pm") {
     519    if (-e "$ENV{'GSDLCOLLECTDIR'}/custom/${collection}/perllib/custombuilder.pm") {
     520    $builderdir = "$ENV{'GSDLCOLLECTDIR'}/custom/${collection}/perllib";
     521    $buildertype = "custombuilder";
     522    } elsif (-e "$ENV{'GSDLCOLLECTDIR'}/perllib/custombuilder.pm") {
     523    $builderdir = "$ENV{'GSDLCOLLECTDIR'}/perllib";
     524    $buildertype = "custombuilder";
     525    } elsif (-e "$ENV{'GSDLCOLLECTDIR'}/perllib/${collection}builder.pm") {
    533526    $builderdir = "$ENV{'GSDLCOLLECTDIR'}/perllib";
    534527    $buildertype = "${collection}builder";
  • trunk/gsdl/bin/script/import.pl

    r14031 r14111  
    242242    $removeold, $saveas, $version,
    243243    $gzip, $groupsize, $OIDtype, $OIDmetadata, $debug,
    244     $maxdocs, $collection, $configfilename, $collectcfg,
     244    $maxdocs, $collection, $configfilename, $collectcfg, $gs_mode,
    245245    $pluginfo, $sortmeta, $removeprefix, $removesuffix,
    246246    $archive_info_filename, $statsfile,
     
    323323    $faillog->autoflush(1);
    324324   
    325     # check that there is a collect.cfg file, i.e. it is gs2.
    326     $configfilename = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "etc", "collect.cfg");
    327     if (-e $configfilename) {
    328       $collectcfg = &colcfg::read_collect_cfg ($configfilename);
    329 
    330     } else {
    331       # check that there is a collectionConfig.xml file, i.e. it is gs3.
    332       $configfilename = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "etc", "collectionConfig.xml");
    333       if (!-e $configfilename) {
    334     (&gsprintf($out, "{common.cannot_find_cfg_file}\n", $configfilename) && die);
    335       } else {
     325    # Read in the collection configuration file.
     326    ($configfilename, $gs_mode) = &colcfg::get_collect_cfg_name($out);
     327    if ($gs_mode eq "gs2") {
     328        $collectcfg = &colcfg::read_collect_cfg ($configfilename);
     329    } elsif ($gs_mode eq "gs3") {
    336330    $collectcfg = &colcfg::read_collection_cfg_xml ($configfilename);
    337       }
    338331    }
    339332
Note: See TracChangeset for help on using the changeset viewer.