From e901543c2fa728646dca13a66979a6f0619dd87f Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Wed, 15 Apr 2015 23:13:14 -0700 Subject: [PATCH 2/3] Support installation of test modules in MSVC Note that those modules are needed in the installation because like contribcheck, modulescheck does not create a cluster from scratch on where to run the tests. It seems also good to include them to be able to perform those tests using a central installation path. --- src/tools/msvc/Install.pm | 151 +++++++++++++++++++++++++--------------------- 1 file changed, 81 insertions(+), 70 deletions(-) diff --git a/src/tools/msvc/Install.pm b/src/tools/msvc/Install.pm index 93a6724..c82743d 100644 --- a/src/tools/msvc/Install.pm +++ b/src/tools/msvc/Install.pm @@ -433,97 +433,108 @@ sub CopyContribFiles print "Copying contrib data files..."; my $D; - opendir($D, 'contrib') || croak "Could not opendir on contrib!\n"; - while (my $d = readdir($D)) + foreach my $subdir ('contrib', 'src/test/modules') { - next if ($d =~ /^\./); - next unless (-f "contrib/$d/Makefile"); - next - if ($insttype eq "client" && !grep { $_ eq $d } @client_contribs); + opendir($D, $subdir) || croak "Could not opendir on $subdir!\n"; + while (my $d = readdir($D)) + { + # These configuration-based exclusions must match vcregress.pl + next if ($d eq "uuid-ossp" && !defined($config->{uuid})); + next if ($d eq "sslinfo" && !defined($config->{openssl})); + next if ($d eq "xml2" && !defined($config->{xml})); + next if ($d eq "sepgsql"); + CopySubdirFiles($subdir, $d, $config, $target); + } + } + print "\n"; +} - # these configuration-based exclusions must match vcregress.pl - next if ($d eq "uuid-ossp" && !defined($config->{uuid})); - next if ($d eq "sslinfo" && !defined($config->{openssl})); - next if ($d eq "xml2" && !defined($config->{xml})); - next if ($d eq "sepgsql"); +sub CopySubdirFiles +{ + my $subdir = shift; + my $module = shift; + my $config = shift; + my $target = shift; - my $mf = read_file("contrib/$d/Makefile"); - $mf =~ s{\\\r?\n}{}g; + return if ($module =~ /^\./); + return unless (-f "$subdir/$module/Makefile"); + return + if ($insttype eq "client" && !grep { $_ eq $module } @client_contribs); - # Note: we currently don't support setting MODULEDIR in the makefile - my $moduledir = 'contrib'; + my $mf = read_file("$subdir/$module/Makefile"); + $mf =~ s{\\\r?\n}{}g; - my $flist = ''; - if ($mf =~ /^EXTENSION\s*=\s*(.*)$/m) { $flist .= $1 } - if ($flist ne '') - { - $moduledir = 'extension'; - $flist = ParseAndCleanRule($flist, $mf); + # Note: we currently don't support setting MODULEDIR in the makefile + my $moduledir = 'contrib'; - foreach my $f (split /\s+/, $flist) - { - lcopy( - 'contrib/' . $d . '/' . $f . '.control', - $target . '/share/extension/' . $f . '.control' - ) || croak("Could not copy file $f.control in contrib $d"); + my $flist = ''; + if ($mf =~ /^EXTENSION\s*=\s*(.*)$/m) { $flist .= $1 } + if ($flist ne '') + { + $moduledir = 'extension'; + $flist = ParseAndCleanRule($flist, $mf); + + foreach my $f (split /\s+/, $flist) + { + lcopy( + "$subdir/$module/$f.control", + "$target/share/extension/$f.control" + ) || croak("Could not copy file $f.control in contrib $module"); print '.'; - } } + } - $flist = ''; - if ($mf =~ /^DATA_built\s*=\s*(.*)$/m) { $flist .= $1 } - if ($mf =~ /^DATA\s*=\s*(.*)$/m) { $flist .= " $1" } - $flist =~ s/^\s*//; # Remove leading spaces if we had only DATA_built + $flist = ''; + if ($mf =~ /^DATA_built\s*=\s*(.*)$/m) { $flist .= $1 } + if ($mf =~ /^DATA\s*=\s*(.*)$/m) { $flist .= " $1" } + $flist =~ s/^\s*//; # Remove leading spaces if we had only DATA_built - if ($flist ne '') - { - $flist = ParseAndCleanRule($flist, $mf); + if ($flist ne '') + { + $flist = ParseAndCleanRule($flist, $mf); - foreach my $f (split /\s+/, $flist) - { - lcopy('contrib/' . $d . '/' . $f, - $target . '/share/' . $moduledir . '/' . basename($f)) - || croak("Could not copy file $f in contrib $d"); + foreach my $f (split /\s+/, $flist) + { + lcopy("$subdir/$module/$f", + "$target/share/$moduledir/" . basename($f)) + || croak("Could not copy file $f in contrib $module"); print '.'; - } } + } - $flist = ''; - if ($mf =~ /^DATA_TSEARCH\s*=\s*(.*)$/m) { $flist .= $1 } - if ($flist ne '') - { - $flist = ParseAndCleanRule($flist, $mf); + $flist = ''; + if ($mf =~ /^DATA_TSEARCH\s*=\s*(.*)$/m) { $flist .= $1 } + if ($flist ne '') + { + $flist = ParseAndCleanRule($flist, $mf); - foreach my $f (split /\s+/, $flist) - { - lcopy('contrib/' . $d . '/' . $f, - $target . '/share/tsearch_data/' . basename($f)) - || croak("Could not copy file $f in contrib $d"); - print '.'; - } + foreach my $f (split /\s+/, $flist) + { + lcopy("$subdir/$module/$f", + "$target/share/tsearch_data/" . basename($f)) + || croak("Could not copy file $f in $subdir $module"); + print '.'; } + } - $flist = ''; - if ($mf =~ /^DOCS\s*=\s*(.*)$/mg) { $flist .= $1 } - if ($flist ne '') - { - $flist = ParseAndCleanRule($flist, $mf); + $flist = ''; + if ($mf =~ /^DOCS\s*=\s*(.*)$/mg) { $flist .= $1 } + if ($flist ne '') + { + $flist = ParseAndCleanRule($flist, $mf); - # Special case for contrib/spi - $flist = + # Special case for contrib/spi + $flist = "autoinc.example insert_username.example moddatetime.example refint.example timetravel.example" - if ($d eq 'spi'); - foreach my $f (split /\s+/, $flist) - { - lcopy('contrib/' . $d . '/' . $f, - $target . '/doc/' . $moduledir . '/' . $f) - || croak("Could not copy file $f in contrib $d"); - print '.'; - } + if ($module eq 'spi'); + foreach my $f (split /\s+/, $flist) + { + lcopy("$subdir/$module/$f", + "$target/doc/$moduledir/$f") + || croak("Could not copy file $f in contrib $module"); + print '.'; } } - closedir($D); - print "\n"; } sub ParseAndCleanRule -- 2.3.5