From ec738ee7ddadcc3854de750b368d2bbe6c400d8f Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 23 May 2022 08:53:28 +0900 Subject: Finalize --texuserdir option, add debug stuff --- Master/install-tl | 55 ++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 9 deletions(-) diff --git a/Master/install-tl b/Master/install-tl index bebf21feb26..43fb7271bd7 100755 --- a/Master/install-tl +++ b/Master/install-tl @@ -300,7 +300,7 @@ my $opt_continue = 1; my $opt_interactive = 1; my $opt_paper = ""; my $opt_texdir = ""; -my $opt_userdir = ""; +my $opt_texuserdir = ""; my %pathopts; # unusual cases: $::opt_select_repository = 0; @@ -309,6 +309,7 @@ our $opt_in_place = 0; my $opt_verify_downloads; # debug options my $opt_debug_fakenet = 0; +my $opt_debug_setup_vars = 1; # show all options even those not relevant for that arch $::opt_all_options = 0; @@ -380,6 +381,7 @@ GetOptions( "custom-bin=s" => \$opt_custom_bin, "debug-translation" => \$::debug_translation, "debug-fakenet" => \$opt_debug_fakenet, + "debug-setup-vars" => \$opt_debug_setup_vars, "fancyselector", "force-platform|force-arch=s" => \$opt_force_arch, "gui:s" => \$opt_gui, @@ -492,7 +494,8 @@ die "$0: Options init-from-profile and in-place are incompatible.\n" if ($opt_in_place && $opt_init_from_profile); die "$0: Options texuserdir and any of texmfhome, texmfconfig, texmfvar are incompatible.\n" - if ($texuserdir && "$texmfhome$texmfconfig$texmfvar"); + if ($opt_texuserdir && + ($pathopts{'texmfhome'} || $pathopts{'texmfvar'} || $pathopts{'texmfconfig'})); if ($#ARGV >= 0) { die "$0: Extra arguments `@ARGV'; try --help if you need it.\n"; @@ -1614,12 +1617,17 @@ sub set_platforms_supported { # TEXLIVE_INSTALL_TEXMFCONFIG ~/.texlive2010/texmf-config sub set_var_from_alternatives { - my ($whatref, @alternatives) = @_; + my ($what, $whatref, @alternatives) = @_; + my @alt_text; + for my $i (@alternatives) { + push @alt_text, ($i ? $i : "undef") + } my $final; while (@alternatives) { my $el = pop @alternatives; $final = $el if ($el); } + debug("setting $what to $final from @alt_text\n"); $$whatref = $final; } @@ -1633,12 +1641,23 @@ sub set_standard_var { $nrdefs{$vars{$what}} = 1 if ($vars{$what}); $nrdefs{$envvar} = 1 if ($envvar); $nrdefs{$cmdlinevar} = 1 if ($cmdlinevar); + # texmfhome/texmfvar/texmfconfig have actually been set by + # via $opt_texuserdir/.... + # So warn about this + my $actual_cmdline_str = $cmdlinestr; + my $actual_cmdline_var = $cmdlinevar; + if ($opt_texuserdir) { + if ($cmdlinestr eq "texmfhome" || $cmdlinestr eq "texmfvar" || $cmdlinestr eq "texmfconfig") { + $actual_cmdline_str = "opt_texuserdir"; + $actual_cmdline_var = $opt_texuserdir; + } + } if (scalar keys %nrdefs > 1) { # multiple conflicting definitions, fail! tlwarn("Trying to define $what via conflicting settings:\n"); tlwarn(" from envvar $envstr = $envvar\n") if ($envvar); tlwarn(" from profile = $vars{$what}\n") if ($vars{$what}); - tlwarn(" from command line argument $cmdlinestr = $cmdlinevar\n") if ($cmdlinevar); + tlwarn(" from command line argument $actual_cmdline_str = $actual_cmdline_var\n") if ($actual_cmdline_var); tlwarn(" Preferring the last value from above!\n"); # actual preference order is given via the below call } @@ -1646,10 +1665,10 @@ sub set_standard_var { # - some default # - setting from profile saved already in $vars{$what} # - environment variable - set_var_from_alternatives( \$vars{$what}, + set_var_from_alternatives( $what, \$vars{$what}, + $cmdlinevar, $vars{$what}, $envvar, - $cmdlinevar, $default); } @@ -1657,6 +1676,15 @@ sub set_texlive_default_dirs { my $homedir = (platform() =~ m/darwin/) ? "~/Library" : "~"; my $yyyy = $TeXLive::TLConfig::ReleaseYear; # + # We already checked that either $opt_texuserdir xor at least one of the + # direct (texmfhome, texmfvar, texmfconfig) is set. In case that + # $opt_texuserdir is set, assign the respective values to texmfhome etc + if ($opt_texuserdir) { + $pathopts{'texmfhome'} = "$opt_texuserdir/texmf"; + $pathopts{'texmfvar'} = "$opt_texuserdir/texmf-var"; + $pathopts{'texmfconfig'} = "$opt_texuserdir/texmf-config"; + } + # # Sources of target directory settings # - env variable TEXLIVE_INSTALL_PREFIX # will be used with YYYY (in portable case without) @@ -1690,13 +1718,13 @@ sub set_texlive_default_dirs { } # first set $tex_prefix my $tex_prefix; - set_var_from_alternatives( \$tex_prefix, + set_var_from_alternatives( "TEX_PREFIX", \$tex_prefix, ($opt_in_place ? abs_path($::installerdir) : undef), $tlprefixenv, (win32() ? getenv('SystemDrive') . '/texlive' : '/usr/local/texlive')); - set_var_from_alternatives( \$vars{'TEXDIR'}, - $vars{'TEXDIR'}, + set_var_from_alternatives( "TEXDIR", \$vars{'TEXDIR'}, $opt_texdir, + $vars{'TEXDIR'}, ($vars{'instopt_portable'} || $opt_in_place) ? $tex_prefix : "$tex_prefix/$texlive_release"); set_standard_var('TEXMFSYSVAR', 'TEXLIVE_INSTALL_TEXMFSYSVAR', 'texmfsysvar', @@ -1722,6 +1750,15 @@ sub set_texlive_default_dirs { $vars{'TEXMFVAR'} = "\$TEXMFSYSVAR"; $vars{'TEXMFCONFIG'} = "\$TEXMFSYSCONFIG"; } + + # terminate here if we debug only setting variables + if ($opt_debug_setup_vars) { + print "Final values from setup of paths:\n"; + for my $i (qw/TEXDIR TEXMFSYSVAR TEXMFSYSCONFIG TEXMFHOME TEXMFVAR TEXMFCONFIG TEXMFLOCAL/) { + print "$i = $vars{$i}\n"; + } + exit(1); + } } # set_texlive_default_dirs sub calc_depends { -- cgit v1.2.3