@@ -432,98 +432,110 @@ sub CopyContribFiles
432432my $target =shift ;
433433
434434print " Copying contrib data files..." ;
435- my $D ;
436- opendir ($D ,' contrib' ) || croak" Could not opendir on contrib!\n " ;
437- while (my $d =readdir ($D ))
435+ foreach my $subdir (' contrib' ,' src/test/modules' )
438436{
439- next if ($d =~/ ^\. / );
440- next unless (-f " contrib/$d /Makefile" );
441- next
442- if ($insttype eq " client" && !grep {$_ eq $d }@client_contribs );
437+ my $D ;
438+ opendir ($D ,$subdir ) || croak" Could not opendir on$subdir !\n " ;
439+ while (my $d =readdir ($D ))
440+ {
441+ # These configuration-based exclusions must match vcregress.pl
442+ next if ($d eq " uuid-ossp" && !defined ($config -> {uuid }));
443+ next if ($d eq " sslinfo" && !defined ($config -> {openssl }));
444+ next if ($d eq " xml2" && !defined ($config -> {xml }));
445+ next if ($d eq " sepgsql" );
443446
444- # these configuration-based exclusions must match vcregress.pl
445- next if ( $d eq " uuid-ossp " && ! defined ( $config -> { uuid }));
446- next if ( $d eq " sslinfo " && ! defined ( $config -> { openssl }));
447- next if ( $d eq " xml2 " && ! defined ( $config -> { xml })) ;
448- next if ( $d eq " sepgsql " );
447+ CopySubdirFiles( $subdir , $d , $config , $target );
448+ }
449+ }
450+ print " \n " ;
451+ }
449452
450- my $mf = read_file(" contrib/$d /Makefile" );
451- $mf =~s {\\\r ?\n } {} g ;
453+ sub CopySubdirFiles
454+ {
455+ my $subdir =shift ;
456+ my $module =shift ;
457+ my $config =shift ;
458+ my $target =shift ;
452459
453- # Note: we currently don't support setting MODULEDIR in the makefile
454- my $moduledir =' contrib' ;
460+ return if ($module =~/ ^\. / );
461+ return unless (-f " $subdir /$module /Makefile" );
462+ return
463+ if ($insttype eq " client" && !grep {$_ eq $module }@client_contribs );
455464
456- my $flist =' ' ;
457- if ($mf =~/ ^EXTENSION\s *=\s *(.*)$ /m ) {$flist .=$1 }
458- if ($flist ne ' ' )
459- {
460- $moduledir =' extension' ;
461- $flist = ParseAndCleanRule($flist ,$mf );
465+ my $mf = read_file(" $subdir /$module /Makefile" );
466+ $mf =~s {\\\r ?\n } {} g ;
462467
463- foreach my $f (split /\s +/,$flist )
464- {
465- lcopy(
466- ' contrib/' .$d .' /' .$f .' .control' ,
467- $target .' /share/extension/' .$f .' .control'
468- ) || croak(" Could not copy file$f .control in contrib$d " );
469- print ' .' ;
470- }
471- }
468+ # Note: we currently don't support setting MODULEDIR in the makefile
469+ my $moduledir =' contrib' ;
472470
473- $flist =' ' ;
474- if ($mf =~/ ^DATA_built\s *=\s *(.*)$ /m ) {$flist .=$1 }
475- if ($mf =~/ ^DATA\s *=\s *(.*)$ /m ) {$flist .=" $1 " }
476- $flist =~s / ^\s *// ;# Remove leading spaces if we had only DATA_built
471+ my $flist =' ' ;
472+ if ($mf =~/ ^EXTENSION\s *=\s *(.*)$ /m ) {$flist .=$1 }
473+ if ($flist ne ' ' )
474+ {
475+ $moduledir =' extension' ;
476+ $flist = ParseAndCleanRule($flist ,$mf );
477477
478- if ( $flist ne ' ' )
478+ foreach my $f ( split /\ s +/, $flist )
479479{
480- $flist = ParseAndCleanRule($flist ,$mf );
481-
482- foreach my $f (split /\s +/,$flist )
483- {
484- lcopy(' contrib/' .$d .' /' .$f ,
485- $target .' /share/' .$moduledir .' /' . basename($f ))
486- || croak(" Could not copy file$f in contrib$d " );
480+ lcopy(
481+ " $subdir /$module /$f .control" ,
482+ " $target /share/extension/$f .control"
483+ ) || croak(" Could not copy file$f .control in contrib$module " );
487484print ' .' ;
488- }
489485}
486+ }
490487
491- $flist =' ' ;
492- if ($mf =~/ ^DATA_TSEARCH\s *=\s *(.*)$ /m ) {$flist .=$1 }
493- if ($flist ne ' ' )
494- {
495- $flist = ParseAndCleanRule($flist ,$mf );
488+ $flist =' ' ;
489+ if ($mf =~/ ^DATA_built\s *=\s *(.*)$ /m ) {$flist .=$1 }
490+ if ($mf =~/ ^DATA\s *=\s *(.*)$ /m ) {$flist .=" $1 " }
491+ $flist =~s / ^\s *// ;# Remove leading spaces if we had only DATA_built
496492
497- foreach my $f (split /\s +/,$flist )
498- {
499- lcopy(' contrib/' .$d .' /' .$f ,
500- $target .' /share/tsearch_data/' . basename($f ))
501- || croak(" Could not copy file$f in contrib$d " );
493+ if ($flist ne ' ' )
494+ {
495+ $flist = ParseAndCleanRule($flist ,$mf );
496+
497+ foreach my $f (split /\s +/,$flist )
498+ {
499+ lcopy(" $subdir /$module /$f " ,
500+ " $target /share/$moduledir /" . basename($f ))
501+ || croak(" Could not copy file$f in contrib$module " );
502502print ' .' ;
503- }
504503}
504+ }
505505
506- $flist =' ' ;
507- if ($mf =~/ ^DOCS\s *=\s *(.*)$ /mg ) {$flist .=$1 }
508- if ($flist ne ' ' )
506+ $flist =' ' ;
507+ if ($mf =~/ ^DATA_TSEARCH\s *=\s *(.*)$ /m ) {$flist .=$1 }
508+ if ($flist ne ' ' )
509+ {
510+ $flist = ParseAndCleanRule($flist ,$mf );
511+
512+ foreach my $f (split /\s +/,$flist )
509513{
510- $flist = ParseAndCleanRule($flist ,$mf );
514+ lcopy(" $subdir /$module /$f " ,
515+ " $target /share/tsearch_data/" . basename($f ))
516+ || croak(" Could not copy file$f in$subdir $module " );
517+ print ' .' ;
518+ }
519+ }
520+
521+ $flist =' ' ;
522+ if ($mf =~/ ^DOCS\s *=\s *(.*)$ /mg ) {$flist .=$1 }
523+ if ($flist ne ' ' )
524+ {
525+ $flist = ParseAndCleanRule($flist ,$mf );
511526
512- # Special case for contrib/spi
513- $flist =
527+ # Special case for contrib/spi
528+ $flist =
514529" autoinc.example insert_username.example moddatetime.example refint.example timetravel.example"
515- if ($d eq ' spi' );
516- foreach my $f (split /\s +/,$flist )
517- {
518- lcopy(' contrib/' .$d .' /' .$f ,
519- $target .' /doc/' .$moduledir .' /' .$f )
520- || croak(" Could not copy file$f in contrib$d " );
521- print ' .' ;
522- }
530+ if ($module eq ' spi' );
531+ foreach my $f (split /\s +/,$flist )
532+ {
533+ lcopy(" $subdir /$module /$f " ,
534+ " $target /doc/$moduledir /$f " )
535+ || croak(" Could not copy file$f in contrib$module " );
536+ print ' .' ;
523537}
524538}
525- closedir ($D );
526- print " \n " ;
527539}
528540
529541sub ParseAndCleanRule