Changeset 1198


Ignore:
Timestamp:
2000-05-30T11:34:59+12:00 (24 years ago)
Author:
sjboddie
Message:

altered the build and build.bat scripts as the old build.bat didn't
seem to work on windows 98 -- build.bat now uses runperl.bat - this gives
the added advantage that the perl code only exists in build, there's
no duplication in build.bat

Location:
trunk/gsdl/bin
Files:
2 edited

Legend:

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

    r1185 r1198  
    11#!/usr/bin/perl
    22
    3 # This perl script is intended mostly for use on unix systems (hence no .pl
    4 # extension and the use of '/'s in paths). On windows it's suggested you
    5 # use build.bat (it's the same perl code with a batch file wrapper).
     3# This perl script may be called directly or by running build.bat on
     4# windows (build.bat is in bin\windows)
    65
    76BEGIN {
    8     die "GSDLHOME not set - did you remember to source setup.bash?\n"
    9     unless defined $ENV{'GSDLHOME'};
    10     die "GSDLOS not set - did you remember to source setup.bash?\n"
    11     unless defined $ENV{'GSDLOS'};
     7
     8    die "GSDLHOME not set - did you remember to source setup.bash (unix) or " .
     9    "run setup.bat (windows)?\n" unless defined $ENV{'GSDLHOME'};
     10    die "GSDLOS not set - did you remember to source setup.bash (unix) or " .
     11    "run setup.bat (windows)?\n" unless defined $ENV{'GSDLOS'};
    1212    unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
    1313}
     
    1515use parsargv;
    1616use util;
     17
     18
     19if (!parsargv::parse(\@ARGV,
     20             'buildtype/^(build|import)$/import', \$buildtype,
     21             'maxdocs/^\-?\d+/-1', \$maxdocs)) {
     22    &print_usage();
     23    die "\n";
     24}
     25
     26my ($collection) = @ARGV;
     27
     28if (!defined $collection || $collection !~ /\w/) {
     29    print STDERR "You must specify a collection to build\n";
     30    &print_usage();
     31    die "\n";
     32}
     33
     34if ($maxdocs == -1) {
     35    $maxdocs = "";
     36} else {
     37    $maxdocs = "-maxdocs $maxdocs";
     38}
     39
     40
     41my $collectdir = &util::filename_cat ($ENV{'GSDLHOME'}, "collect", $collection);
     42my $importdir = &util::filename_cat ($collectdir, "import");
     43my $archivedir = &util::filename_cat ($collectdir, "archives");
     44my $buildingdir = &util::filename_cat ($collectdir, "building");
     45my $indexdir = &util::filename_cat ($collectdir, "index");
     46my $bindir = &util::filename_cat ($ENV{'GSDLHOME'}, "bin");
    1747
    1848&main();
     
    2959sub main {
    3060
    31     if (!parsargv::parse(\@ARGV,
    32              'buildtype/^(build|import)$/import', \$buildtype,
    33              'maxdocs/^\-?\d+/-1', \$maxdocs)) {
    34     &print_usage();
    35     die "\n";
    36     }
    37 
    38     ($collection) = @ARGV;
    39 
    40     if (!defined $collection || $collection !~ /\w/) {
    41     print STDERR "You must specify a collection to build\n";
    42     &print_usage();
    43     die "\n";
    44     }
    45 
    46     if ($maxdocs == -1) {
    47     $maxdocs = "";
    48     } else {
    49     $maxdocs = "-maxdocs $maxdocs";
    50     }
    51    
    52     if (-e "$ENV{'GSDLHOME'}/collect/$collection/archives/archives.inf") {
    53     if (&has_content ("$ENV{'GSDLHOME'}/collect/$collection/import")) {
     61    if (-e &util::filename_cat ($archivedir, "archives.inf")) {
     62    if (&has_content ($importdir)) {
    5463        if ($buildtype eq "build") {
    5564        &gsdl_build();
     
    6574    }
    6675    } else {
    67     if (&has_content ("$ENV{'GSDLHOME'}/collect/$collection/import")) {
     76    if (&has_content ($importdir)) {
    6877        if ($buildtype eq "build") {
    6978        print STDERR "build: can't build directly from archives as no\n";
     
    8796
    8897    print STDERR "importing the $collection collection\n\n";
    89     system ("perl $ENV{'GSDLHOME'}/bin/script/import.pl -removeold $maxdocs $collection");
    90     if (-e "$ENV{'GSDLHOME'}/collect/$collection/archives/archives.inf") {
     98
     99    my $import = &util::filename_cat ($bindir, "script", "import.pl");
     100    system ("perl $import -removeold $maxdocs $collection");
     101    if (-e &util::filename_cat ($archivedir, "archives.inf")) {
    91102    print STDERR "$collection collection imported successfully\n\n";
    92103    } else {
     
    98109
    99110    print STDERR "building the $collection collection\n\n";
    100     system ("perl $ENV{'GSDLHOME'}/bin/script/buildcol.pl $maxdocs $collection");
    101111
    102     if (-e "$ENV{'GSDLHOME'}/collect/$collection/building/text/$collection.ldb" ||
    103     -e "$ENV{'GSDLHOME'}/collect/$collection/building/text/$collection.bdb") {
     112    my $buildcol = &util::filename_cat ($bindir, "script", "buildcol.pl");
     113    system ("perl $buildcol $maxdocs $collection");
     114    if (-e &util::filename_cat ($buildingdir, "text", "$collection.ldb") ||
     115    -e &util::filename_cat ($buildingdir, "text", "$collection.bdb")) {
    104116    print STDERR "$collection collection built successfully\n\n";
    105117    } else {
     
    108120
    109121    # replace old indexes with new ones
    110     my $indexdir = "$ENV{'GSDLHOME'}/collect/$collection/index";
    111122    if (&has_content ($indexdir)) {
    112123    print STDERR "removing old indexes\n";
    113124    &util::rm_r ($indexdir);
    114     rename ("$ENV{'GSDLHOME'}/collect/$collection/building", $indexdir);
     125    rename ($buildingdir, $indexdir);
    115126    }
    116127}
     
    132143    return 0;
    133144}
    134 
    135 __END__
    136 :endofperl
Note: See TracChangeset for help on using the changeset viewer.