Changeset 18492


Ignore:
Timestamp:
2009-02-10T14:10:31+13:00 (12 years ago)
Author:
davidb
Message:

incremental switches to -removeold if collection not built before

Location:
gsdl/trunk/bin/script
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/bin/script/incremental-buildcol.pl

    r18470 r18492  
    6161    my $collect = pop @argv;
    6262
    63     my $collect_dir = &util::filename_cat($ENV{'GSDLHOME'},"collect",$collect);
     63
     64    my @filtered_argv = ();
     65
     66    my $collect_dir = undef;
     67    my $build_dir  = undef;
     68
     69    while (my $arg = shift @argv) {
     70    if ($arg eq "-collectdir") {
     71        $collect_dir = shift @argv;
     72        push(@filtered_argv,$arg,$collect_dir);
     73    }
     74    elsif ($arg eq "-builddir") {
     75        $build_dir = shift @argv;
     76        push(@filtered_argv,$arg,$build_dir);
     77    }
     78    else {
     79        push(@filtered_argv,$arg);
     80    }
     81    }
     82
     83
     84    if (!defined $collect_dir) {
     85    $collect_dir = &util::filename_cat($ENV{'GSDLHOME'},"collect",$collect);
     86    }
    6487    if (!-d $collect_dir) {
    6588    print STDERR "Error: $collect_dir does not exist\n";
     
    6790    }
    6891
     92
     93    if (!defined $build_dir) {
     94    $build_dir = &util::filename_cat($collect_dir,"index");
     95    push(@filtered_argv,"-builddir",$build_dir);
     96    }
     97
     98    my $quoted_argv = join(" ", map { "\"$_\"" } @filtered_argv);
    6999   
    70     my $index_dir = &util::filename_cat($collect_dir,"index");
     100    my $build_cfg_filename = &util::filename_cat($build_dir,"build.cfg");
    71101
     102    my $buildcol_cmd = "buildcol.pl";
    72103
    73     my $quoted_argv = join(" ", map { "\"$_\"" } @argv);
    74        
     104    if (-e $build_cfg_filename) {
     105    $buildcol_cmd .= " -incremental";
     106    }
     107    else {
     108### print STDERR "$build_cfg_filename does not exist.\n";
     109    print STDERR "*****\n";
     110    print STDERR "* First time built. Switching to full buildcol.pl.\n";
     111    print STDERR "*****\n";
     112    $buildcol_cmd .= " -removeold";
     113    }
     114
    75115   
    76     my $buildcol_cmd = "buildcol.pl -incremental $quoted_argv -builddir \"$index_dir\" \"$collect\"";
     116    $buildcol_cmd .= " $quoted_argv \"$collect\"";
    77117   
    78118    my $buildcol_status = system($buildcol_cmd)/256;
  • gsdl/trunk/bin/script/incremental-import.pl

    r18491 r18492  
    9696
    9797    if (!defined $archive_dir) {
    98     $archive_dir = &util::filename_cat($collect_dir,"archive_dir");
     98    $archive_dir = &util::filename_cat($collect_dir,"archives");
    9999    }
    100100   
     
    112112    }
    113113    else {
    114     print STDERR "$archiveinf_doc does not exist.\n";
     114### print STDERR "$archiveinf_doc does not exist.\n";
     115    print STDERR "*****\n";
    115116    print STDERR "First time built. Switching to full import.pl.\n";
     117    print STDERR "*****\n";
    116118    $import_cmd .= " -removeold";
    117119    }
    118120
    119     $import_cmd .= " $quoted_argv";
     121    $import_cmd .= " $quoted_argv \"$collect\"";
    120122
    121 
     123   
    122124    my $import_status = system($import_cmd)/256;
    123125   
Note: See TracChangeset for help on using the changeset viewer.