Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3396d1c

Browse files
committed
Turn build and vcregress .bat files into pure one line wrappers for
the perl scripts. Remove the now superfluous getregress.pl.
1 parent aedc5ed commit 3396d1c

File tree

4 files changed

+30
-219
lines changed

4 files changed

+30
-219
lines changed

src/tools/msvc/Install.pm

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package Install;
33
#
44
# Package that provides 'make install' functionality for msvc builds
55
#
6-
# $PostgreSQL: pgsql/src/tools/msvc/Install.pm,v 1.21 2007/09/23 20:32:40 adunstan Exp $
6+
# $PostgreSQL: pgsql/src/tools/msvc/Install.pm,v 1.22 2007/09/27 21:13:11 adunstan Exp $
77
#
88
use strict;
99
use warnings;
@@ -17,6 +17,16 @@ our (@ISA,@EXPORT_OK);
1717
@ISA = qw(Exporter);
1818
@EXPORT_OK = qw(Install);
1919

20+
sub lcopy
21+
{
22+
my $src = shift;
23+
my $target = shift;
24+
25+
unlink $target if -f $target;
26+
27+
copy($src,$target);
28+
}
29+
2030
sub Install
2131
{
2232
$| = 1;
@@ -43,7 +53,7 @@ sub Install
4353
'doc/contrib', 'symbols', 'share/tsearch_data');
4454

4555
CopySolutionOutput($conf, $target);
46-
copy($target . '/lib/libpq.dll', $target . '/bin/libpq.dll');
56+
lcopy($target . '/lib/libpq.dll', $target . '/bin/libpq.dll');
4757
my $sample_files = [];
4858
File::Find::find({wanted =>
4959
sub { /^.*\.sample\z/s &&
@@ -113,7 +123,7 @@ sub CopyFiles
113123
print ".";
114124
$f = $basedir . $f;
115125
die "No file $f\n" if (!-f $f);
116-
copy($f, $target . basename($f))
126+
lcopy($f, $target . basename($f))
117127
|| croak "Could not copy $f to $target". basename($f). " to $target". basename($f) . "\n";
118128
}
119129
print "\n";
@@ -131,7 +141,7 @@ sub CopySetOfFiles
131141
next if /ecpg.test/; # Skip temporary install in regression subdir
132142
my $tgt = $target . basename($_);
133143
print ".";
134-
copy($_, $tgt) || croak "Could not copy $_: $!\n";
144+
lcopy($_, $tgt) || croak "Could not copy $_: $!\n";
135145
}
136146
print "\n";
137147
}
@@ -173,8 +183,8 @@ sub CopySolutionOutput
173183
# Static lib, such as libpgport, only used internally during build, don't install
174184
next;
175185
}
176-
copy("$conf\\$pf\\$pf.$ext","$target\\$dir\\$pf.$ext") || croak "Could not copy $pf.$ext\n";
177-
copy("$conf\\$pf\\$pf.pdb","$target\\symbols\\$pf.pdb") || croak "Could not copy $pf.pdb\n";
186+
lcopy("$conf\\$pf\\$pf.$ext","$target\\$dir\\$pf.$ext") || croak "Could not copy $pf.$ext\n";
187+
lcopy("$conf\\$pf\\$pf.pdb","$target\\symbols\\$pf.pdb") || croak "Could not copy $pf.pdb\n";
178188
print ".";
179189
}
180190
print "\n";
@@ -297,7 +307,7 @@ sub CopyContribFiles
297307
if ($d eq 'spi');
298308
foreach my $f (split /\s+/,$flist)
299309
{
300-
copy('contrib/' . $d . '/' . $f,$target . '/share/contrib/' . basename($f))
310+
lcopy('contrib/' . $d . '/' . $f,$target . '/share/contrib/' . basename($f))
301311
|| croak("Could not copy file $f in contrib $d");
302312
print '.';
303313
}
@@ -315,7 +325,7 @@ sub CopyContribFiles
315325
if ($d eq 'spi');
316326
foreach my $f (split /\s+/,$flist)
317327
{
318-
copy('contrib/' . $d . '/' . $f, $target . '/doc/contrib/' . $f)
328+
lcopy('contrib/' . $d . '/' . $f, $target . '/doc/contrib/' . $f)
319329
|| croak("Could not copy file $f in contrib $d");
320330
print '.';
321331
}
@@ -359,7 +369,7 @@ sub CopyIncludeFiles
359369
$target . '/include/',
360370
'src/include/', 'postgres_ext.h', 'pg_config.h', 'pg_config_os.h', 'pg_config_manual.h'
361371
);
362-
copy('src/include/libpq/libpq-fs.h', $target . '/include/libpq/')
372+
lcopy('src/include/libpq/libpq-fs.h', $target . '/include/libpq/')
363373
|| croak 'Could not copy libpq-fs.h';
364374

