Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb9d70ef

Browse files
committed
Improve setup of environment values for commands in MSVC's vcregress.pl
The current setup assumes that commands for lz4, zstd and gzip alwaysexist by default if not enforced by a user's environment. However,vcpkg, as one example, installs libraries but no binaries, so thisdefault setup to assume that a command should always be present wouldcause failures. This commit improves the detection of such externalcommands as follows:* If a ENV value is available, trust the environment/user and use it.* If a ENV value is not available, check its execution by looking in thecurrent PATH, by launching a simple "$command --version" (that should beportable enough).** On execution failure, ignore ENV{command}.** On execution success, set ENV{command} = "$command".Note that this new rule applies to gzip, lz4 and zstd but not tar thatwe assume will always exist. Those commands are set up in theenvironment only when using bincheck and taptest. The CI includes allthose commands and I have checked that their setup is correct there. Ihave also tested this change in a MSVC environment where we have none ofthose commands.While on it, remove the references to lz4 from the documentation andvcregress.pl in ~v13. --with-lz4 has been added in v14~ so there is nopoint to have this information in these older branches.Reported-by: Andrew DunstanReviewed-by: Andrew DunstanDiscussion:https://postgr.es/m/14402151-376b-a57a-6d0c-10ad12608e12@dunslane.netBackpatch-through: 10
1 parentaf9b967 commitb9d70ef

File tree

2 files changed

+37
-12
lines changed

2 files changed

+37
-12
lines changed

‎doc/src/sgml/install-windows.sgml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -511,15 +511,6 @@ $ENV{PERL5LIB}=$ENV{PERL5LIB} . ';c:\IPC-Run-0.94\lib';
511511
</para></listitem>
512512
</varlistentry>
513513

514-
<varlistentry>
515-
<term><varname>LZ4</varname></term>
516-
<listitem><para>
517-
Path to a <application>lz4</application> command. The default is
518-
<literal>lz4</literal>, that would be the command found in
519-
<varname>PATH</varname>.
520-
</para></listitem>
521-
</varlistentry>
522-
523514
<varlistentry>
524515
<term><varname>TAR</varname></term>
525516
<listitem><para>

‎src/tools/msvc/vcregress.pl

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use File::Copy;
1313
use File::Find ();
1414
use File::Pathqw(rmtree);
15+
use File::Specqw(devnull);
1516

1617
use FindBin;
1718
use lib$FindBin::RealBin;
@@ -28,11 +29,13 @@
2829
do'./src/tools/msvc/config_default.pl';
2930
do'./src/tools/msvc/config.pl'if (-f'src/tools/msvc/config.pl');
3031

32+
my$devnull = File::Spec->devnull;
33+
3134
# These values are defaults that can be overridden by the calling environment
32-
# (see buildenv.pl processing below).
35+
# (see buildenv.pl processing below). We assume that the ones listed here
36+
# always exist by default. Other values may optionally be set for bincheck
37+
# or taptest, see set_command_env() below.
3338
# c.f. src/Makefile.global.in and configure.ac
34-
$ENV{GZIP_PROGRAM} ||='gzip';
35-
$ENV{LZ4} ||='lz4';
3639
$ENV{TAR} ||='tar';
3740

3841
# buildenv.pl is for specifying the build environment settings
@@ -116,6 +119,32 @@
116119

117120
########################################################################
118121

122+
# Helper function for set_command_env, to set one environment command.
123+
subset_single_env
124+
{
125+
my$envname =shift;
126+
my$envdefault =shift;
127+
128+
# If a command is defined by the environment, just use it.
129+
returnif (defined($ENV{$envname}));
130+
131+
# Nothing is defined, so attempt to assign a default. The command
132+
# may not be in the current environment, hence check if it can be
133+
# executed.
134+
my$rc =system("$envdefault --version >$devnull 2>&1");
135+
136+
# Set the environment to the default if it exists, else leave it.
137+
$ENV{$envname} =$envdefaultif$rc == 0;
138+
return;
139+
}
140+
141+
# Set environment values for various command types. These can be used
142+
# in the TAP tests.
143+
subset_command_env
144+
{
145+
set_single_env('GZIP_PROGRAM','gzip');
146+
}
147+
119148
subinstallcheck_internal
120149
{
121150
my ($schedule,@EXTRA_REGRESS_OPTS) =@_;
@@ -244,6 +273,8 @@ sub bincheck
244273
{
245274
InstallTemp();
246275

276+
set_command_env();
277+
247278
my$mstat = 0;
248279

249280
# Find out all the existing TAP tests by looking for t/ directories
@@ -277,6 +308,9 @@ sub taptest
277308
push(@args,"$topdir/$dir");
278309

279310
InstallTemp();
311+
312+
set_command_env();
313+
280314
my$status = tap_check(@args);
281315
exit$statusif$status;
282316
return;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp