Ignore:
Timestamp:
2006-09-25T14:17:10+12:00 (18 years ago)
Author:
mdewsnip
Message:

Incremental building and dynamic GDBM updating code, many thanks to John Rowe and John Thompson at DL Consulting Ltd.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/basebuildproc.pm

    r11994 r12844  
    4040}
    4141
    42 sub new {
    43     my ($class, $collection, $source_dir, $build_dir, $keepold,
    44     $verbosity, $outhandle) = @_;
     42sub new()
     43  {
     44    my ($class, $collection, $source_dir, $build_dir, $keepold, $verbosity, $outhandle) = @_;
    4545    my $self = new docproc ();
    4646
     
    7171    # For incremental building need to seed num_docs etc from values
    7272    # stored in build.cfg (if present)
    73 
     73      print STDERR "Keepold!\n";
    7474    $buildconfigfile = &util::filename_cat($build_dir, "build.cfg");
    75 
     75      print STDERR "Build cfg: $buildconfigfile\n";
    7676    if (-e $buildconfigfile) {
    7777        $found_num_data = 1;
     
    8181        $buildconfigfile = &util::filename_cat($ENV{'GSDLCOLLECTDIR'},
    8282                           "index", "build.cfg");
     83            print STDERR "Index cfg: $buildconfigfile\n";
    8384        if (-e $buildconfigfile) {
    8485        $found_num_data = 1;
     
    8687    }
    8788
    88     }
    89 
    90     if ($found_num_data) {
     89    }
     90    #else
     91    #  {
     92    #    print STDERR "Removeold!\n";
     93    #  }
     94
     95    if ($found_num_data)
     96      {
     97        #print STDERR "Found_Num_Data!\n";
    9198    my $buildcfg = &colcfg::read_build_cfg($buildconfigfile);
    92    
    9399    $self->{'starting_num_docs'}     = $buildcfg->{'numdocs'};
     100        #print STDERR "- num_docs:     $self->{'starting_num_docs'}\n";
    94101    $self->{'starting_num_sections'} = $buildcfg->{'numsections'};
     102        #print STDERR "- num_sections: $self->{'starting_num_sections'}\n";
    95103    $self->{'starting_num_bytes'}    = $buildcfg->{'numbytes'};
    96     }
    97     else {
    98     $self->{'starting_num_docs'}     = 0;
     104        #print STDERR "- num_bytes:    $self->{'starting_num_bytes'}\n";
     105    }
     106    else
     107      {
     108        #print STDERR "NOT Found_Num_Data!\n";
     109        $self->{'starting_num_docs'}     = 0;
    99110    $self->{'starting_num_sections'} = 0;
    100111    $self->{'starting_num_bytes'}    = 0;
    101     }
     112      }
    102113
    103114    $self->{'output_handle'} = "STDOUT";
     
    428439        # output the matching document number
    429440        print $handle "<docnum>$self->{'num_docs'}\n";
     441           
    430442    } else {
    431443        # output a list of children
     
    612624}
    613625
    614 sub assoc_files {
     626sub assoc_files() {
    615627    my $self = shift (@_);
    616628    my ($doc_obj, $archivedir) = @_;
     
    618630   
    619631    foreach my $assoc_file (@{$doc_obj->get_assoc_files()}) {
     632      #rint STDERR "Processing associated file - copy " . $assoc_file->[0] . " to " . $assoc_file->[1] . "\n";
    620633    # if assoc file starts with a slash, we put it relative to the assoc
    621634    # dir, otherwise it is relative to the HASH... directory
    622635    if ($assoc_file->[1] =~ m@^[/\\]@) {
    623         $afile = &util::filename_cat($self->{'assocdir'},$assoc_file->[1]);
     636        $afile = &util::filename_cat($self->{'assocdir'}, $assoc_file->[1]);
    624637    } else {
    625638        $afile = &util::filename_cat($self->{'assocdir'}, $archivedir, $assoc_file->[1]);
Note: See TracChangeset for help on using the changeset viewer.