Changeset 14925


Ignore:
Timestamp:
2007-12-19T15:03:24+13:00 (16 years ago)
Author:
dmn
Message:

davidbs changes to update for gs3 building

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

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/bin/script/build

    r13067 r14925  
    9393
    9494my $cdir = $collectdir;
    95 $cdir = &util::filename_cat ($ENV{'GSDLHOME'}, "collect") unless $collectdir =~ /\w/;
     95if (defined $site)
     96{
     97    die "GSDL3HOME not set." unless $ENV{'GSDL3HOME'};
     98    $cdir = &util::filename_cat ($ENV{'GSDL3HOME'}, "sites", $site, "collect") unless $collectdir =~ /\w/;
     99}
     100else
     101{
     102    $cdir = &util::filename_cat ($ENV{'GSDLHOME'}, "collect") unless $collectdir =~ /\w/;
     103}
     104
    96105my $importdir = &util::filename_cat ($cdir, $collection, "import");
    97106my $archivedir = &util::filename_cat ($cdir, $collection, "archives");
     
    177186    print STDOUT "                           a -download option is supplied\n";
    178187    print STDOUT "   -collectdir directory   Collection directory (defaults to " .
    179     &util::filename_cat ($ENV{'GSDLHOME'}, "collect") . ")\n";
     188    &util::filename_cat($ENV{'GSDLHOME'}). "collect for Greenstone2;\n";
     189    print STDOUT"                            for Greenstone3 use -site option and then collectdir default will be\n";
     190    print STDOUT "                            set to the collect folder within that site.)\n";
     191    print STDOUT "   -site                   Specify the site within a Greenstone3 installation to use.\n";
    180192    print STDOUT "   -dontinstall            Only applicable if -collectdir is set to something\n";
    181193    print STDOUT "                           other than the default. -dontinstall will suppress\n";
     
    297309            my $download_cmd = "perl -S filecopy.pl";
    298310            $download_cmd .= " -collectdir \"$collectdir\"" if $collectdir =~ /\w/;
     311            $download_cmd .= " -site \"$site\"" if $site =~ /\w/;
    299312            $download_cmd .= " -out \"$outfile.download\"" if $use_out;
    300313            $download_cmd .= " \"" . $download_dir . "\" " . $collection;
    301             system ($download_cmd);
     314
     315            my $download_status = system ($download_cmd);
     316            if ($download_status > 0)
     317            {
     318            die "Failed to execute: $download_cmd\n";
     319            }
     320
     321
    302322            # if using output directory append the file download output to it
    303323            &append_file ($out, "$outfile.download");
     
    308328    }
    309329    }
     330
     331    `echo $importdir ; ls $importdir `;
    310332
    311333    if (-e &util::filename_cat ($archivedir, "archives.inf")) {
     
    355377
    356378    if ($collectdir ne "" && !$dontinstall) {
    357     my $install_collectdir = &util::filename_cat ($ENV{'GSDLHOME'}, "collect");
     379   
     380    my $install_collectdir;
     381    if (defined $ENV{'GSDL3HOME'})
     382    {
     383       
     384        if ((defined $site) && ($site ne ""))
     385        {
     386        $install_collectdir = &util::filename_cat ($ENV{'GSDL3HOME'}, "sites", $site, "collect");
     387        }
     388        else
     389        {
     390        my $msg = "build: ERROR: Need to specify the site within the Greenstone3 installation.";
     391        print $out $msg;
     392        &log_event ($msg);
     393        &final_out (6) if $use_out;
     394        die "\n";
     395        }
     396    }
     397    else
     398    {
     399        $install_collectdir = &util::filename_cat ($ENV{'GSDLHOME'}, "collect");
     400    }
     401
    358402    if (!&util::filenames_equal ($collectdir, $install_collectdir)) {
    359403       
     
    403447
    404448    $import_cmd .= " -manifest manifest.xml" if ($manifest);
     449    $import_cmd .= " -site \"$site\"" if $site =~ /\w/;
    405450    $import_cmd .= " -collectdir \"$collectdir\"" if $collectdir =~ /\w/;
    406451    $import_cmd .= " -statsfile \"$statsfile\"" if $statsfile =~ /\w/;
     
    447492
    448493    $build_cmd .= " -out \"$outfile.build\"" if $use_out;
     494    $build_cmd .= " -site \"$site\"" if $site =~ /\w/;
    449495    $build_cmd .= " -collectdir \"$collectdir\"" if $collectdir =~ /\w/;
    450496    $build_cmd .= " $maxdocs $collection";
     
    503549    }
    504550    }
     551
    505552    return 0;
    506553}
     
    605652             'download/.+', \@download,
    606653             'collectdir/.*/', \$collectdir,
     654             'site/.*/', \$site,
    607655             'dontinstall', \$dontinstall,
    608656             'save_archives', \$save_archives,
  • gsdl/trunk/bin/script/buildcol.pl

    r14247 r14925  
    9999    'reqd' => "no",
    100100        'hiddengli' => "yes" },
     101      { 'name' => "site",
     102    'desc' => "{buildcol.site}",
     103    'type' => "string",
     104    'deft' => "",
     105    'reqd' => "no",
     106        'hiddengli' => "yes" },
    101107      { 'name' => "create_images",
    102108    'desc' => "{buildcol.create_images}",
     
    269275{
    270276    # command line args
    271     my ($verbosity, $archivedir, $cachedir, $builddir, $maxdocs,
     277    my ($verbosity, $archivedir, $cachedir, $builddir, $site, $maxdocs,
    272278    $debug, $mode, $indexname, $removeold, $keepold, $incremental,
    273279    $remove_empty_classifications,
     
    332338
    333339    # get and check the collection
    334     if (($collection = &util::use_collection(@ARGV, $collectdir)) eq "") {
     340    if (($collection = &colcfg::use_collection($site, @ARGV, $collectdir)) eq "") {
    335341    &PrintUsage::print_txt_usage($options, "{buildcol.params}");
    336342    die "\n";
  • gsdl/trunk/bin/script/export.pl

    r14733 r14925  
    117117    'reqd' => "no",
    118118        'hiddengli' => "yes" },
     119      { 'name' => "site",
     120    'desc' => "{import.site}",
     121    'type' => "string",
     122    'deft' => "",
     123    'reqd' => "no",
     124        'hiddengli' => "yes" },
    119125      { 'name' => "collectdir",
    120126    'desc' => "{export.collectdir}",
    121127    'type' => "string",
    122     'deft' => &util::filename_cat ($ENV{'GSDLHOME'}, "collect"),
    123     'reqd' => "no",
     128    # parsearg left "" as default
     129    #'deft' => &util::filename_cat ($ENV{'GSDLHOME'}, "collect"),
     130        'reqd' => "no",
    124131        'hiddengli' => "yes" },
    125132      { 'name' => "listall",
     
    247254sub main {
    248255    # params
    249     my ($language, $verbosity, $importdir, $exportdir, $keepold, $listall,
     256    my ($language, $verbosity, $importdir, $exportdir, $site, $keepold, $listall,
    250257    $removeold, $saveas, $saveas_version, $debug, $OIDtype, $OIDmetadata,
    251     $maxdocs, $statsfile, $xsltfile, $mapping_file, $out, $faillog,
     258    $maxdocs, $statsfile, $xsltfile, $mapping_file, $out, $faillog, $gs_mode, $collectcfg,
    252259    $collectdir, $gli,$xslt_mets,$xslt_txt,$group_marc);
    253260    my $xml = 0;
     
    334341    eval {
    335342        # get and check the collection name
    336         if (($collection = &util::use_collection($collect_name, $collectdir)) eq "") {
     343        print STDERR "**** site = $site\n";
     344        if (($collection = &colcfg::use_collection($site, $collect_name, $collectdir)) eq "") {
    337345        &PrintUsage::print_txt_usage($options, "{export.params}");
    338346        die "\n";
     
    365373        my @global_opts = ();
    366374       
    367         $configfilename = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "etc", "collect.cfg");
    368         if (!-e $configfilename) {
    369         (&gsprintf($out, "{common.cannot_find_cfg_file}\n", $configfilename) && die);
    370         }
    371        
    372         my $collectcfg = &colcfg::read_collect_cfg ($configfilename);
     375        # Read in the collection configuration file.
     376        ($configfilename, $gs_mode) = &colcfg::get_collect_cfg_name($out);
     377       
     378        if ($gs_mode eq "gs2") {
     379        $collectcfg = &colcfg::read_collect_cfg ($configfilename);
     380        } elsif ($gs_mode eq "gs3") {
     381        $collectcfg = &colcfg::read_collection_cfg_xml ($configfilename);
     382        }
     383
    373384        if (defined $collectcfg->{'plugin'}) {
    374385        $plugins = $collectcfg->{'plugin'};
  • gsdl/trunk/bin/script/filecopy.pl

    r2495 r14925  
    4848    print STDERR "   -follow_links           Follow symbolic links when recursing directory\n";
    4949    print STDERR "                           structure\n";
    50     print STDERR "   -collectdir directory   Collection directory (defaults to " .
    51     &util::filename_cat ($ENV{'GSDLHOME'}, "collect") . ")\n";
     50    print STDOUT "   -collectdir directory   Collection directory (defaults to " .
     51    &util::filename_cat($ENV{'GSDLHOME'}). "collect for Greenstone2;\n";
     52    print STDOUT"                            for Greenstone3 use -site option and then collectdir default will be\n";
     53    print STDOUT "                            set to the collect folder within that site.)\n";
     54    print STDOUT "   -site                   Specify the site within a Greenstone3 installation to use.\n";
    5255    print STDERR "   -out                    Filename or handle to print output status to.\n";
    5356    print STDERR "                           The default is STDERR\n\n";
     
    116119             'follow_links', \$follow_links,
    117120             'collectdir/.*/', \$collectdir,
     121             'site/.*/', \$site,
    118122             'out/.*/STDERR', \$out)) {
    119123    &print_usage();
     
    121125    }
    122126
    123     if ($collectdir !~ /\w/) {
    124     $collectdir = &util::filename_cat ($ENV{'GSDLHOME'}, "collect");
     127
     128    if (defined $site)
     129    {
     130    die "GSDL3HOME not set." unless $ENV{'GSDL3HOME'};
     131    $collectdir = &util::filename_cat ($ENV{'GSDL3HOME'}, "sites", $site, "collect") unless $collectdir =~ /\w/;
     132    }
     133    else
     134    {
     135    $collectdir = &util::filename_cat ($ENV{'GSDLHOME'}, "collect") unless $collectdir =~ /\w/;
    125136    }
    126137
  • gsdl/trunk/bin/script/import.pl

    r14556 r14925  
    9999    'reqd' => "no",
    100100        'hiddengli' => "yes" },
     101      { 'name' => "site",
     102    'desc' => "{import.site}",
     103    'type' => "string",
     104    'deft' => "",
     105    'reqd' => "no",
     106        'hiddengli' => "yes" },
    101107      { 'name' => "manifest",
    102108    'desc' => "{import.manifest}",
     
    239245
    240246sub main {
    241     my ($verbosity, $importdir, $archivedir, $manifest, $incremental, $keepold,
     247    my ($verbosity, $importdir, $archivedir, $site, $manifest, $incremental, $keepold,
    242248    $removeold, $saveas, $version,
    243249    $gzip, $groupsize, $OIDtype, $OIDmetadata, $debug,
     
    302308
    303309    # get and check the collection name
    304     if (($collection = &util::use_collection(@ARGV, $collectdir)) eq "") {
     310    if (($collection = &colcfg::use_collection($site, @ARGV, $collectdir)) eq "") {
    305311    &PrintUsage::print_txt_usage($options, "{import.params}");
    306312    die "\n";
     
    325331    # Read in the collection configuration file.
    326332    ($configfilename, $gs_mode) = &colcfg::get_collect_cfg_name($out);
     333
    327334    if ($gs_mode eq "gs2") {
    328335        $collectcfg = &colcfg::read_collect_cfg ($configfilename);
Note: See TracChangeset for help on using the changeset viewer.