Changeset 130 for trunk/gsdl/bin/script
- Timestamp:
- 1999-02-02T22:47:47+13:00 (25 years ago)
- Location:
- trunk/gsdl/bin/script
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/bin/script/buildcol.pl
r8 r130 10 10 } 11 11 12 use colcfg; 12 13 use parsargv; 13 14 use util; … … 37 38 38 39 # get and check the collection 39 ($collection) = @ARGV; 40 if (!defined ($collection)) { 40 if (($collection = &util::use_collection(@ARGV)) eq "") { 41 41 &print_usage(); 42 42 die "\n"; 43 43 } 44 if (!-e "$ENV{'GSDLHOME'}/collect/$collection") { 45 die "Invalid collection name ($collection).\n"; 44 45 # read the configuration file 46 $textindex = "section:text"; 47 $configfilename = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "etc/collect.cfg"); 48 if (-e $configfilename) { 49 $collectcfg = &colcfg::read_collect_cfg ($configfilename); 50 if (defined $collectcfg->{'archivedir'} && $archivedir eq "") { 51 $archivedir = $collectcfg->{'archivedir'}; 52 } 53 if (defined $collectcfg->{'cachedir'} && $cachedir eq "") { 54 $cachedir = $collectcfg->{'cachedir'}; 55 } 56 if (defined $collectcfg->{'builddir'} && $builddir eq "") { 57 $builddir = $collectcfg->{'builddir'}; 58 } 59 if (defined $collectcfg->{'textindex'}) { 60 $textindex = $collectcfg->{'textindex'}; 61 } 62 } else { 63 die "Couldn't find the configuration file $configfilename\n"; 46 64 } 47 65 48 66 # fill in the default archives and building directories if none 49 67 # were supplied, turn all \ into / and remove trailing / 50 $archivedir = "$ENV{'GSDL HOME'}/collect/$collection/archives" if $archivedir eq "";68 $archivedir = "$ENV{'GSDLCOLLECTDIR'}/archives" if $archivedir eq ""; 51 69 $archivedir =~ s/[\\\/]+/\//g; 52 70 $archivedir =~ s/\/$//; 53 $builddir = "$ENV{'GSDL HOME'}/collect/$collection/building" if $builddir eq "";71 $builddir = "$ENV{'GSDLCOLLECTDIR'}/building" if $builddir eq ""; 54 72 $builddir =~ s/[\\\/]+/\//g; 55 73 $builddir =~ s/\/$//; … … 80 98 # if a builder class has been created for this collection, use it 81 99 # otherwise, use the mg builder 82 if (-e "$ENV{'GSDL HOME'}/collect/$collection/perllib/${collection}builder.pm") {83 $builderdir = "$ENV{'GSDL HOME'}/collect/$collection/perllib";100 if (-e "$ENV{'GSDLCOLLECTDIR'}/perllib/${collection}builder.pm") { 101 $builderdir = "$ENV{'GSDLCOLLECTDIR'}/perllib"; 84 102 $buildertype = "${collection}builder"; 85 103 } else { … … 95 113 96 114 $builder->init(); 97 $builder->compress_text( );115 $builder->compress_text($textindex); 98 116 $builder->build_indexes(); 99 117 $builder->make_infodatabase(); -
trunk/gsdl/bin/script/gettext.pl
r117 r130 13 13 use plugin; 14 14 use colcfg; 15 use util; 15 16 16 17 sub print_usage { 17 18 print STDERR "\n usage: $0 collection-name\n"; 18 19 print STDERR " options:\n"; 20 print STDERR " -archivedir directory Where the archives live\n"; 19 21 print STDERR " -index index The index to output\n\n"; 20 22 } … … 26 28 27 29 if (!parsargv::parse(\@ARGV, 30 'archivedir/.*/', \$archivedir, 28 31 'index/.*/section:text', \$index, 29 32 'mode/.*/text', \$mode)) { … … 33 36 34 37 # get and check the collection name 35 ($collection) = @ARGV; 36 37 if (!defined($collection)) { 38 if (($collection = &util::use_collection(@ARGV)) eq "") { 38 39 &print_usage(); 39 40 die "\n"; … … 41 42 42 43 # get the list of plugins for this collection 43 @plugins = ("RecPlug", "HTMLPlug", "TXTPlug"); 44 if (-e "$ENV{'GSDLHOME'}/collect/$collection/etc/collect.cfg") { 45 $collectcfg = &colcfg::read_collect_cfg ("$ENV{'GSDLHOME'}/collect/$collection/etc/collect.cfg"); 44 @plugins = (); 45 $configfilename = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "etc/collect.cfg"); 46 if (-e $configfilename) { 47 $collectcfg = &colcfg::read_collect_cfg ($configfilename); 46 48 if (defined $collectcfg->{'plugins'}) { 47 49 @plugins = @{$collectcfg->{'plugins'}}; 48 50 } 51 if (defined $collectcfg->{'archivedir'} && $archivedir eq "") { 52 $archivedir = $collectcfg->{'archivedir'}; 53 } 54 } else { 55 die "Couldn't find the configuration file $configfilename\n"; 49 56 } 50 57 58 # fill in the default archives directories if none 59 # was supplied, turn all \ into / and remove trailing / 60 $archivedir = "$ENV{'GSDLCOLLECTDIR'}/archives" if $archivedir eq ""; 61 $archivedir =~ s/[\\\/]+/\//g; 62 $archivedir =~ s/\/$//; 51 63 52 64 # load all the plugins … … 60 72 # if a buildproc class has been created for this collection, use it 61 73 # otherwise, use the mg buildproc 74 # if a builder class has been created for this collection, use it 75 # otherwise, use the mg builder 76 # load up the document processor for building 77 # if a buildproc class has been created for this collection, use it 78 # otherwise, use the mg buildproc 62 79 my ($buildprocdir, $buildproctype); 63 if (-e "$ENV{'GSDL HOME'}/collect/$collection/perllib/${collection}buildproc.pm") {64 $buildprocdir = "$ENV{'GSDL HOME'}/collect/$collection/perllib";80 if (-e "$ENV{'GSDLCOLLECTDIR'}/perllib/${collection}buildproc.pm") { 81 $buildprocdir = "$ENV{'GSDLCOLLECTDIR'}/perllib"; 65 82 $buildproctype = "${collection}buildproc"; 66 83 } else { … … 70 87 require "$buildprocdir/$buildproctype.pm"; 71 88 72 my $source_dir = "$ENV{'GSDLHOME'}/collect/$collection/archives";73 my $build_dir = "$ENV{'GSDLHOME'}/collect/$collection/building";74 my $verbosity = 1;75 76 89 eval("\$buildproc = new $buildproctype(\$collection, " . 77 "\$ source_dir, \$build_dir, \$verbosity)");90 "\$archivedir, \"\$ENV{'GSDLCOLLECTDIR'}/building\", 1)"); 78 91 die "$@" if $@; 79 92 … … 86 99 87 100 # process the import directory 88 &plugin::read ($pluginfo, $ source_dir,101 &plugin::read ($pluginfo, $archivedir, 89 102 "", {}, $buildproc); 90 103 -
trunk/gsdl/bin/script/import.pl
r98 r130 14 14 use plugin; 15 15 use docsave; 16 16 use util; 17 use parsargv; 17 18 18 19 sub print_usage { 19 print STDERR "\n usage: $0 collection-name\n"; 20 print STDERR "\n usage: $0 [options] collection-name\n\n"; 21 print STDERR " options:\n"; 22 print STDERR " -importdir directory Where the original material lives\n"; 23 print STDERR " -archivedir directory Where the converted material ends up\n"; 24 print STDERR " -keepold Will not destroy the current contents of the\n"; 25 print STDERR " archives directory (the default)\n"; 26 print STDERR " -removeold Will remove the old contents of the archives\n"; 27 print STDERR " directory -- use with care\n\n"; 20 28 } 21 29 … … 24 32 25 33 sub main { 26 # get and check the collection name 27 ($collection) = @ARGV; 28 if (!defined($collection)) { 34 if (!parsargv::parse(\@ARGV, 35 'importdir/.*/', \$importdir, 36 'archivedir/.*/', \$archivedir, 37 'keepold', \$keepold, 38 'removeold', \$removeold)) { 29 39 &print_usage(); 30 40 die "\n"; 31 41 } 32 33 if ($collection eq "modelcol") { 34 print STDERR "You can't import documents into modelcol.\n"; 42 43 # set removeold to false if it has been defined 44 $removeold = 0 if ($keepold); 45 46 # get and check the collection name 47 if (($collection = &util::use_collection(@ARGV)) eq "") { 48 &print_usage(); 35 49 die "\n"; 36 50 } 37 51 38 52 # get the list of plugins for this collection 39 @plugins = ("HTMLPlug", "TXTPlug", "RecPlug"); 40 if (-e "$ENV{'GSDLHOME'}/collect/$collection/etc/collect.cfg") { 41 $collectcfg = &colcfg::read_collect_cfg ("$ENV{'GSDLHOME'}/collect/$collection/etc/collect.cfg"); 53 @plugins = (); 54 $configfilename = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "etc/collect.cfg"); 55 if (-e $configfilename) { 56 $collectcfg = &colcfg::read_collect_cfg ($configfilename); 42 57 if (defined $collectcfg->{'plugins'}) { 43 58 @plugins = @{$collectcfg->{'plugins'}}; 44 59 } 60 if (defined $collectcfg->{'importdir'} && $importdir eq "") { 61 $importdir = $collectcfg->{'importdir'}; 62 } 63 if (defined $collectcfg->{'archivedir'} && $archivedir eq "") { 64 $archivedir = $collectcfg->{'archivedir'}; 65 } 66 if (defined $collectcfg->{'removeold'}) { 67 if ($collectcfg->{'removeold'} =~ /^true$/i && !$keepold) { 68 $removeold = 1; 69 } 70 if ($collectcfg->{'removeold'} =~ /^false$/i && !$removeold) { 71 $removeold = 0; 72 } 73 } 45 74 } else { 46 print STDERR "WARNING - couldn't find collection configuration file\n"; 47 print STDERR " using default plugins\n"; 75 die "Couldn't find the configuration file $configfilename\n"; 48 76 } 49 77 78 # fill in the default import and archives directories if none 79 # were supplied, turn all \ into / and remove trailing / 80 $importdir = "$ENV{'GSDLCOLLECTDIR'}/import" if $importdir eq ""; 81 $importdir =~ s/[\\\/]+/\//g; 82 $importdir =~ s/\/$//; 83 $archivedir = "$ENV{'GSDLCOLLECTDIR'}/archives" if $archivedir eq ""; 84 $archivedir =~ s/[\\\/]+/\//g; 85 $archivedir =~ s/\/$//; 50 86 51 87 # load all the plugins … … 56 92 } 57 93 94 # remove the old contents of the archives directory if needed 95 if ($removeold && -e $archivedir) { 96 print STDERR "Warning - removing current contents of the archives directory\n"; 97 print STDERR " in preparation for the import\n"; 98 sleep(5); # just in case... 99 &util::rm_r ($archivedir); 100 } 101 58 102 # read the archive information file 59 $archive_info_filename = "$ENV{'GSDLHOME'}/collect/$collection/archives/archives.inf";103 $archive_info_filename = &util::filename_cat ($archivedir, "archives.inf"); 60 104 $archive_info = new arcinfo (); 61 105 $archive_info->load_info ($archive_info_filename); … … 63 107 # create a docsave object to process the documents 64 108 $processor = new docsave ($collection, $archive_info); 109 $processor->setarchivedir ($archivedir); 65 110 66 111 # process the import directory 67 &plugin::read ($pluginfo, "$ENV{'GSDLHOME'}/collect/$collection/import/",112 &plugin::read ($pluginfo, $importdir, 68 113 "", {}, $processor); 69 114
Note:
See TracChangeset
for help on using the changeset viewer.