From 3396d1c695a52f5f4b1bf4af1f96ff64cf65807a Mon Sep 17 00:00:00 2001 From: Andrew Dunstan Date: Thu, 27 Sep 2007 21:13:11 +0000 Subject: [PATCH] Turn build and vcregress .bat files into pure one line wrappers for the perl scripts. Remove the now superfluous getregress.pl. --- src/tools/msvc/Install.pm | 30 +++++--- src/tools/msvc/build.bat | 41 ++--------- src/tools/msvc/getregress.pl | 46 ------------ src/tools/msvc/vcregress.bat | 132 ++--------------------------------- 4 files changed, 30 insertions(+), 219 deletions(-) delete mode 100644 src/tools/msvc/getregress.pl diff --git a/src/tools/msvc/Install.pm b/src/tools/msvc/Install.pm index 6a89f755e1..729f3b641f 100644 --- a/src/tools/msvc/Install.pm +++ b/src/tools/msvc/Install.pm @@ -3,7 +3,7 @@ package Install; # # Package that provides 'make install' functionality for msvc builds # -# $PostgreSQL: pgsql/src/tools/msvc/Install.pm,v 1.21 2007/09/23 20:32:40 adunstan Exp $ +# $PostgreSQL: pgsql/src/tools/msvc/Install.pm,v 1.22 2007/09/27 21:13:11 adunstan Exp $ # use strict; use warnings; @@ -17,6 +17,16 @@ our (@ISA,@EXPORT_OK); @ISA = qw(Exporter); @EXPORT_OK = qw(Install); +sub lcopy +{ + my $src = shift; + my $target = shift; + + unlink $target if -f $target; + + copy($src,$target); +} + sub Install { $| = 1; @@ -43,7 +53,7 @@ sub Install 'doc/contrib', 'symbols', 'share/tsearch_data'); CopySolutionOutput($conf, $target); - copy($target . '/lib/libpq.dll', $target . '/bin/libpq.dll'); + lcopy($target . '/lib/libpq.dll', $target . '/bin/libpq.dll'); my $sample_files = []; File::Find::find({wanted => sub { /^.*\.sample\z/s && @@ -113,7 +123,7 @@ sub CopyFiles print "."; $f = $basedir . $f; die "No file $f\n" if (!-f $f); - copy($f, $target . basename($f)) + lcopy($f, $target . basename($f)) || croak "Could not copy $f to $target". basename($f). " to $target". basename($f) . "\n"; } print "\n"; @@ -131,7 +141,7 @@ sub CopySetOfFiles next if /ecpg.test/; # Skip temporary install in regression subdir my $tgt = $target . basename($_); print "."; - copy($_, $tgt) || croak "Could not copy $_: $!\n"; + lcopy($_, $tgt) || croak "Could not copy $_: $!\n"; } print "\n"; } @@ -173,8 +183,8 @@ sub CopySolutionOutput # Static lib, such as libpgport, only used internally during build, don't install next; } - copy("$conf\\$pf\\$pf.$ext","$target\\$dir\\$pf.$ext") || croak "Could not copy $pf.$ext\n"; - copy("$conf\\$pf\\$pf.pdb","$target\\symbols\\$pf.pdb") || croak "Could not copy $pf.pdb\n"; + lcopy("$conf\\$pf\\$pf.$ext","$target\\$dir\\$pf.$ext") || croak "Could not copy $pf.$ext\n"; + lcopy("$conf\\$pf\\$pf.pdb","$target\\symbols\\$pf.pdb") || croak "Could not copy $pf.pdb\n"; print "."; } print "\n"; @@ -297,7 +307,7 @@ sub CopyContribFiles if ($d eq 'spi'); foreach my $f (split /\s+/,$flist) { - copy('contrib/' . $d . '/' . $f,$target . '/share/contrib/' . basename($f)) + lcopy('contrib/' . $d . '/' . $f,$target . '/share/contrib/' . basename($f)) || croak("Could not copy file $f in contrib $d"); print '.'; } @@ -315,7 +325,7 @@ sub CopyContribFiles if ($d eq 'spi'); foreach my $f (split /\s+/,$flist) { - copy('contrib/' . $d . '/' . $f, $target . '/doc/contrib/' . $f) + lcopy('contrib/' . $d . '/' . $f, $target . '/doc/contrib/' . $f) || croak("Could not copy file $f in contrib $d"); print '.'; } @@ -359,7 +369,7 @@ sub CopyIncludeFiles $target . '/include/', 'src/include/', 'postgres_ext.h', 'pg_config.h', 'pg_config_os.h', 'pg_config_manual.h' ); - copy('src/include/libpq/libpq-fs.h', $target . '/include/libpq/') + lcopy('src/include/libpq/libpq-fs.h', $target . '/include/libpq/') || croak 'Could not copy libpq-fs.h'; CopyFiles('Libpq headers', $target . '/include/', 'src/interfaces/libpq/', 'libpq-fe.h'); @@ -374,7 +384,7 @@ sub CopyIncludeFiles $target . '/include/internal/', 'src/include/', 'c.h', 'port.h', 'postgres_fe.h' ); - copy('src/include/libpq/pqcomm.h', $target . '/include/internal/libpq/') + lcopy('src/include/libpq/pqcomm.h', $target . '/include/internal/libpq/') || croak 'Could not copy pqcomm.h'; CopyFiles( diff --git a/src/tools/msvc/build.bat b/src/tools/msvc/build.bat index 48f7757d74..1684d3bec2 100755 --- a/src/tools/msvc/build.bat +++ b/src/tools/msvc/build.bat @@ -1,37 +1,6 @@ @echo off -REM $PostgreSQL: pgsql/src/tools/msvc/build.bat,v 1.9 2007/06/26 11:43:56 mha Exp $ - -SETLOCAL -SET STARTDIR=%CD% -SET CONFIG= -if exist src\tools\msvc\buildenv.bat call src\tools\msvc\buildenv.bat -if exist buildenv.bat call buildenv.bat - -perl mkvcbuild.pl -if errorlevel 1 goto :eof - -if exist ..\msvc if exist ..\..\..\src cd ..\..\.. -set CFG= -if "%1" == "DEBUG" ( - set CONFIG=Debug - set CFG=1 -) -if "%1" == "RELEASE" ( - set CONFIG=Release - set CFG=1 -) -if "%CONFIG%" == "" set CONFIG=Release - -if "%CFG%" == "1" shift - -echo Building %CONFIG% - -if "%1" == "" msbuild pgsql.sln /verbosity:detailed /p:Configuration=%CONFIG% -if not "%1" == "" vcbuild %1.vcproj %CONFIG% -SET E=%ERRORLEVEL% - -cd %STARTDIR% - -REM exit fix for pre-2003 shell especially if used on buildfarm -if "%XP_EXIT_FIX%" == "yes" exit %E% -exit /b %E% +REM $PostgreSQL: pgsql/src/tools/msvc/build.bat,v 1.10 2007/09/27 21:13:11 adunstan Exp $ +REM all the logic for this now belongs in build.pl. This file really +REM only exists so you don't have to type "perl build.pl" +REM Resist any temptation to add any logic here. +@perl build.pl %* diff --git a/src/tools/msvc/getregress.pl b/src/tools/msvc/getregress.pl deleted file mode 100644 index e7f1d24193..0000000000 --- a/src/tools/msvc/getregress.pl +++ /dev/null @@ -1,46 +0,0 @@ -# -# Script that collects a list of regression tests from a Makefile -# -# $PostgreSQL: pgsql/src/tools/msvc/getregress.pl,v 1.2 2007/03/23 10:05:34 mha Exp $ -# -use strict; -use warnings; - -my $M; - -open($M,"; -close($M); - -$m =~ s/\\[\r\n]*//gs; -if ($m =~ /^REGRESS\s*=\s*(.*)$/gm) -{ - my $t = $1; - $t =~ s/\s+/ /g; - - if ($m =~ /contrib\/pgcrypto/) - { - - # pgcrypto is special since the tests depend on the configuration of the build - our $config; - require '../../src/tools/msvc/config.pl'; - - my $cftests = $config->{openssl}?GetTests("OSSL_TESTS",$m):GetTests("INT_TESTS",$m); - my $pgptests = $config->{zlib}?GetTests("ZLIB_TST",$m):GetTests("ZLIB_OFF_TST",$m); - $t =~ s/\$\(CF_TESTS\)/$cftests/; - $t =~ s/\$\(CF_PGP_TESTS\)/$pgptests/; - } - print "SET TESTS=$t"; -} - -sub GetTests -{ - my $testname = shift; - my $m = shift; - if ($m =~ /^$testname\s*=\s*(.*)$/gm) - { - return $1; - } - return ""; -} diff --git a/src/tools/msvc/vcregress.bat b/src/tools/msvc/vcregress.bat index 7b6b9b245f..56b6510d3d 100644 --- a/src/tools/msvc/vcregress.bat +++ b/src/tools/msvc/vcregress.bat @@ -1,128 +1,6 @@ @echo off -REM $PostgreSQL: pgsql/src/tools/msvc/vcregress.bat,v 1.14 2007/08/27 12:10:47 mha Exp $ - -SETLOCAL -SET STARTDIR=%CD% -if exist ..\..\..\src\tools\msvc\vcregress.bat cd ..\..\.. -if exist src\tools\msvc\buildenv.bat call src\tools\msvc\buildenv.bat - -set what= -if /I "%1"=="check" SET what=CHECK -if /I "%1"=="installcheck" SET what=INSTALLCHECK -if /I "%1"=="plcheck" SET what=PLCHECK -if /I "%1"=="contribcheck" SET what=CONTRIBCHECK -if /I "%1"=="ecpgcheck" SET what=ECPGCHECK -if "%what%"=="" goto usage - -SET CONFIG=Debug -if exist release\postgres\postgres.exe SET CONFIG=Release - -copy %CONFIG%\refint\refint.dll contrib\spi\ -copy %CONFIG%\autoinc\autoinc.dll contrib\spi\ -copy %CONFIG%\regress\regress.dll src\test\regress\ - -SET PATH=..\..\..\%CONFIG%\libpq;..\..\%CONFIG%\libpq;%PATH% - -SET TOPDIR=%CD% -cd src\test\regress -SET SCHEDULE=parallel -SET TEMPPORT=54321 -IF NOT "%2"=="" SET SCHEDULE=%2 - -IF "%what%"=="ECPGCHECK" ( - cd "%STARTDIR%" - msbuild ecpg_regression.proj /p:config=%CONFIG% - REM exit fix for pre-2003 shell especially if used on buildfarm - if "%XP_EXIT_FIX%" == "yes" if errorlevel 1 exit 1 - if errorlevel 1 exit /b 1 - cd "%TOPDIR%" - cd src\interfaces\ecpg\test - SET SCHEDULE=ecpg -) - -SET PERL5LIB=%TOPDIR%\src\tools\msvc - -if "%what%"=="INSTALLCHECK" ..\..\..\%CONFIG%\pg_regress\pg_regress --psqldir="..\..\..\%CONFIG%\psql" --schedule=%SCHEDULE%_schedule --multibyte=SQL_ASCII --load-language=plpgsql --no-locale -if "%what%"=="CHECK" ..\..\..\%CONFIG%\pg_regress\pg_regress --psqldir="..\..\..\%CONFIG%\psql" --schedule=%SCHEDULE%_schedule --multibyte=SQL_ASCII --load-language=plpgsql --no-locale --temp-install=./tmp_check --top-builddir="%TOPDIR%" --temp-port=%TEMPPORT% -if "%what%"=="ECPGCHECK" ..\..\..\..\%CONFIG%\pg_regress_ecpg\pg_regress_ecpg --psqldir="..\..\..\%CONFIG%\psql" --dbname=regress1,connectdb --create-role=connectuser,connectdb --schedule=%SCHEDULE%_schedule --multibyte=SQL_ASCII --load-language=plpgsql --no-locale --temp-install=./tmp_check --top-builddir="%TOPDIR%" --temp-port=%TEMPPORT% -if "%what%"=="PLCHECK" call :plcheck -if "%what%"=="CONTRIBCHECK" call :contribcheck -SET E=%ERRORLEVEL% - -cd "%STARTDIR%" -REM exit fix for pre-2003 shell especially if used on buildfarm -if "%XP_EXIT_FIX%" == "yes" exit %E% -exit /b %E% - -:usage -echo "Usage: vcregress [schedule]" -goto :eof - - -REM Check procedural languages -REM Some workarounds due to inconsistently named directories -:plcheck -cd ..\..\PL -FOR /D %%d IN (*) do if exist %%d\sql if exist %%d\expected ( - if exist ..\..\%CONFIG%\%%d call :oneplcheck %%d - REM exit fix for pre-2003 shell especially if used on buildfarm - if "%XP_EXIT_FIX%" == "yes" if errorlevel 1 exit 1 - if errorlevel 1 exit /b 1 - if exist ..\..\%CONFIG%\pl%%d call :oneplcheck %%d - if "%XP_EXIT_FIX%" == "yes" if errorlevel 1 exit 1 - if errorlevel 1 exit /b 1 -) -goto :eof - -REM Check a single procedural language -:oneplcheck -echo ========================================================================== -echo Checking %1 -cd %1 -SET PL=%1 -IF %PL%==plpython SET PL=plpythonu -IF %PL%==tcl SET PL=pltcl - -set TESTS= -perl ../../tools/msvc/getregress.pl > regress.tmp.bat -call regress.tmp.bat -del regress.tmp.bat -..\..\..\%CONFIG%\pg_regress\pg_regress --psqldir=..\..\..\%CONFIG%\psql --no-locale --load-language=%PL% %TESTS% -set E=%ERRORLEVEL% -cd .. -REM exit fix for pre-2003 shell especially if used on buildfarm -if "%XP_EXIT_FIX%" == "yes" exit %E% -exit /b %E% - - -REM Check contrib modules -:contribcheck -cd ..\..\..\contrib -set CONTRIBERROR=0 -for /d %%d IN (*) do if exist %%d\sql if exist %%d\expected if exist %%d\Makefile ( - call :onecontribcheck %%d - if errorlevel 1 set CONTRIBERROR=1 -) -REM exit fix for pre-2003 shell especially if used on buildfarm -if "%XP_EXIT_FIX%" == "yes" if %CONTRIBERROR%==1 exit 1 -if %CONTRIBERROR%==1 exit /b 1 -goto :eof - -REM Check a single contrib module -:onecontribcheck -REM Temporarily exclude tsearch2 tests -if %1==tsearch2 goto :eof -cd %1 - -echo ========================================================================== -echo Checking %1 -set TESTS= -perl ../../src/tools/msvc/getregress.pl > regress.tmp.bat -call regress.tmp.bat -del regress.tmp.bat -..\..\%CONFIG%\pg_regress\pg_regress --psqldir=..\..\%CONFIG%\psql --no-locale --dbname=contrib_regression %TESTS% -set E=%ERRORLEVEL% -cd .. -REM exit fix for pre-2003 shell especially if used on buildfarm -if "%XP_EXIT_FIX%" == "yes" exit %E% -exit /b %E% +REM $PostgreSQL: pgsql/src/tools/msvc/vcregress.bat,v 1.15 2007/09/27 21:13:11 adunstan Exp $ +REM all the logic for this now belongs in vcregress.pl. This file really +REM only exists so you don't have to type "perl vcregress.pl" +REM Resist any temptation to add any logic here. +@perl vcregress.pl %*