summaryrefslogtreecommitdiff
path: root/Build/source/texk/tests
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-06-19 15:12:23 +0000
committerKarl Berry <karl@freefriends.org>2021-06-19 15:12:23 +0000
commitf5b8a6689ffb8d3f30e514b87b7d03b499c4abed (patch)
tree483ccdc67486b795b580fe01bc511fa2698c38f4 /Build/source/texk/tests
parent6e7411fe2762d2b3f27ed693a80eae7f69189b42 (diff)
doc,sync
git-svn-id: svn://tug.org/texlive/trunk@59636 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/tests')
-rw-r--r--Build/source/texk/tests/TeXLive/TLConfig.pm15
-rw-r--r--Build/source/texk/tests/TeXLive/TLUtils.pm118
2 files changed, 111 insertions, 22 deletions
diff --git a/Build/source/texk/tests/TeXLive/TLConfig.pm b/Build/source/texk/tests/TeXLive/TLConfig.pm
index 374d10e7536..e24a368a533 100644
--- a/Build/source/texk/tests/TeXLive/TLConfig.pm
+++ b/Build/source/texk/tests/TeXLive/TLConfig.pm
@@ -1,3 +1,4 @@
+# $Id: TLConfig.pm 59225 2021-05-16 17:41:12Z karl $
# TeXLive::TLConfig.pm - module exporting configuration values
# Copyright 2007-2021 Norbert Preining
# This file is licensed under the GNU General Public License version 2
@@ -5,7 +6,7 @@
package TeXLive::TLConfig;
-my $svnrev = '$Revision: 59122 $';
+my $svnrev = '$Revision: 59225 $';
my $_modulerevision = ($svnrev =~ m/: ([0-9]+) /) ? $1 : "unknown";
sub module_revision { return $_modulerevision; }
@@ -127,10 +128,8 @@ our %FallbackDownloaderArgs = (
'curl' => ['--user-agent', 'texlive/curl',
'--retry', '4', '--retry-delay', '4',
'--connect-timeout', "$NetworkTimeout",
- '--insecure',
'--fail', '--location', '--silent', '--output'],
'wget' => ['--user-agent=texlive/wget', '--tries=4',
- '--no-check-certificate',
"--timeout=$NetworkTimeout", '-q', '-O'],
);
# the way we package things on the web
@@ -278,7 +277,7 @@ our $ChecksumExtension = "sha512";
=head1 NAME
-C<TeXLive::TLConfig> -- TeX Live Configuration module
+C<TeXLive::TLConfig> -- TeX Live configuration parameters
=head1 SYNOPSIS
@@ -289,13 +288,13 @@ C<TeXLive::TLConfig> -- TeX Live Configuration module
The L<TeXLive::TLConfig> module contains definitions of variables
configuring all of TeX Live.
-=over 4
-
-=head1 EXPORTED VARIABLES
+=head2 EXPORTED VARIABLES
All of the following variables are pulled into the callers namespace,
i.e., are declared with C<EXPORT> (and C<EXPORT_OK>).
+=over 4
+
=item C<@TeXLive::TLConfig::MetaCategories>
The list of meta categories, i.e., those categories whose packages only
@@ -378,7 +377,7 @@ C<Master/tlpkg/doc/>.
=head1 AUTHORS AND COPYRIGHT
This script and its documentation were written for the TeX Live
-distribution (L<http://tug.org/texlive>) and both are licensed under the
+distribution (L<https://tug.org/texlive>) and both are licensed under the
GNU General Public License Version 2 or later.
=cut
diff --git a/Build/source/texk/tests/TeXLive/TLUtils.pm b/Build/source/texk/tests/TeXLive/TLUtils.pm
index 79d8818e685..db2ef3421cc 100644
--- a/Build/source/texk/tests/TeXLive/TLUtils.pm
+++ b/Build/source/texk/tests/TeXLive/TLUtils.pm
@@ -1,3 +1,4 @@
+# $Id: TLUtils.pm 59259 2021-05-18 21:39:53Z karl $
# TeXLive::TLUtils.pm - the inevitable utilities for TeX Live.
# Copyright 2007-2021 Norbert Preining, Reinhard Kotucha
# This file is licensed under the GNU General Public License version 2
@@ -5,7 +6,7 @@
package TeXLive::TLUtils;
-my $svnrev = '$Revision: 59149 $';
+my $svnrev = '$Revision: 59259 $';
my $_modulerevision = ($svnrev =~ m/: ([0-9]+) /) ? $1 : "unknown";
sub module_revision { return $_modulerevision; }
@@ -13,7 +14,7 @@ sub module_revision { return $_modulerevision; }
=head1 NAME
-C<TeXLive::TLUtils> - utilities used in TeX Live infrastructure
+C<TeXLive::TLUtils> - TeX Live infrastructure miscellany
=head1 SYNOPSIS
@@ -245,6 +246,12 @@ as argument.
The result is stored in a global variable C<$::_platform_>, and
subsequent calls just return that value.
+As of 2021, C<config.guess> unfortunately requires a shell that
+understands the C<$(...)> construct. This means that on old-enough
+systems, such as Solaris, we have to look for a shell. We use the value
+of the C<CONFIG_SHELL> environment variable if it is set, else
+C</bin/ksh> if it exists, else C</bin/bash> if it exists, else give up.
+
=cut
sub platform {
@@ -254,12 +261,58 @@ sub platform {
} else {
my $config_guess = "$::installerdir/tlpkg/installer/config.guess";
+ # For example, if the disc or reader has hardware problems.
+ die "$0: config.guess script does not exist, goodbye: $config_guess"
+ if ! -r $config_guess;
+
# We cannot rely on #! in config.guess but have to call /bin/sh
# explicitly because sometimes the 'noexec' flag is set in
# /etc/fstab for ISO9660 file systems.
- chomp (my $guessed_platform = `/bin/sh '$config_guess'`);
+ #
+ # In addition, config.guess was (unnecessarily) changed in 2020 by
+ # to use $(...) instead of `...`, although $(...) is not supported
+ # by Solaris /bin/sh (and others). The maintainers have declined
+ # to revert the change, so now every caller of config.guess must
+ # laboriously find a usable shell. Sigh.
+ #
+ my $config_shell = $ENV{"CONFIG_SHELL"} || "/bin/sh";
+ #
+ # check if $(...) is supported:
+ my $paren_cmdout = `'$config_shell' -c 'echo \$(echo foo)' 2>/dev/null`;
+ #warn "paren test out: `$paren_cmdout'.\n";
+ #
+ # The echo command might output a newline (maybe CRLF?) even if
+ # the $(...) fails, so don't just check for non-empty output.
+ # Maybe checking exit status would be better, but maybe not.
+ #
+ if (length ($paren_cmdout) <= 2) {
+ # if CONFIG_SHELL is set to something bad, give up.
+ if ($ENV{"CONFIG_SHELL"}) {
+ die <<END_BAD_CONFIG_SHELL;
+$0: the CONFIG_SHELL environment variable is set to $ENV{CONFIG_SHELL}
+ but this cannot execute \$(...) shell constructs,
+ which is required. Set CONFIG_SHELL to something that works.
+END_BAD_CONFIG_SHELL
+
+ } elsif (-x "/bin/ksh") {
+ $config_shell = "/bin/ksh";
+
+ } elsif (-x "/bin/bash") {
+ $config_shell = "/bin/bash";
- # For example, if the disc or reader has hardware problems.
+ } else {
+ die <<END_NO_PAREN_CMDS_SHELL
+$0: can't find shell to execute $config_guess
+ (which gratuitously requires support for \$(...) command substitution).
+ Tried $config_shell, /bin/ksh, bin/bash.
+ Set the environment variable CONFIG_SHELL to specify explicitly.
+END_NO_PAREN_CMDS_SHELL
+ }
+ }
+ #warn "executing config.guess with $config_shell\n";
+ chomp (my $guessed_platform = `'$config_shell' '$config_guess'`);
+
+ # If we didn't get anything usable, give up.
die "$0: could not run $config_guess, cannot proceed, sorry"
if ! $guessed_platform;
@@ -272,18 +325,23 @@ sub platform {
=item C<platform_name($canonical_host)>
-Convert ORIG_PLATFORM, a canonical host name as returned by
-C<config.guess>, into a TeX Live platform name.
-
-CPU type is determined by a regexp, and any C</^i.86/> name is replaced
-by C<i386>.
+Convert the C<$canonical_host> argument, a system description as
+returned by C<config.guess>, into a TeX Live platform name, that is, a
+name used as a subdirectory of our C<bin/> dir. Our names have the
+form CPU-OS, for example, C<x86_64-linux>.
-For the OS value we need a list because what's returned is not likely to
+We need this because what's returned from C<config.,guess> does not
match our historical names, e.g., C<config.guess> returns C<linux-gnu>
-but we need C<linux>. This list contains old OSs which are no longer
-supported, just in case.
+but we need C<linux>.
-If the environment variable TEXLIVE_OS_NAME is set, it is used as-is.
+The C<CPU> part of our name is always taken from the argument, with
+various transformation.
+
+For the C<OS> part, if the environment variable C<TEXLIVE_OS_NAME> is
+set, it is used as-is. Otherwise we do our best to figure it out.
+
+This function still handles old systems which are no longer supported,
+just in case.
=cut
@@ -2527,6 +2585,23 @@ sub setup_programs {
setup_one(($isWin ? "w32" : "unix"), $defprog,
"$bindir/$dltype/$defprog.$platform", "--version", $tlfirst);
}
+ # check for wget/ssl support
+ if (member("wget", @working_downloaders)) {
+ debug("TLUtils::setup_programs: checking for ssl enabled wget\n");
+ my @lines = `$::progs{'wget'} --version 2>&1`;
+ if (grep(/\+ssl/, @lines)) {
+ $::progs{'options'}{'wget-ssl'} = 1;
+ my @wgetargs = @{$TeXLive::TLConfig::FallbackDownloaderArgs{'wget'}};
+ # can't push new arg at end of list because builtin list ends with
+ # -O to set the output file.
+ unshift (@wgetargs, '--no-check-certificate');
+ $TeXLive::TLConfig::FallbackDownloaderArgs{'wget'} = \@wgetargs;
+ debug("TLUtils::setup_programs: wget has ssl, final wget args: @{$TeXLive::TLConfig::FallbackDownloaderArgs{'wget'}}\n");
+ } else {
+ debug("TLUtils::setup_programs: wget without ssl support found\n");
+ $::progs{'options'}{'wget-ssl'} = 0;
+ }
+ }
$::progs{'working_downloaders'} = [ @working_downloaders ];
my @working_compressors;
for my $defprog (sort
@@ -3927,7 +4002,22 @@ sub query_ctan_mirror {
if (TeXLive::TLUtils::member("curl", @working_downloaders)) {
return query_ctan_mirror_curl();
} elsif (TeXLive::TLUtils::member("wget", @working_downloaders)) {
- return query_ctan_mirror_wget();
+ if ($::progs{'options'}{'wget-ssl'}) {
+ # we need ssl enabled wget to query ctan
+ return query_ctan_mirror_wget();
+ } else {
+ tlwarn(<<END_NO_SSL);
+TLUtils::query_ctan_mirror: neither curl nor an ssl-enabled wget is
+ available, so no CTAN mirror can be resolved via https://mirror.ctan.org.
+
+ Please install curl or ssl-enabled wget; otherwise, please pick an
+ http (not https) mirror from the list at https://ctan.org/mirrors/mirmon.
+
+ To report a bug about this, please rerun your command with -vv and
+ include the resulting output with the report.
+END_NO_SSL
+ return;
+ }
} else {
return;
}