- Timestamp:
- 2000-08-20T20:42:28+12:00 (24 years ago)
- Location:
- trunk/gsdl
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/bin/script/build
r1424 r1431 18 18 19 19 if (!parsargv::parse(\@ARGV, 20 'append', \$append, 20 21 'remove_archives', \$remove_archives, 21 22 'remove_import', \$remove_import, … … 50 51 my $bindir = &util::filename_cat ($ENV{'GSDLHOME'}, "bin"); 51 52 52 my $ close_out = 0;53 my $use_out = 0; 53 54 my $outfile = $out; 54 55 if ($out !~ /^(STDERR|STDOUT)$/i) { 55 56 open (OUT, ">$out") || die "Couldn't open output file $out\n"; 56 57 $out = "OUT"; 57 $ close_out = 1;58 $use_out = 1; 58 59 } 59 60 $out->autoflush(1); … … 61 62 &main(); 62 63 63 close OUT if $ close_out;64 close OUT if $use_out; 64 65 65 66 sub print_usage { 66 67 print STDERR "\n usage: $0 [options] collection-name\n\n"; 67 68 print STDERR " options:\n"; 69 print STDERR " -append Add new files to existing collection\n"; 68 70 print STDERR " -remove_archives Remove archives directory after successfully\n"; 69 71 print STDERR " building the collection.\n"; … … 89 91 if (scalar (@download)) { 90 92 # remove any existing import data 91 &util::rm_r ($importdir) if -d $importdir; 93 if (&has_content ($importdir)) { 94 print $out "build: WARNING: removing contents of $importdir\n"; 95 &util::rm_r ($importdir); 96 } 92 97 93 98 foreach $download_dir (@download) { … … 107 112 # copy download_dir and all it contains to the import directory 108 113 my $download_cmd = "perl " . &util::filename_cat ($bindir, "script", "filecopy.pl"); 109 $download_cmd .= " -out \"$outfile\" \"" . $download_dir . "\" " . $collection; 114 $download_cmd .= " -out \"$outfile.download\"" if $use_out; 115 $download_cmd .= " \"" . $download_dir . "\" " . $collection; 110 116 system ($download_cmd); 117 # if using output directory append the file download output to it 118 &append_file ($out, "$outfile.download"); 111 119 } else { 112 120 print $out "WARNING: $download_dir does not exist\n"; … … 154 162 print $out "importing the $collection collection\n\n"; 155 163 156 my $import = &util::filename_cat ($bindir, "script", "import.pl"); 157 system ("perl $import -removeold $maxdocs -out \"$outfile\" $collection"); 164 my $import_cmd = "perl " . &util::filename_cat ($bindir, "script", "import.pl"); 165 $import_cmd .= " -out \"$outfile.import\"" if $use_out; 166 $import_cmd .= " -removeold" unless $append; 167 $import_cmd .= " $maxdocs $collection"; 168 system ($import_cmd); 169 # if using output directory append the import output to it 170 &append_file ($out, "$outfile.import"); 171 158 172 if (-e &util::filename_cat ($archivedir, "archives.inf")) { 159 173 print $out "$collection collection imported successfully\n\n"; … … 171 185 print $out "building the $collection collection\n\n"; 172 186 173 my $buildcol = &util::filename_cat ($bindir, "script", "buildcol.pl"); 174 system ("perl $buildcol $maxdocs -out \"$outfile\" $collection"); 187 my $build_cmd = "perl " . &util::filename_cat ($bindir, "script", "buildcol.pl"); 188 $build_cmd .= " -out \"$outfile.build\"" if $use_out; 189 $build_cmd .= " $maxdocs $collection"; 190 system ($build_cmd); 191 # if using output directory append the buildcol output to it 192 &append_file ($out, "$outfile.build"); 193 175 194 if (-e &util::filename_cat ($buildingdir, "text", "$collection.ldb") || 176 195 -e &util::filename_cat ($buildingdir, "text", "$collection.bdb")) { … … 209 228 return 0; 210 229 } 230 231 sub append_file { 232 my ($handle, $file) = @_; 233 234 open (FILE, $file) || return; 235 undef $/; 236 print $handle <FILE>; 237 $/ = "\n"; 238 close FILE; 239 &util::rm ($file); 240 } -
trunk/gsdl/bin/script/buildcol.pl
r1424 r1431 91 91 my $close_out = 0; 92 92 if ($out !~ /^(STDERR|STDOUT)$/i) { 93 open (OUT, "> >$out") || die "Couldn't open output file $out\n";93 open (OUT, ">$out") || die "Couldn't open output file $out\n"; 94 94 $out = "buildcol::OUT"; 95 95 $close_out = 1; -
trunk/gsdl/bin/script/filecopy.pl
r1424 r1431 151 151 my $close_out = 0; 152 152 if ($out !~ /^(STDERR|STDOUT)$/i) { 153 open (OUT, "> >$out") || die "Couldn't open output file $out\n";154 $out = "MAIN::OUT";153 open (OUT, ">$out") || die "Couldn't open output file $out\n"; 154 $out = OUT; 155 155 $close_out = 1; 156 156 } -
trunk/gsdl/bin/script/import.pl
r1424 r1431 94 94 my $close_out = 0; 95 95 if ($out !~ /^(STDERR|STDOUT)$/i) { 96 open (OUT, "> >$out") || die "Couldn't open output file $out\n";96 open (OUT, ">$out") || die "Couldn't open output file $out\n"; 97 97 $out = 'import::OUT'; 98 98 $close_out = 1; -
trunk/gsdl/perllib/plugin.pm
r1424 r1431 29 29 30 30 sub load_plugins { 31 my ($plugin_list, $verbosity, $outhandle) = @_; 31 my ($plugin_list) = shift @_; 32 ($verbosity, $outhandle) = @_; # globals 32 33 my @plugin_objects = (); 33 34 34 35 $verbosity = 2 unless defined $verbosity; 36 $outhandle = STDERR unless defined $outhandle; 35 37 36 38 foreach $pluginoptions (@$plugin_list) { … … 86 88 } 87 89 88 if ( defined $processor->{'verbosity'} && $processor->{'verbosity'}>= 2) {89 print STDERR"WARNING - no plugin could process " .90 if ($verbosity >= 2) { 91 print $outhandle "WARNING - no plugin could process " . 90 92 &util::filename_cat($base_dir,$file) . "\n"; 91 93 } -
trunk/gsdl/perllib/plugins/HTMLPlug.pm
r1424 r1431 119 119 my $self = shift (@_); 120 120 my ($textref, $pluginfo, $base_dir, $file, $metadata, $doc_obj) = @_; 121 my $outhandle = $self->{'outhandle'} 122 123 print $outhandle "HTMLPlug: processing $file\n" 121 my $outhandle = $self->{'outhandle'}; 122 123 print $outhandle "HTMLPlug: processing $file\n" 124 124 if $self->{'verbosity'} > 1; 125 125 -
trunk/gsdl/perllib/util.pm
r1046 r1431 555 555 # are defined 556 556 $ENV{'GSDLCOLLECTION'} = $collection unless defined $ENV{'GSDLCOLLECTION'}; 557 $ENV{'GSDLCOLLECTDIR'} = "$ENV{'GSDLHOME'}/collect/$collection";557 $ENV{'GSDLCOLLECTDIR'} = &filename_cat ($ENV{'GSDLHOME'}, "collect", $collection); 558 558 559 559 # make sure this collection exists
Note:
See TracChangeset
for help on using the changeset viewer.