Skip to content

Commit

Permalink
updating installer data
Browse files Browse the repository at this point in the history
  • Loading branch information
norbusan committed Jan 27, 2024
1 parent 829d244 commit 68e5c90
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 38 deletions.
49 changes: 13 additions & 36 deletions install-tl
Original file line number Diff line number Diff line change
Expand Up @@ -1161,21 +1161,8 @@ sub do_installation {

sub run_postinst_cmd {
my ($cmd) = @_;

info ("running $cmd ...");
my ($out,$ret) = TeXLive::TLUtils::run_cmd ("$cmd 2>&1");
if ($ret == 0) {
info ("done\n");
} else {
info ("failed\n");
tlwarn ("$0: $cmd failed (status $ret): $!\n");
$ret = 1; # be sure we don't overflow the sum on anything crazy
}
log ($out);

return $ret;
} # run_postinst_cmd

&TeXLive::TLUtils::run_cmd_with_log ($cmd, \&log);
}

#
# Make texmf.cnf, backup directory, cleanups, path setting, and
Expand Down Expand Up @@ -1351,22 +1338,15 @@ operations might be disturbed.\n\n";
}
}

# lmtx/context setup. The story here is that in 2023, the lmtx binary
# for x86_64-linux was too new to run on the system where we build TL.
# (luametatex: /lib64/libm.so.6: version `GLIBC_2.23' not found)
# So we have to try running it to see it succeeds, not just test for
# the program's existence. And since it exits nonzero given no args,
# we have to specify --version. Hope it keeps working like that ...
my $lmtx = "$plat_bindir/luametatex$progext";
# lmtx/context cache setup, relegated to a common subroutine
# that tlmgr can also call.
if (exists($install{"context"}) && $install{"context"} == 1
&& !exists $ENV{"TEXLIVE_INSTALL_NO_CONTEXT_CACHE"}
&& TeXLive::TLUtils::system_ok("$lmtx --version")
) {
info("setting up ConTeXt cache: ");
$errcount += run_postinst_cmd("mtxrun --generate");
$errcount += run_postinst_cmd("context --luatex --generate");
&& !exists $ENV{"TEXLIVE_INSTALL_NO_CONTEXT_CACHE"}) {
$errcount +=
TeXLive::TLUtils::update_context_cache($plat_bindir, $progext,
\&run_postinst_cmd);
} else {
debug("skipped ConTeXt cache setup\n");
debug("skipped ConTeXt cache setup, not installed or told not to\n");
}

