- Timestamp:
- 1999-12-07T10:45:27+13:00 (24 years ago)
- Location:
- trunk/gsdl/perllib
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/colcfg.pm
r780 r810 34 34 # 35 35 # {'creator'}->string 36 # {'maintainer'}->array of strings37 36 # {'public'}->string 38 37 # {'beta'}->string 39 # {'key'}->string 38 # {'defaultindex'}->string 39 # {'importdir'}->string 40 # {'archivedir'}->string 41 # {'cachedir'}->string 42 # {'builddir'}->string 43 # {'removeold'}->string 44 45 # {'maintainer'}->array of strings 40 46 # {'languages'}->array of strings 41 # {'subcollection'}->hash of key-value pairs42 47 # {'indexsubcollections'}->array of strings 43 48 # {'indexes'}->array of strings 44 # {'defaultindex'}->string 45 # {'plugins'}->array of strings 49 # {'dontbuild'}->array of strings 50 # {'dontgdbm'}->array of strings 51 52 # {'subcollection'}->hash of key-value pairs 53 # {'collectionmeta'}->hash of key-value pairs 54 55 # {'plugin'}->array of arrays of strings 56 # {'classify'}->array of arrays of strings 46 57 47 58 sub read_collect_cfg { … … 49 60 50 61 return &cfgread::read_cfg_file ($filename, 51 '^(creator|public|beta|key|defaultindex|importdir|' . 52 'archivedir|cachedir|builddir|textindex|removeold)$', 53 '^(maintainer|languages|indexsubcollections|indexes|plugins|dontbuild|dontgdbm)$', 54 '^(subcollection|collectionmeta)$'); 62 q/^(creator|public|beta|defaultindex|importdir|/ . 63 q/archivedir|cachedir|builddir|removeold)$/, 64 q/(maintainer|languages|indexsubcollections|/ . 65 q/indexes|dontbuild|dontgdbm)$/, 66 q/^(subcollection|collectionmeta)$/, 67 q/^(plugin|classify)$/); 55 68 } 56 69 … … 59 72 60 73 &cfgread::write_cfg_file($filename, $data, 61 '^(creator|public|beta|key|defaultindex|importdir|' . 62 'archivedir|cachedir|builddir|textindex|removeold)$', 63 '^(maintainer|languages|indexsubcollections|indexes|plugins|dontbuild|dontgdbm)$', 64 '^(subcollection|collectionmeta)$'); 74 q/^(creator|public|beta|defaultindex|importdir|/ . 75 q/archivedir|cachedir|builddir|removeold)$/, 76 q/^(maintainer|languages|indexsubcollections|/ . 77 q/indexes|dontbuild|dontgdbm)$/, 78 q/^(subcollection|collectionmeta)$/, 79 q/^(plugin|classify)$/); 65 80 } 66 81 … … 79 94 80 95 return &cfgread::read_cfg_file ($filename, 81 '^(builddate|numdocs|numwords|numbytes)$',82 '^(metadata|languages)$');96 q/^(builddate|numdocs|numwords|numbytes)$/, 97 q/^(metadata|languages)$/); 83 98 } 84 99 … … 87 102 88 103 &cfgread::write_cfg_file($filename, $data, 89 '^(builddate|numdocs|numwords|numbytes)$',90 '^(metadata|languages)$');104 q/^(builddate|numdocs|numwords|numbytes)$/, 105 q/^(metadata|languages)$/); 91 106 } 92 107 -
trunk/gsdl/perllib/docsave.pm
r537 r810 100 100 my @assoc_files = (); 101 101 foreach $assoc_file (@{$doc_obj->get_assoc_files()}) { 102 my ($dir, $afile) = $assoc_file->[1] =~ /^(.*?)([^\/\\]+)$/; 103 $dir = "" unless defined $dir; 102 104 if (-e $assoc_file->[0]) { 103 my $ afile = &util::filename_cat($archive_dir, $doc_dir, $assoc_file->[1]);104 &util:: cp ($assoc_file->[0], $afile);105 my $filepath = &util::filename_cat($archive_dir, $doc_dir, $afile); 106 &util::hard_link ($assoc_file->[0], $filepath); 105 107 $doc_obj->add_metadata ($doc_obj->get_top_section(), 106 108 "gsdlassocfile", 107 "$a ssoc_file->[1]:$assoc_file->[2]");109 "$afile:$assoc_file->[2]:$dir"); 108 110 } else { 109 111 print STDERR "docsave::process couldn't copy the associated file " . -
trunk/gsdl/perllib/mgbuilder.pm
r784 r810 93 93 94 94 # get the list of plugins for this collection 95 my @plugins = (); # some good choice of plugins .... ????96 if (defined $self->{'collect_cfg'}->{'plugin s'}) {97 @plugins = @{$self->{'collect_cfg'}->{'plugins'}};95 my $plugins = []; 96 if (defined $self->{'collect_cfg'}->{'plugin'}) { 97 $plugins = $self->{'collect_cfg'}->{'plugin'}; 98 98 } 99 99 100 101 100 # load all the plugins 102 $self->{'pluginfo'} = &plugin::load_plugins ($ collection, \@plugins);101 $self->{'pluginfo'} = &plugin::load_plugins ($plugins); 103 102 if (scalar(@{$self->{'pluginfo'}}) == 0) { 104 103 print STDERR "No plugins were loaded.\n"; … … 106 105 } 107 106 107 # get the list of classifiers for this collection 108 my $classifiers = []; 109 if (defined $self->{'collect_cfg'}->{'classify'}) { 110 $classifiers = $self->{'collect_cfg'}->{'classify'}; 111 } 112 108 113 # load all the classifiers 109 $self->{'classifiers'} = []; 110 if (open (COLCFG, $colcfgname)) { 111 while (defined ($line = &cfgread::read_cfg_line('mgbuilder::COLCFG'))) { 112 if (scalar(@$line) >= 2) { 113 my $key = shift (@$line); 114 if ($key eq "classify") { 115 my $classinfo = &classify::load_classifier($line); 116 push (@{$self->{'classifiers'}}, $classinfo) 117 if defined $classinfo; 118 } 119 } 120 } 121 close (COLCFG); 122 } else { 123 print STDERR "mgbuilder::new couldn't read the cfg file $colcfgname\n"; 124 print STDERR " no classifiers were loaded\n"; 125 } 114 $self->{'classifiers'} = &classify::load_classifiers ($classifiers); 126 115 127 116 # load up any dontgdbm fields … … 560 549 my $self = shift (@_); 561 550 my $textdir = &util::filename_cat($self->{'build_dir'}, "text"); 551 my $assocdir = &util::filename_cat($self->{'build_dir'}, "assoc"); 562 552 &util::mk_all_dir ($textdir); 553 &util::mk_all_dir ($assocdir); 563 554 564 555 # get db name … … 572 563 my $txt2db_exe = &util::filename_cat($exedir, "txt2db$exe"); 573 564 574 print STDERR "\n*** creating the info database\n" if ($self->{'verbosity'} >= 1); 565 print STDERR "\n*** creating the info database and processing associated files\n" 566 if ($self->{'verbosity'} >= 1); 575 567 576 568 # init all the classifiers … … 590 582 $self->{'buildproc'}->set_output_handle ($handle); 591 583 $self->{'buildproc'}->set_mode ('infodb'); 584 $self->{'buildproc'}->set_assocdir ($assocdir); 592 585 $self->{'buildproc'}->set_dontgdbm ($self->{'dontgdbm'}); 593 586 $self->{'buildproc'}->set_classifiers ($self->{'classifiers'}); -
trunk/gsdl/perllib/mgbuildproc.pm
r780 r810 51 51 $self->{'classifiers'} = []; 52 52 $self->{'mode'} = "text"; 53 $self->{'assocdir'} = $build_dir; 53 54 $self->{'dontgdbm'} = {}; 54 55 $self->{'index'} = "section:text"; … … 102 103 103 104 $self->{'mode'} = $mode; 105 } 106 107 sub set_assocdir { 108 my $self = shift (@_); 109 my ($assocdir) = @_; 110 111 $self->{'assocdir'} = $assocdir; 104 112 } 105 113 … … 177 185 } 178 186 187 sub assoc_files { 188 my $self = shift (@_); 189 my ($doc_obj) = @_; 190 191 foreach $assoc_file (@{$doc_obj->get_assoc_files()}) { 192 $afile = &util::filename_cat($self->{'assocdir'}, $assoc_file->[1]); 193 &util::hard_link ($assoc_file->[0], $afile); 194 } 195 } 196 179 197 sub infodb { 180 198 my $self = shift (@_); … … 183 201 # $handle = "main::STDOUT"; 184 202 203 $self->assoc_files ($doc_obj); 204 185 205 my $doctype = $doc_obj->get_doc_type(); 186 206 … … 197 217 my $doc_OID = $doc_obj->get_OID(); 198 218 my $first = 1; 219 my $url = ""; 199 220 while (defined $section) { 200 221 # update a few statistics … … 222 243 223 244 if ($field ne "Identifier" && $field !~ /^gsdl/ && 224 defined $value && $value ne "" &&225 !defined $self->{'dontgdbm'}->{$field}) { 245 defined $value && $value ne "") { 246 226 247 # escape problematic stuff 227 248 $value =~ s/\\/\\\\/g; 228 249 $value =~ s/\n/\\n/g; 229 250 $value =~ s/\r/\\r/g; 230 231 print $handle "<$field>$value\n"; 232 } 233 } 234 251 252 # special case for URL metadata 253 if ($field =~ /^URL$/i) { 254 $url .= "[$value]\n"; 255 if ($section eq "") {$url .= "<section>$doc_OID\n";} 256 else {$url .= "<section>$doc_OID.$section\n";} 257 $url .= '-' x 70 . "\n"; 258 } 259 260 if (!defined $self->{'dontgdbm'}->{$field}) { 261 print $handle "<$field>$value\n"; 262 } 263 } 264 } 265 235 266 # output archivedir if at top level 236 267 if ($section eq $doc_obj->get_top_section()) { … … 242 273 print $handle "<archivedir>$archivedir\n"; 243 274 } 244 275 245 276 # output document display type 246 277 if ($first) { … … 280 311 else { print $handle "<section>$doc_OID.$section\n"; } 281 312 print $handle '-' x 70, "\n"; 313 314 # output entry for url 315 if ($url ne "") { 316 print $handle $url; 317 } 282 318 283 319 $first = 0;
Note:
See TracChangeset
for help on using the changeset viewer.