Changeset 12399
- Timestamp:
- 2006-08-04T10:47:22+12:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/bin/script/import.pl
r12370 r12399 294 294 die "\n"; 295 295 } 296 296 297 # add collection's perllib dir into include path in 297 298 # case we have collection specific modules 298 299 unshift (@INC, "$ENV{'GSDLCOLLECTDIR'}/perllib"); 299 300 301 # check that we can open the faillog 300 302 if ($faillog eq "") { 301 303 $faillog = &util::filename_cat($ENV{'GSDLCOLLECTDIR'}, "etc", "fail.log"); … … 308 310 $faillog = 'import::FAILLOG'; 309 311 $faillog->autoflush(1); 310 311 # check sortmeta 312 $sortmeta = undef unless defined $sortmeta && $sortmeta =~ /\S/; 313 if (defined $sortmeta && $groupsize > 1) { 314 &gsprintf($out, "{import.cannot_sort}\n\n"); 315 $sortmeta = undef; 316 } 317 318 # get the list of plugins for this collection and set any options that 319 # were specified in the collect.cfg (all import.pl options except 320 # -collectdir, -out and -faillog may be specified in the collect.cfg (these 321 # options must be known before we read the collect.cfg)) 322 my $plugins = []; 323 my @global_opts = (); 324 312 313 # check that there is a collect.cfg file 325 314 $configfilename = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "etc", "collect.cfg"); 326 315 if (!-e $configfilename) { 327 316 (&gsprintf($out, "{common.cannot_find_cfg_file}\n", $configfilename) && die); 328 317 } 329 330 318 $collectcfg = &colcfg::read_collect_cfg ($configfilename); 319 320 321 if (defined $collectcfg->{'importdir'} && $importdir eq "") { 322 $importdir = $collectcfg->{'importdir'}; 323 } 324 if (defined $collectcfg->{'archivedir'} && $archivedir eq "") { 325 $archivedir = $collectcfg->{'archivedir'}; 326 } 327 # fill in the default import and archives directories if none 328 # were supplied, turn all \ into / and remove trailing / 329 $importdir = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "import") if $importdir eq ""; 330 $importdir =~ s/[\\\/]+/\//g; 331 $importdir =~ s/\/$//; 332 if (!-e $importdir) { 333 &gsprintf($out, "{import.no_import_dir}\n\n", $importdir); 334 die "\n"; 335 } 336 337 $archivedir = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "archives") if $archivedir eq ""; 338 $archivedir =~ s/[\\\/]+/\//g; 339 $archivedir =~ s/\/$//; 340 341 my $plugins = []; 331 342 if (defined $collectcfg->{'plugin'}) { 332 343 $plugins = $collectcfg->{'plugin'}; 333 344 } 345 #some global options for the plugins 346 my @global_opts = (); 334 347 335 348 if ($verbosity !~ /\d+/) { … … 340 353 } 341 354 } 342 if (defined $collectcfg->{'importdir'} && $importdir eq "") {343 $importdir = $collectcfg->{'importdir'};344 }345 if (defined $collectcfg->{'archivedir'} && $archivedir eq "") {346 $archivedir = $collectcfg->{'archivedir'};347 }348 355 if (defined $collectcfg->{'manifest'} && $manifest eq "") { 349 356 $manifest = $collectcfg->{'manifest'}; … … 355 362 } 356 363 } 364 357 365 if ($maxdocs !~ /\-?\d+/) { 358 366 if (defined $collectcfg->{'maxdocs'} && $collectcfg->{'maxdocs'} =~ /\-?\d+/) { … … 387 395 $sortmeta = $collectcfg->{'sortmeta'}; 388 396 } 389 397 # sortmeta cannot be used with group size 398 $sortmeta = undef unless defined $sortmeta && $sortmeta =~ /\S/; 399 if (defined $sortmeta && $groupsize > 1) { 400 &gsprintf($out, "{import.cannot_sort}\n\n"); 401 $sortmeta = undef; 402 } 403 390 404 if (defined $collectcfg->{'removeprefix'} && $removeprefix eq "") { 391 405 $removeprefix = $collectcfg->{'removeprefix'}; … … 415 429 print STDERR "<Import>\n" if $gli; 416 430 417 # fill in the default import and archives directories if none418 # were supplied, turn all \ into / and remove trailing /419 $importdir = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "import") if $importdir eq "";420 $importdir =~ s/[\\\/]+/\//g;421 $importdir =~ s/\/$//;422 $archivedir = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "archives") if $archivedir eq "";423 $archivedir =~ s/[\\\/]+/\//g;424 $archivedir =~ s/\/$//;425 426 431 my $manifest_lookup = new manifest(); 427 432 if ($manifest ne "") { … … 470 475 471 476 472 473 477 ####Use Plugout#### 478 my ($plugout_name); 474 479 if ($saveas !~ /^(GA|METS)Plugout$/ ){ 475 480 $plugout_name = $saveas."Plugout"; … … 477 482 else{ 478 483 $plugout_name = $saveas; 479 480 481 482 484 } 485 486 my $opts=[]; 487 483 488 push @$opts,("-output_info",$archive_info) if (defined $archive_info); 484 489
Note:
See TracChangeset
for help on using the changeset viewer.