365375
CopyFiles('Libpq headers', $target . '/include/', 'src/interfaces/libpq/', 'libpq-fe.h');
@@ -374,7 +384,7 @@ sub CopyIncludeFiles
374384
$target . '/include/internal/',
375385
'src/include/', 'c.h', 'port.h', 'postgres_fe.h'
376386
);
377-
copy('src/include/libpq/pqcomm.h', $target . '/include/internal/libpq/')
387+
lcopy('src/include/libpq/pqcomm.h', $target . '/include/internal/libpq/')
378388
|| croak 'Could not copy pqcomm.h';
379389

380390
CopyFiles(

src/tools/msvc/build.bat

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,6 @@
11
@echo off
2-
REM $PostgreSQL: pgsql/src/tools/msvc/build.bat,v 1.9 2007/06/26 11:43:56 mha Exp $
3-
4-
SETLOCAL
5-
SET STARTDIR=%CD%
6-
SET CONFIG=
7-
if exist src\tools\msvc\buildenv.bat call src\tools\msvc\buildenv.bat
8-
if exist buildenv.bat call buildenv.bat
9-
10-
perl mkvcbuild.pl
11-
if errorlevel 1 goto :eof
12-
13-
if exist ..\msvc if exist ..\..\..\src cd ..\..\..
14-
set CFG=
15-
if "%1" == "DEBUG" (
16-
set CONFIG=Debug
17-
set CFG=1
18-
)
19-
if "%1" == "RELEASE" (
20-
set CONFIG=Release
21-
set CFG=1
22-
)
23-
if "%CONFIG%" == "" set CONFIG=Release
24-
25-
if "%CFG%" == "1" shift
26-
27-
echo Building %CONFIG%
28-
29-
if "%1" == "" msbuild pgsql.sln /verbosity:detailed /p:Configuration=%CONFIG%
30-
if not "%1" == "" vcbuild %1.vcproj %CONFIG%
31-
SET E=%ERRORLEVEL%
32-
33-
cd %STARTDIR%
34-
35-
REM exit fix for pre-2003 shell especially if used on buildfarm
36-
if "%XP_EXIT_FIX%" == "yes" exit %E%
37-
exit /b %E%
2+
REM $PostgreSQL: pgsql/src/tools/msvc/build.bat,v 1.10 2007/09/27 21:13:11 adunstan Exp $
3+
REM all the logic for this now belongs in build.pl. This file really
4+
REM only exists so you don't have to type "perl build.pl"
5+
REM Resist any temptation to add any logic here.
6+
@perl build.pl %*

src/tools/msvc/getregress.pl

Lines changed: 0 additions & 46 deletions
This file was deleted.

src/tools/msvc/vcregress.bat

Lines changed: 5 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -1,128 +1,6 @@
11
@echo off
2-
REM $PostgreSQL: pgsql/src/tools/msvc/vcregress.bat,v 1.14 2007/08/27 12:10:47 mha Exp $
3-
4-
SETLOCAL
5-
SET STARTDIR=%CD%
6-
if exist ..\..\..\src\tools\msvc\vcregress.bat cd ..\..\..
7-
if exist src\tools\msvc\buildenv.bat call src\tools\msvc\buildenv.bat
8-
9-
set what=
10-
if /I "%1"=="check" SET what=CHECK
11-
if /I "%1"=="installcheck" SET what=INSTALLCHECK
12-
if /I "%1"=="plcheck" SET what=PLCHECK
13-
if /I "%1"=="contribcheck" SET what=CONTRIBCHECK
14-
if /I "%1"=="ecpgcheck" SET what=ECPGCHECK
15-
if "%what%"=="" goto usage
16-
17-
SET CONFIG=Debug
18-
if exist release\postgres\postgres.exe SET CONFIG=Release
19-
20-
copy %CONFIG%\refint\refint.dll contrib\spi\
21-
copy %CONFIG%\autoinc\autoinc.dll contrib\spi\
22-
copy %CONFIG%\regress\regress.dll src\test\regress\
23-
24-
SET PATH=..\..\..\%CONFIG%\libpq;..\..\%CONFIG%\libpq;%PATH%
25-
26-
SET TOPDIR=%CD%
27-
cd src\test\regress
28-
SET SCHEDULE=parallel
29-
SET TEMPPORT=54321
30-
IF NOT "%2"=="" SET SCHEDULE=%2
31-
32-
IF "%what%"=="ECPGCHECK" (
33-
cd "%STARTDIR%"
34-
msbuild ecpg_regression.proj /p:config=%CONFIG%
35-
REM exit fix for pre-2003 shell especially if used on buildfarm
36-
if "%XP_EXIT_FIX%" == "yes" if errorlevel 1 exit 1
37-
if errorlevel 1 exit /b 1
38-
cd "%TOPDIR%"
39-
cd src\interfaces\ecpg\test
40-
SET SCHEDULE=ecpg
41-
)
42-
43-
SET PERL5LIB=%TOPDIR%\src\tools\msvc
44-
45-
if "%what%"=="INSTALLCHECK" ..\..\..\%CONFIG%\pg_regress\pg_regress --psqldir="..\..\..\%CONFIG%\psql" --schedule=%SCHEDULE%_schedule --multibyte=SQL_ASCII --load-language=plpgsql --no-locale
46-
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%
47-
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%
48-
if "%what%"=="PLCHECK" call :plcheck
49-
if "%what%"=="CONTRIBCHECK" call :contribcheck
50-
SET E=%ERRORLEVEL%
51-
52-
cd "%STARTDIR%"
53-
REM exit fix for pre-2003 shell especially if used on buildfarm
54-
if "%XP_EXIT_FIX%" == "yes" exit %E%
55-
exit /b %E%
56-
57-
:usage
58-
echo "Usage: vcregress <check|installcheck|plcheck|contribcheck|ecpgcheck> [schedule]"
59-
goto :eof
60-
61-
62-
REM Check procedural languages
63-
REM Some workarounds due to inconsistently named directories
64-
:plcheck
65-
cd ..\..\PL
66-
FOR /D %%d IN (*) do if exist %%d\sql if exist %%d\expected (
67-
if exist ..\..\%CONFIG%\%%d call :oneplcheck %%d
68-
REM exit fix for pre-2003 shell especially if used on buildfarm
69-
if "%XP_EXIT_FIX%" == "yes" if errorlevel 1 exit 1
70-
if errorlevel 1 exit /b 1
71-
if exist ..\..\%CONFIG%\pl%%d call :oneplcheck %%d
72-
if "%XP_EXIT_FIX%" == "yes" if errorlevel 1 exit 1
73-
if errorlevel 1 exit /b 1
74-
)
75-
goto :eof
76-
77-
REM Check a single procedural language
78-
:oneplcheck
79-
echo ==========================================================================
80-
echo Checking %1
81-
cd %1
82-
SET PL=%1
83-
IF %PL%==plpython SET PL=plpythonu
84-
IF %PL%==tcl SET PL=pltcl
85-
86-
set TESTS=
87-
perl ../../tools/msvc/getregress.pl > regress.tmp.bat
88-
call regress.tmp.bat
89-
del regress.tmp.bat
90-
..\..\..\%CONFIG%\pg_regress\pg_regress --psqldir=..\..\..\%CONFIG%\psql --no-locale --load-language=%PL% %TESTS%
91-
set E=%ERRORLEVEL%
92-
cd ..
93-
REM exit fix for pre-2003 shell especially if used on buildfarm
94-
if "%XP_EXIT_FIX%" == "yes" exit %E%
95-
exit /b %E%
96-
97-
98-
REM Check contrib modules
99-
:contribcheck
100-
cd ..\..\..\contrib
101-
set CONTRIBERROR=0
102-
for /d %%d IN (*) do if exist %%d\sql if exist %%d\expected if exist %%d\Makefile (
103-
call :onecontribcheck %%d
104-
if errorlevel 1 set CONTRIBERROR=1
105-
)
106-
REM exit fix for pre-2003 shell especially if used on buildfarm
107-
if "%XP_EXIT_FIX%" == "yes" if %CONTRIBERROR%==1 exit 1
108-
if %CONTRIBERROR%==1 exit /b 1
109-
goto :eof
110-
111-
REM Check a single contrib module
112-
:onecontribcheck
113-
REM Temporarily exclude tsearch2 tests
114-
if %1==tsearch2 goto :eof
115-
cd %1
116-
117-
echo ==========================================================================
118-
echo Checking %1
119-
set TESTS=
120-
perl ../../src/tools/msvc/getregress.pl > regress.tmp.bat
121-
call regress.tmp.bat
122-
del regress.tmp.bat
123-
..\..\%CONFIG%\pg_regress\pg_regress --psqldir=..\..\%CONFIG%\psql --no-locale --dbname=contrib_regression %TESTS%
124-
set E=%ERRORLEVEL%
125-
cd ..
126-
REM exit fix for pre-2003 shell especially if used on buildfarm
127-
if "%XP_EXIT_FIX%" == "yes" exit %E%
128-
exit /b %E%
2+
REM $PostgreSQL: pgsql/src/tools/msvc/vcregress.bat,v 1.15 2007/09/27 21:13:11 adunstan Exp $
3+
REM all the logic for this now belongs in vcregress.pl. This file really
4+
REM only exists so you don't have to type "perl vcregress.pl"
5+
REM Resist any temptation to add any logic here.
6+
@perl vcregress.pl %*

0 commit comments

Comments
 (0)