# all formats option
Expand Down Expand Up @@ -2832,21 +2812,18 @@ EOF
# Create a welcome message.
sub create_welcome {
@::welcome_arr = ();
push @::welcome_arr, "\n";
push @::welcome_arr, __("Welcome to TeX Live!");
push @::welcome_arr, "\n";
push @::welcome_arr, __(
"See %s/index.html for links to documentation.\nThe TeX Live web site (https://tug.org/texlive/) contains any updates and corrections. TeX Live is a joint project of the TeX user groups around the world; please consider supporting it by joining the group best for you. The list of groups is available on the web at https://tug.org/usergroups.html.",
$::vars{'TEXDIR'});
push @::welcome_arr, __("See %s/index.html for links to documentation.\n",
$::vars{'TEXDIR'});
push @::welcome_arr, __("The TeX Live web site (https://tug.org/texlive/) provides all updates\nand corrections. TeX Live is a joint project of the TeX user groups\naround the world; please consider supporting it by joining the group\nbest for you. The list of groups is available on the web\nat https://tug.org/usergroups.html.\n");
if (wndws()
|| ($vars{'instopt_adjustpath'}
&& $vars{'tlpdbopt_desktop_integration'} != 2)) {
; # don't tell them to make path adjustments on Windows,
# or if they chose to "create symlinks".
} else {
push @::welcome_arr, "\n";
push @::welcome_arr, __(
"Add %s/texmf-dist/doc/man to MANPATH.\nAdd %s/texmf-dist/doc/info to INFOPATH.\nMost importantly, add %s/bin/%s\nto your PATH for current and future sessions.",
"Add %s/texmf-dist/doc/man to MANPATH.\nAdd %s/texmf-dist/doc/info to INFOPATH.\nMost importantly, add %s/bin/%s\nto your PATH for current and future sessions.\n",
$::vars{'TEXDIR'}, $::vars{'TEXDIR'}, $::vars{'TEXDIR'},
$::vars{'this_platform'});
}
Expand Down
89 changes: 87 additions & 2 deletions tlpkg/TeXLive/TLUtils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ C<TeXLive::TLUtils> - TeX Live infrastructure miscellany
TeXLive::TLUtils::wsystem($msg,@args);
TeXLive::TLUtils::xsystem(@args);
TeXLive::TLUtils::run_cmd($cmd [, @envvars ]);
TeXLive::TLUtils::run_cmd_with_log($cmd, $logfn);
TeXLive::TLUtils::system_pipe($prog, $infile, $outfile, $removeIn, @args);
TeXLive::TLUtils::diskfree($path);
TeXLive::TLUtils::get_user_home();
Expand Down Expand Up @@ -80,6 +81,7 @@ C<TeXLive::TLUtils> - TeX Live infrastructure miscellany
TeXLive::TLUtils::time_estimate($totalsize, $donesize, $starttime)
TeXLive::TLUtils::install_packages($from_tlpdb,$media,$to_tlpdb,$what,$opt_src, $opt_doc, $retry, $continue);
TeXLive::TLUtils::do_postaction($how, $tlpobj, $do_fileassocs, $do_menu, $do_desktop, $do_script);
TeXLive::TLUtils::update_context_cache($plat_bindir);
TeXLive::TLUtils::announce_execute_actions($how, @executes, $what);
TeXLive::TLUtils::add_symlinks($root, $arch, $sys_bin, $sys_man, $sys_info);
TeXLive::TLUtils::remove_symlinks($root, $arch, $sys_bin, $sys_man, $sys_info);
Expand Down Expand Up @@ -246,6 +248,7 @@ BEGIN {
&wsystem
&xsystem
&run_cmd
&run_cmd_with_log
&system_pipe
&diskfree
&get_user_home
Expand Down Expand Up @@ -769,8 +772,9 @@ sub xsystem {

=item C<run_cmd($cmd, @envvars)>
Run shell command C<$cmd> and captures its output. Returns a list with CMD's
output as the first element and the return value (exit code) as second.
Run shell command C<$cmd> and captures its standard output (not standard
error). Returns a list with CMD's output as the first element and its
return value (exit code) as second.
If given, C<@envvars> is a list of environment variable name / value
pairs set in C<%ENV> for the call and reset to their original value (or
Expand Down Expand Up @@ -806,6 +810,34 @@ sub run_cmd {
return ($output,$retval);
}

=item C<run_cmd_with_log($cmd, $logfn)>
Run shell command C<$cmd> and captures both standard output and standard
error (as one string), passing them to C<$logfn>. The return value is
the exit status of C<$cmd>. Environment variable overrides cannot be
passed. (This is used for running special post-installation commands in
install-tl and tlmgr.)
=cut

sub run_cmd_with_log {
my ($cmd,$logfn) = @_;

info ("running $cmd ...");
my ($out,$ret) = TeXLive::TLUtils::run_cmd ("$cmd 2>&1");
if ($ret == 0) {
info ("done\n");
} else {
info ("failed\n");
tlwarn ("$0: $cmd failed (status $ret): $!\n");
$ret = 1; # be sure we don't overflow the sum on anything crazy
}
&$logfn ($out);

return $ret;
} # run_cmd_with_log


=item C<system_pipe($prog, $infile, $outfile, $removeIn, @extraargs)>
Runs C<$prog> with C<@extraargs> redirecting stdin from C<$infile>,
Expand Down Expand Up @@ -2198,6 +2230,10 @@ sub _do_postaction_shortcut {
return 1;
}

=item C<parse_into_keywords>
=cut

sub parse_into_keywords {
my ($str, @keys) = @_;
my @words = quotewords('\s+', 0, $str);
Expand All @@ -2222,6 +2258,55 @@ sub parse_into_keywords {
return($error, %ret);
}

=item C<update_context_cache($bindir,$progext,$run_postinst_cmd)>
Run the ConTeXt cache generation commands, using C<$bindir> and
C<$progext> to check if commands can be run. Use the function reference
C<$run_postinst_cmd> to actually run the commands. The return status is
zero if all succeeded, nonzero otherwise. If the main ConTeXt program
(C<luametatex>) cannot be run at all, the return status is status.
Functions C<info> and C<debug> are called with status reports.
=cut

sub update_context_cache {
my ($bindir,$progext,$run_postinst_cmd) = @_;

my $errcount = 0;

# The story here is that in 2023, the lmtx binary for x86_64-linux was
# too new to run on the system where we build TL. (luametatex:
# /lib64/libm.so.6: version `GLIBC_2.23' not found) So we have to try
# running it to see if it is available, not just test for the
# program's existence. And since it exits nonzero given no args, we
# have to specify --version. Hope it keeps working like that ...
#
# If lmtx is not runnable, don't consider that an error, since nothing
# can be done about it.
my $lmtx = "$bindir/luametatex$progext";
if (TeXLive::TLUtils::system_ok("$lmtx --version")) {
info("setting up ConTeXt cache: ");
$errcount += &$run_postinst_cmd("mtxrun --generate");
#
# If mtxrun failed, don't bother trying more.
if ($errcount == 0) {
$errcount += &$run_postinst_cmd("context --luatex --generate");
#
# If context succeeded too, try luajittex. Missing on some platforms.
if ($errcount == 0) {
my $luajittex = "$bindir/luajittex$progext";
if (TeXLive::TLUtils::system_ok("$luajittex --version")) {
$errcount += &$run_postinst_cmd("context --luajittex --generate");
} else {
debug("skipped luajittex cache setup, can't run $luajittex\n");
}
}
}
}
return $errcount;
}

=item C<announce_execute_actions($how, $tlpobj, $what)>
Announces that the actions given in C<$tlpobj> should be executed
Expand Down

0 comments on commit 68e5c90

Please sign in to comment.