Ignore:
Timestamp:
2010-08-09T15:14:58+12:00 (14 years ago)
Author:
kjdon
Message:

at the end of import it checks for existence of archiveinf-src.gdb to see if imoprting was successful. Need to get infodbtype from collect.cfg so that we look for the right filename extension for this file, as may not always be gdb.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/bin/script/build

    r21567 r22589  
    5858use util;
    5959use cfgread;
     60use colcfg;
     61use dbutil;
    6062
    6163# set up path - this allows for paths not to be supplied to system calls
     
    6971
    7072# all the input option variables
    71 my ($optionfile, $indextype, $append, $manifest, $remove_archives, $remove_import, $buildtype, $maxdocs, @download, $collectdir, $site, $dontinstall, $save_archives, $out, $make_writable, $log_events, $event_log_file, $email_events, $mail_server, $statsfile, $event_header);
     73my ($optionfile, $indextype, $append, $manifest, $remove_archives, $remove_import, $buildtype, $infodbtype, $maxdocs, @download, $collectdir, $site, $dontinstall, $save_archives, $out, $make_writable, $log_events, $event_log_file, $email_events, $mail_server, $statsfile, $event_header);
    7274
    7375&parse_args (\@ARGV);
     
    99101
    100102my $cdir = $collectdir;
     103my $gs_mode;
    101104if (defined $site && $site =~ /\w/)
    102105{
    103106    die "GSDL3HOME not set." unless $ENV{'GSDL3HOME'};
    104107    $cdir = &util::filename_cat ($ENV{'GSDL3HOME'}, "sites", $site, "collect") unless $collectdir =~ /\w/;
     108    $gs_mode = "gs3";
    105109}
    106110else
    107111{
    108112    $cdir = &util::filename_cat ($ENV{'GSDLHOME'}, "collect") unless $collectdir =~ /\w/;
     113    $gs_mode = "gs2";
    109114}
    110115
     
    113118my $buildingdir = &util::filename_cat ($cdir, $collection, "building");
    114119my $indexdir = &util::filename_cat ($cdir, $collection, "index");
     120my $etcdir = &util::filename_cat ($cdir, $collection, "etc");
    115121my $bindir = &util::filename_cat ($ENV{'GSDLHOME'}, "bin");
    116122
     
    152158    # if we've created a build log we'll copy it to the collection's etc
    153159    # directory
    154     my ($etcdir);
     160    my ($final_etcdir);
    155161    if ($dontinstall) {
    156     $etcdir = &util::filename_cat($collectdir, "etc", "build.log");
     162    $final_etcdir = &util::filename_cat($collectdir, "etc", "build.log");
    157163    } else {
    158     $etcdir = &util::filename_cat($ENV{'GSDLHOME'}, "collect", $collection, "etc", "build.log");
     164    $final_etcdir = &util::filename_cat($ENV{'GSDLHOME'}, "collect", $collection, "etc", "build.log");
    159165    }
    160166   
    161     &util::cp($outfile, $etcdir);
     167    &util::cp($outfile, $final_etcdir);
    162168}
    163169
     
    337343    `echo $importdir ; ls $importdir `;
    338344
    339     my $archiveinf_doc_file_path = &dbutil::get_infodb_file_path("gdbm", "archiveinf-doc", $archivedir);
     345    my $col_cfg_file;
     346    if ($gs_mode eq "gs3") {
     347    $col_cfg_file = &util::filename_cat($etcdir, "collectionConfig.xml");
     348    } else {
     349    $col_cfg_file = &util::filename_cat($etcdir, "collect.cfg");
     350    }
     351
     352    my $collect_cfg = &colcfg::read_collection_cfg ($col_cfg_file, $gs_mode);
     353    # get the database type for this collection from its configuration file (may be undefined)
     354    $infodbtype = $collect_cfg->{'infodbtype'} || &dbutil::get_default_infodb_type();
     355
     356    my $archiveinf_doc_file_path = &dbutil::get_infodb_file_path($infodbtype, "archiveinf-doc", $archivedir);
    340357    if (-e $archiveinf_doc_file_path) {
    341358    if (&has_content ($importdir)) {
     
    463480    &append_file ($out, "$outfile.import");
    464481
    465     my $archiveinf_doc_file_path = &dbutil::get_infodb_file_path("gdbm", "archiveinf-doc", $archivedir);
     482    my $archiveinf_doc_file_path = &dbutil::get_infodb_file_path($infodbtype, "archiveinf-doc", $archivedir);
     483
    466484    if (-e $archiveinf_doc_file_path) {
    467485    print $out "$collection collection imported successfully\n\n";
     
    471489    }
    472490    } else {
     491    print $out "$archiveinf_doc_file_path not found. archives contents:\n";
    473492    print $out `ls $archivedir`;
    474493
Note: See TracChangeset for help on using the changeset viewer.