Changeset 27392

Show
Ignore:
Timestamp:
23.05.2013 09:29:49 (6 years ago)
Author:
jmt12
Message:

Correcting bug that left archivedir undefined in some circumstances - code to do this was lurking down in the part that handled building files from cache, so I've moved this into the part that sets up the arguments/options instead. RSS feed files should now be copied correctly. Sorry Anu.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/buildcolutils.pm

    r27304 r27392  
    257257  } 
    258258 
     259  # - resolve (and possibly set to default) builddir 
    259260  if (defined $collectcfg->{'archivedir'} && $self->{'archivedir'} eq "") 
    260261  { 
    261262    $self->{'archivedir'} = $collectcfg->{'archivedir'}; 
    262263  } 
     264  # Modified so that the archivedir, if provided as an argument, is made 
     265  # absolute if it isn't already 
     266  if ($self->{'archivedir'} eq "") 
     267  { 
     268    $self->{'archivedir'} = &FileUtils::filenameConcatenate($ENV{'GSDLCOLLECTDIR'}, "archives"); 
     269  } 
     270  else 
     271  { 
     272    $self->{'archivedir'} = &util::make_absolute($ENV{'GSDLCOLLECTDIR'}, $archivedir); 
     273  } 
     274  # End Mod 
     275  $self->{'archivedir'} =~ s/[\\\/]+/\//g; 
     276  $self->{'archivedir'} =~ s/\/$//; 
     277 
     278  # - resolve (and possibly set to default) builddir 
     279  if (defined $collectcfg->{'builddir'} && $self->{'builddir'} eq "") 
     280  { 
     281    $self->{'builddir'} = $collectcfg->{'builddir'}; 
     282  } 
     283  if ($self->{'builddir'} eq "") 
     284  { 
     285    $self->{'builddir'} = &FileUtils::filenameConcatenate($ENV{'GSDLCOLLECTDIR'}, 'building'); 
     286    if ($incremental) 
     287    { 
     288      &gsprintf::gsprintf($out, "{buildcol.incremental_default_builddir}\n"); 
     289    } 
     290  } 
     291  # - why don't we make builddir absolute similar to archivedir? 
     292  $self->{'builddir'} =~ s/[\\\/]+/\//g; 
     293  $self->{'builddir'} =~ s/\/$//; 
    263294 
    264295  if (defined $collectcfg->{'cachedir'} && $self->{'cachedir'} eq "") 
    265296  { 
    266297    $self->{'cachedir'} = $collectcfg->{'cachedir'}; 
    267   } 
    268  
    269   if (defined $collectcfg->{'builddir'} && $self->{'builddir'} eq "") 
    270   { 
    271     $self->{'builddir'} = $collectcfg->{'builddir'}; 
    272298  } 
    273299 
     
    448474 
    449475  my ($realarchivedir, $realbuilddir); 
    450   # Modified so that the archivedir, if provided as an argument, is made 
    451   # absolute if it isn't already 
    452   if ($archivedir eq "") 
    453   { 
    454     $archivedir = &FileUtils::filenameConcatenate($ENV{'GSDLCOLLECTDIR'}, "archives"); 
    455   } 
    456   else 
    457   { 
    458     $archivedir = &util::make_absolute($ENV{'GSDLCOLLECTDIR'}, $archivedir); 
    459   } 
    460   # End Mod 
    461   $archivedir =~ s/[\\\/]+/\//g; 
    462   $archivedir =~ s/\/$//; 
    463  
    464   if ($builddir eq "") 
    465   { 
    466     $builddir = &FileUtils::filenameConcatenate($ENV{'GSDLCOLLECTDIR'}, 'building'); 
    467     if ($incremental) 
    468     { 
    469       &gsprintf::gsprintf($out, "{buildcol.incremental_default_builddir}\n"); 
    470     } 
    471   } 
    472   $builddir =~ s/[\\\/]+/\//g; 
    473   $builddir =~ s/\/$//; 
    474   $self->{'builddir'} = $builddir; 
    475  
    476476  # update the archive cache if needed 
    477477  if ($cachedir) 
     
    499499    $realbuilddir = $builddir; 
    500500  } 
     501  $self->{'realarchivedir'} = $realarchivedir; 
    501502  $self->{'realbuilddir'} = $realbuilddir; 
    502503 
     
    696697  my $rss_items_rdf_file = &FileUtils::filenameConcatenate($self->{'archivedir'}, 'rss-items.rdf'); 
    697698  # @todo FileUtils 
    698   if(defined $self->{'builddir'} && -d $self->{'builddir'} && -f $rss_items_rdf_file) 
    699   { 
    700     if ($verbosity >= 1) 
     699  if(defined $self->{'builddir'} && &FileUtils::directoryExists($self->{'builddir'}) && &FileUtils::fileExists($rss_items_rdf_file)) 
     700  { 
     701    if ($self->{'verbosity'} >= 1) 
    701702    { 
    702703      &gsprintf::gsprintf($self->{'out'}, "{buildcol.copying_rss_items_rdf}\n"); 
    703704    } 
    704     &util::cp($rss_items_rdf_file, $self->{'builddir'}); 
     705    &FileUtils::copyFiles($rss_items_rdf_file, $self->{'builddir'}); 
    705706  } 
    706707