Changeset 2381


Ignore:
Timestamp:
2001-05-08T10:28:03+12:00 (23 years ago)
Author:
sjboddie
Message:

build script now fails with an error message if the import stage doesn't
import any documents (e.g. if all the documents in the import directory
are in a format that no plugin can process).

File:
1 edited

Legend:

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

    r2359 r2381  
    308308        }
    309309        &gsdl_import();
    310         &gsdl_build();
     310        if (&has_content ($archivedir, "^archives.inf\$")) {
     311        &gsdl_build();
     312        } else {
     313        my $msg = "build: ERROR: The collection could not be built as no\n";
     314        $msg .=   "       valid data was imported. Are at least some of\n";
     315        $msg .=   "       the files you imported in a format that can be\n";
     316        $msg .=   "       processed by the specified Greenstone plugins?\n";
     317        print $out $msg;
     318        &log_event ($msg);
     319        &final_out (6) if $use_out;
     320        die "\n";
     321        }
    311322    } else {
    312323        # no import or archives
    313         my $msg = "build: ERROR: The $collection collection has no import or archives data.\n";
     324        my $msg = "build: ERROR: The collection could not be built as it contains no data.\n";
    314325        print $out $msg;
    315326        &log_event ($msg);
     
    420431}
    421432
     433# return 1 if $dir directory contains any files or sub-directories (other
     434# than those specified in the $ignore regular expression)
    422435sub has_content {
    423     my ($dir) = @_;
     436    my ($dir, $ignore) = @_;
    424437
    425438    if (!-d $dir) {return 0;}
    426 
     439   
    427440    opendir (DIR, $dir) || return 0;
    428441    my @files = readdir DIR;
     
    431444    foreach my $file (@files) {
    432445    if ($file !~ /^\.{1,2}$/) {
    433         return 1;
     446        return 1 unless (defined $ignore && $file =~ /$ignore/);
    434447    }
    435448    }
Note: See TracChangeset for help on using the changeset viewer.