From 9167358afb2bd622448cf97615899cba00556bc5 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Fri, 3 Jul 2009 15:27:37 +0000 Subject: the "Tokyo-Vienna-cramped-flight-commit": - unify installer keys of the %vars hash to always use option_ prefix if it is an option - unify the layout of things in 00texlive.installation so that user settable things look like opt_$key:vallue, and internal things setting_$key:vale - add list of supported options to TLConfig, with type definitions - use a unified option call $tlpdb->option($key [, $value, $value]) instead of many different $tlpdb->option_foo_bar - adapt install-tl, uninstall-w32, tlmgr, tlpkg/bin, TeXLive::*, installer plugins, to use this new function instead - make the setting_platform:XXXXX (formerly platform:XXXXX) in 00texlive.installation only optional. It is not saved into the TLPDB if the *default* platform as returned by TeXLive::TLUtils::platform() (thus calling config.guess on unix). Only if you override the platform in the installer with -force-arch then this value is set in the TLPDB - implement TLMedia->platform that checks first the included TLPDB for option("platform"), and if that is not given determines the platform using TLUtils::platform(). - move the add_symlinks and remove_symlinks from TLPDB to TLMedia - sanatize the installer modules: perltk is now equivalent to text - tlmgr: . output of tlmgr option [show] does now show all the set options, but ignores irrelevant ones for the respective platform (sys_bin/man/info for win32, desktop_integration etc for unix) . option handling rewritten in a general way so that we only have to add new options to TLConfig::%TLPDBOptionXXXXX . setting an option is verified against the types of the options . implement tlmgr option showall that shows also options that are currently not set/saved in the TLPDB - TLUtils: honor the w32_multi_user setting also for shortcuts and menu items - tlmgrgui: . implement support for most options that are set in the TLPDB . add buttons to remove/add symlinks git-svn-id: svn://tug.org/texlive/trunk@14083 c570f23f-e606-0410-a88d-b1316a301751 --- Master/install-tl | 102 +++--- Master/texmf/scripts/texlive/tlmgr.pl | 366 +++++++++------------ .../texmf/scripts/texlive/tlmgrgui/gui-config.pl | 164 +++++---- Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui.pl | 15 +- Master/texmf/scripts/texlive/uninstall-win32.pl | 13 +- Master/tlpkg/TeXLive/TLConfig.pm | 73 ++++ Master/tlpkg/TeXLive/TLMedia.pm | 168 +++++++++- Master/tlpkg/TeXLive/TLPDB.pm | 350 +++++++------------- Master/tlpkg/bin/tl-update-tlnet | 2 +- Master/tlpkg/bin/tl-update-tlpdb | 3 +- Master/tlpkg/bin/tlpsrc2tlpdb | 3 +- Master/tlpkg/installer/install-menu-perltk.pl | 12 +- Master/tlpkg/installer/install-menu-text.pl | 40 +-- Master/tlpkg/installer/install-menu-wizard.pl | 16 +- Master/tlpkg/installer/install-translations.pl | 1 + Master/tlpkg/installer/installer-options.txt | 72 ++-- Master/tlpkg/tlpsrc/00texlive.installation.tlpsrc | 16 +- 17 files changed, 796 insertions(+), 620 deletions(-) diff --git a/Master/install-tl b/Master/install-tl index de7daf156d4..7f70d6f9a7f 100755 --- a/Master/install-tl +++ b/Master/install-tl @@ -123,10 +123,10 @@ our @collections_lang_doc; # $tlpdb->option_XXXXX # settings (i.e., taken from tlpkg/tlpsrc/00texlive.installation.tlpsrc # -# 'option_symlinks' => 0, -# 'sys_bin' => '/usr/local/bin', -# 'sys_man' => '/usr/local/man', -# 'sys_info' => '/usr/local/info', +# 'option_path' => 0, +# 'option_sys_bin' => '/usr/local/bin', +# 'option_sys_man' => '/usr/local/man', +# 'option_sys_info' => '/usr/local/info', # 'option_doc' => 1, # 'option_src' => 1, # 'option_fmt' => 0, @@ -364,7 +364,7 @@ if ($location =~ m!^(ctan$|(http|ftp)://)!i) { $media = 'NET'; } } -info("Installing from: $location\n"); +info("Installing TeX Live $TeXLive::TLConfig::ReleaseYear from: $location\n"); if (defined($opt_force_arch)) { tlwarn("Overriding platform to $opt_force_arch\n"); @@ -1122,22 +1122,22 @@ sub load_tlpdb { die "$0: Could not load TeX Live Database from $master, goodbye.\n"; } # set the defaults to what is specified in the tlpdb - $vars{'option_doc'} = $tlpdb->option_install_docfiles; - $vars{'option_src'} = $tlpdb->option_install_srcfiles; - $vars{'option_fmt'} = $tlpdb->option_create_formats; - $vars{'option_letter'} = defined($tlpdb->option_paper) - && ($tlpdb->option_paper eq "letter" ? 1 : 0); - $vars{'option_desktop_integration'} = $tlpdb->option_desktop_integration; + $vars{'option_doc'} = $tlpdb->option("install_docfiles"); + $vars{'option_src'} = $tlpdb->option("install_srcfiles"); + $vars{'option_fmt'} = $tlpdb->option("create_formats"); + $vars{'option_letter'} = defined($tlpdb->option("paper")) + && ($tlpdb->option("paper") eq "letter" ? 1 : 0); + $vars{'option_desktop_integration'} = $tlpdb->option("desktop_integration"); $vars{'option_desktop_integration'} = 1 if win32(); - $vars{'option_path'} = $tlpdb->option_path; + $vars{'option_path'} = $tlpdb->option("path"); $vars{'option_path'} = 1 if win32(); - $vars{'option_w32_multi_user'} = $tlpdb->option_w32_multi_user; - $vars{'option_file_assocs'} = $tlpdb->option_file_assocs; + $vars{'option_w32_multi_user'} = $tlpdb->option("w32_multi_user"); + $vars{'option_file_assocs'} = $tlpdb->option("file_assocs"); # $vars{'option_file_assocs'} = 1 if win32(); - $vars{'option_post_code'} = $tlpdb->option_post_code; - $vars{'sys_bin'} = $tlpdb->option_sys_bin; - $vars{'sys_man'} = $tlpdb->option_sys_man; - $vars{'sys_info'} = $tlpdb->option_sys_info; + $vars{'option_post_code'} = $tlpdb->option("post_code"); + $vars{'option_sys_bin'} = $tlpdb->option("sys_bin"); + $vars{'option_sys_man'} = $tlpdb->option("sys_man"); + $vars{'option_sys_info'} = $tlpdb->option("sys_info"); # check that the default scheme is actually present, otherwise switch to # scheme-minimal @@ -1245,11 +1245,6 @@ sub create_profile { if $key=~/^collection/ and $vars{$key}==1; print $fh "$key $vars{$key}\n" if $key =~ /^option_/; print $fh "$key $vars{$key}\n" if (($key =~ /^binary_/) && $vars{$key}); - if ($vars{'option_desktop_integration'} && unix()) { - print $fh "sys_bin ", $vars{'sys_bin'}, "\n" if $key =~ /^sys_bin/; - print $fh "sys_man ", $vars{'sys_man'}, "\n" if $key =~ /^sys_man/; - print $fh "sys_info ", $vars{'sys_info'}, "\n" if $key =~ /^sys_info/; - } print $fh "$key $vars{$key}\n" if $key=~/^TEXDIR/; # includes TEXDIRW print $fh "$key $vars{$key}\n" if $key=~/^TEXMFSYSVAR/; print $fh "$key $vars{$key}\n" if $key=~/^TEXMFSYSCONFIG/; @@ -1339,20 +1334,17 @@ sub do_install_packages { # into the local tlpdb: # - should links be set, and if yes, the destination (bin,man,info) sub save_options_into_tlpdb { - $localtlpdb->option_platform($::_platform_); - $localtlpdb->option_location($location); - $localtlpdb->option_paper($vars{'option_letter'} ? "letter" : "a4"); - $localtlpdb->option_create_formats($vars{'option_fmt'} ? "1" : "0"); - $localtlpdb->option_desktop_integration($vars{'option_desktop_integration'} ? "1" : "0"); - $localtlpdb->option_file_assocs($vars{'option_file_assocs'} ? "1" : "0"); - $localtlpdb->option_path($vars{'option_path'} ? "1" : "0"); - $localtlpdb->option_post_code($vars{'option_post_code'} ? "1" : "0"); - $localtlpdb->option_w32_multi_user($vars{'option_w32_multi_user'} ? "1" : "0"); - $localtlpdb->option_sys_bin($vars{'sys_bin'}); - $localtlpdb->option_sys_info($vars{'sys_info'}); - $localtlpdb->option_sys_man($vars{'sys_man'}); - $localtlpdb->option_install_docfiles($vars{'option_doc'} ? "1" : "0"); - $localtlpdb->option_install_srcfiles($vars{'option_src'} ? "1" : "0"); + $localtlpdb->option ("location", $location); + $localtlpdb->option ("create_formats", $vars{'option_fmt'} ? "1" : "0"); + $localtlpdb->option ("desktop_integration", $vars{'option_desktop_integration'} ? "1" : "0"); + $localtlpdb->option ("file_assocs", $vars{'option_file_assocs'} ? "1" : "0"); + $localtlpdb->option ("post_code", $vars{'option_post_code'} ? "1" : "0"); + $localtlpdb->option ("sys_bin", $vars{'option_sys_bin'}); + $localtlpdb->option ("sys_info", $vars{'option_sys_info'}); + $localtlpdb->option ("sys_man", $vars{'option_sys_man'}); + $localtlpdb->option ("install_docfiles", $vars{'option_doc'} ? "1" : "0"); + $localtlpdb->option ("install_srcfiles", $vars{'option_src'} ? "1" : "0"); + $localtlpdb->option ("w32_multi_user", $vars{'option_w32_multi_user'} ? "1" : "0"); my @archs; foreach (keys %vars) { if (m/^binary_(.*)$/ ) { @@ -1362,7 +1354,12 @@ sub save_options_into_tlpdb { if ($opt_custom_bin) { push @archs, "custom"; } - $localtlpdb->option_available_architectures(@archs); + + # only if we forced the platform we do save this option into the tlpdb + if (defined($opt_force_arch)) { + $localtlpdb->setting ("platform", $::_platform_); + } + $localtlpdb->setting("available_architectures", @archs); $localtlpdb->save() unless $vars{'from_dvd'}; } @@ -1407,38 +1404,33 @@ sub import_settings_from_old_tlpdb { # set the defaults to what is specified in the tlpdb $vars{'option_doc'} = $previoustlpdb->option_pkg("00texlive-installation.config", - "opt_install_docfiles"); + "install_docfiles"); $vars{'option_src'} = $previoustlpdb->option_pkg("00texlive-installation.config", - "opt_install_srcfiles"); + "install_srcfiles"); $vars{'option_fmt'} = $previoustlpdb->option_pkg("00texlive-installation.config", - "opt_create_formats"); - my $tmp = $previoustlpdb->option_pkg("00texlive-installation.config", - "opt_paper"); - $vars{'option_letter'} = defined($tmp) && ($tmp eq "letter" ? 1 : 0); + "create_formats"); $vars{'option_desktop_integration'} = 1 if win32(); # option_path does not exist in older installation $vars{'option_path'} = $previoustlpdb->option_pkg("00texlive-installation.config", - "opt_create_symlinks"); + "create_symlinks"); $vars{'option_path'} = 1 if win32(); - $vars{'sys_bin'} = + $vars{'option_sys_bin'} = $previoustlpdb->option_pkg("00texlive-installation.config", - "opt_sys_bin"); - $vars{'sys_man'} = + "sys_bin"); + $vars{'option_sys_man'} = $previoustlpdb->option_pkg("00texlive-installation.config", - "opt_sys_man"); + "sys_man"); $vars{'sys_info'} = $previoustlpdb->option_pkg("00texlive-installation.config", - "opt_sys_info"); + "sys_info"); # # import the set of selected architectures - my $val = $previoustlpdb->option_pkg("00texlive-installation.config", - "available_architectures"); - my @aar; - if (defined($val)) { - @aar = split(" ", $val); + my @aar = $previoustlpdb->setting_pkg("00texlive-installation.config", + "available_architectures"); + if (@aar) { for my $b ($tlpdb->available_architectures) { $vars{"binary_$b"} = member( $b, @aar ); } diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl index 23368a4f323..397c95ae950 100755 --- a/Master/texmf/scripts/texlive/tlmgr.pl +++ b/Master/texmf/scripts/texlive/tlmgr.pl @@ -9,10 +9,6 @@ # - in GUI mode updating texlive.infra DOES work without # the warning, but it does NOT force to restart the GUI. THAT IS BAD!!! # -# - when tlmgr2.pl is shipped globally as tlmgr.pl we can switch the -# installer from using either texconfig paper or texlua ... to -# tlmgr paper letter which will work on all platforms transparently. -# # - tlmgr should have a "progress" bar for the update --all and install # etc options, echoing number of total packages etc etc. # @@ -52,6 +48,7 @@ BEGIN { # if not in bootstrapping mode => kpsewhich exists, so use it to get $Master chomp($Master = `kpsewhich -var-value=SELFAUTOPARENT`); } + $::installerdir = $Master; # # make Perl find our packages first: @@ -209,7 +206,6 @@ if (defined($action) && ($action =~ m/^help/i)) { } if (defined($action) && ($action =~ m/^print-arch$/i)) { - $::installerdir = $Master; print TeXLive::TLUtils::platform(), "\n"; exit 0; } @@ -483,7 +479,7 @@ sub handle_execute_actions { # format-regenerate is used when the paper size changes. In that - # case, if option_create_formats is set, we simply want to generate + # case, if option("create_formats") is set, we simply want to generate # { my %done_formats; @@ -506,7 +502,7 @@ sub handle_execute_actions { for my $m (keys %{$::execute_actions{'disable'}{'formats'}}) { $do_full = 1; } - my $opt_fmt = $localtlpdb->option_create_formats; + my $opt_fmt = $localtlpdb->option("create_formats"); if ($do_full) { info("regenerating fmtutil.cnf in $TEXMFSYSVAR\n"); TeXLive::TLUtils::create_fmtutil($localtlpdb, @@ -572,7 +568,7 @@ sub handle_execute_actions { # Use full path for external command, except on Windows. $lang = "$TEXMFSYSVAR/tex/generic/config/$lang"; } - if ($localtlpdb->option_create_formats && !$::regenerate_all_formats) { + if ($localtlpdb->option("create_formats") && !$::regenerate_all_formats) { $errors += do_cmd_and_check("fmtutil-sys --byhyphen $lang"); } } @@ -890,10 +886,10 @@ sub action_symlinks { } init_local_db(); if ($what =~ m/^add$/i) { - $localtlpdb->add_symlinks(); + $localtlmedia->add_symlinks(); } elsif ($what =~ m/^remove$/i) { # remove symlinks - $localtlpdb->remove_symlinks(); + $localtlmedia->remove_symlinks(); } else { # that should not happen tlwarn("that should not happen, action_symlinks what=$what\n"); @@ -1157,8 +1153,8 @@ sub write_w32_updater { my $container_doc_split = $mediatlpdb->config_doc_container; # get options about src/doc splitting from $totlpdb # TT: should we use local options to decide about install of doc & src? - my $opt_src = $localtlpdb->option_install_srcfiles; - my $opt_doc = $localtlpdb->option_install_docfiles; + my $opt_src = $localtlpdb->option("install_srcfiles"); + my $opt_doc = $localtlpdb->option("install_docfiles"); my $root = $localtlpdb->root; my $temp = "$root/temp"; my $repo = $mediatlpdb->root . "/$Archive"; @@ -1178,7 +1174,8 @@ sub write_w32_updater { $localtlp = $localtlpdb->get_package($pkg); $oldrev = $localtlp->revision; $newrev = $mediatlp->revision; - # we do install documenation files for category Documentation even if option_install_docfiles is false + # we do install documenation files for category Documentation even if + # option("install_docfiles") is false $opt_real_doc = ($mediatlp->category =~ m/documentation/i) ? 1 : $opt_doc; @pkg_parts = ($pkg); push(@pkg_parts, "$pkg.source") if ($container_src_split && $opt_src && $mediatlp->srcfiles); @@ -1552,8 +1549,8 @@ sub action_update { # for size calculation we also want w32 special packages if (@new || @updated || @w32_updated) { %sizes = %{$tlmediatlpdb->sizes_of_packages( - $localtlpdb->option_install_srcfiles, - $localtlpdb->option_install_docfiles, + $localtlpdb->option("install_srcfiles"), + $localtlpdb->option("install_docfiles"), @new, @updated, @w32_updated)}; } else { $sizes{'__TOTAL__'} = 0; @@ -1951,175 +1948,131 @@ sub action_option { $what = "show" unless defined($what); init_local_db(); if ($what =~ m/^show$/i) { - print "Default installation location (location): ", - $localtlpdb->option_location, "\n"; - print "Create formats on installation (formats): ", - ($localtlpdb->option_create_formats ? "yes" : "no"), "\n"; - print "Install documentation files (docfiles): ", - ($localtlpdb->option_install_docfiles ? "yes": "no"), "\n"; - print "Install source files (srcfiles): ", - ($localtlpdb->option_install_srcfiles ? "yes": "no"), "\n"; - print "Destination for symlinks for binaries (sys_bin): ", - $localtlpdb->option_sys_bin, "\n" - if $localtlpdb->option_sys_bin; - print "Destination for symlinks for man pages (sys_man): ", - $localtlpdb->option_sys_man, "\n" - if $localtlpdb->option_sys_man; - print "Destination for symlinks for info docs (sys_info): ", - $localtlpdb->option_sys_info, "\n" - if $localtlpdb->option_sys_info; - print "Directory for backups (backupdir): ", - $localtlpdb->option("backupdir"), "\n" - if $localtlpdb->option("backupdir"); - print "Number of backups to keep (autobackup): ", - $localtlpdb->option("autobackup"), "\n" - if $localtlpdb->option("autobackup"); - } elsif ($what =~ m/^location$/i) { - # changes the default location - my $loc = shift @ARGV; - if ($loc) { - # support "ctan" on the cmd line, and don't abs_path it! - if ($loc =~ m/^ctan$/i) { - $loc = "$TeXLive::TLConfig::TeXLiveURL"; - } - if ($loc !~ m!^(http|ftp)://!i) { - # seems to be a local path, try to normalize it - my $testloc = abs_path($loc); - # however, if we were given a url, that will get "normalized" to the - # empty string, it not being a path. Restore the original value if so. - $loc = $testloc if $testloc; - } - info("tlmgr: setting default installation location to $loc\n"); - $localtlpdb->option_location($loc); - $localtlpdb->save; - } else { - info("Default installation location: ", - $localtlpdb->option_location, "\n"); - } - } elsif ($what =~ m/^docfiles$/i) { - # changes the default docfiles - my $loc = shift @ARGV; - if (defined($loc)) { - info("tlmgr: defaulting to", ($loc ? "" : " not"), - " installing documentation files.\n"); - $localtlpdb->option_install_docfiles($loc); - $localtlpdb->save; - } else { - info("Install documentation files: ", - $localtlpdb->option_install_docfiles, "\n"); - } - } elsif ($what =~ m/^srcfiles$/i) { - # changes the default srcfiles - my $loc = shift @ARGV; - if (defined($loc)) { - info("tlmgr: defaulting to", ($loc ? "" : " not"), - " installing source files.\n"); - $localtlpdb->option_install_srcfiles($loc); - $localtlpdb->save; - } else { - info("Install source files: ", - $localtlpdb->option_install_srcfiles, "\n"); - } - } elsif ($what =~ m/^formats$/i) { - # changes the default formats - my $loc = shift @ARGV; - if (defined($loc)) { - info("tlmgr: defaulting to", ($loc ? "" : " not"), - " generating format files on installation.\n"); - $localtlpdb->option_create_formats($loc); - $localtlpdb->save; - } else { - info("Create formats on installation: ", - $localtlpdb->option_create_formats, "\n"); - } - } elsif ($what =~ m/^sys_man$/i) { - # changes the default sys_man - my $loc = shift @ARGV; - if (defined($loc)) { - info("tlmgr: setting destination for symlinks to man pages to $loc\n"); - $localtlpdb->option_sys_man ($loc); - $localtlpdb->save; - } else { - info("Destination for symlinks to man pages: ", - $localtlpdb->option_sys_man, "\n"); - } - } elsif ($what =~ m/^sys_info$/i) { - # changes the default sys_info - my $loc = shift @ARGV; - if (defined($loc)) { - info("tlmgr: setting destination for symlinks to info pages to $loc\n"); - $localtlpdb->option_sys_info ($loc); - $localtlpdb->save; - } else { - info("Default destination for symlinks to info pages: ", - $localtlpdb->option_sys_info, "\n"); - } - } elsif ($what =~ m/^sys_bin$/i) { - # changes the default sys_bin - my $loc = shift @ARGV; - if (defined($loc)) { - info("tlmgr: setting destination for symlinks to binaries to $loc\n"); - $localtlpdb->option_sys_bin ($loc); - $localtlpdb->save; - } else { - info("Default destination for symlinks to binaries: ", - $localtlpdb->option_sys_bin, "\n"); - } - } elsif ($what =~ m/^backupdir$/i) { - my $val = shift @ARGV; - if (defined($val)) { - info("tlmgr: setting option $what to $val.\n"); - if (! -d $val) { - info("tlmgr: the directory $val does not exists, it has to be created\n"); - info("tlmgr: before backups can be done automatically.\n"); - } - $localtlpdb->option($what,$val); - $localtlpdb->save; - } else { - info("Option $what = ", $localtlpdb->option($what), "\n"); - } - } elsif ($what =~ m/^autobackup$/i) { - my $val = shift @ARGV; - if (defined($val)) { - if ($val =~ m/-?[0-9]+/) { - if ($val < -1) { - tlwarn "Value $val for autobackup not supported, must be >= -1\n"; - return; - } - } elsif ($val =~ m/^infty$/i) { - $val = -1; + for my $o (keys %{$localtlpdb->options}) { + # ignore some things which are win32 specific + next if ($o eq "desktop_integration" && !win32()); + next if ($o eq "file_assocs" && !win32()); + next if ($o eq "w32_multi_user" && !win32()); + if (win32()) { + next if ($o =~ m/^sys_/); + } + if (defined $TLPDBOptionDesc{$o}) { + info("$TLPDBOptionDesc{$o} ($TLPDBOptionTlmgrName{$o}): " . + $localtlpdb->option($o) . "\n"); } else { - tlwarn "Value $val for autobackup not supported, must be >= -1\n"; - return; + tlwarn ("option $o not supported\n"); } - info("tlmgr: setting option $what to $val"); - $localtlpdb->option($what,$val); - $localtlpdb->save; - } else { - $val = $localtlpdb->option($what); - info("Option $what = $val"); } - if ($val == -1) { - info(" (make and keep infinitely many backups)\n"); - } elsif ($val == 0) { - info(" (don't keep any backups)\n"); - } else { - info(" (make and keep $val backups)\n"); - } - } elsif (member($what, @AllowedConfigOptions)) { - # for all further options not handled above, we check whether they - # appear in the list of allowed options; if they do, we set/read - # the values, otherwise we warn. - my $val = shift @ARGV; - if (defined($val)) { - info("tlmgr: setting option $what to $val.\n"); - $localtlpdb->option($what,$val); - $localtlpdb->save; - } else { - info("Option $what = ", $localtlpdb->option($what), "\n"); + } elsif ($what =~ m/^showall$/i) { + my %loc = %{$localtlpdb->options}; + for my $o (keys %TLPDBOptionDesc) { + info("$TLPDBOptionDesc{$o} ($TLPDBOptionTlmgrName{$o}): " . + (defined($loc{$o}) ? $loc{$o} : "(not set)") . "\n"); } } else { - tlwarn "Option $what is currently not supported.\n"; + my $found = 0; + for my $opt (keys %TLPDBOptionTlmgrName) { + if ($what eq $TLPDBOptionTlmgrName{$opt}) { + $found = 1; + # the option argument matches the name + my $val = shift @ARGV; + if (defined($val)) { + # set new value + # here we have to care for some special cases + if ($what eq $TLPDBOptionTlmgrName{"location"}) { + # support "ctan" on the cmd line, and don't abs_path it! + if ($val =~ m/^ctan$/i) { + $val = "$TeXLive::TLConfig::TeXLiveURL"; + } + if ($val !~ m!^(http|ftp)://!i) { + # seems to be a local path, try to normalize it + my $testloc = abs_path($val); + # however, if we were given a url, that will get "normalized" + # to the empty string, it not being a path. + # Restore the original value if so. + $val = $testloc if $testloc; + } + info("tlmgr: setting default installation location to $val\n"); + $localtlpdb->option($opt, $val); + } elsif ($what eq $TLPDBOptionTlmgrName{"backupdir"}) { + info("tlmgr: setting option $what to $val.\n"); + if (! -d $val) { + info("tlmgr: the directory $val does not exists, it has to be created\n"); + info("tlmgr: before backups can be done automatically.\n"); + } + $localtlpdb->option($opt, $val); + } elsif ($what eq $TLPDBOptionTlmgrName{"w32_multi_user"}) { + # when running w32 do not allow that a non-admin users sets + # this from false to true + if (win32() && !admin() && !$val) { + tlwarn("tlmgr: non-admin user cannot set $TLPDBOptionTlmgrName{'w32_multi_user'} option to true\n"); + } else { + if ($val) { + info("tlmgr: setting option $what to 1.\n"); + $localtlpdb->option($opt, 1); + } else { + info("tlmgr: setting option $what to 0.\n"); + $localtlpdb->option($opt, 0); + } + } + } else { + # default case, switch for different types + if ($TLPDBOptionType{$opt} eq "b") { + if ($val) { + info("tlmgr: setting option $what to 1.\n"); + $localtlpdb->option($opt, 1); + } else { + info("tlmgr: setting option $what to 0.\n"); + $localtlpdb->option($opt, 0); + } + } elsif ($TLPDBOptionType{$opt} eq "p") { + info("tlmgr: setting option $what to $val.\n"); + $localtlpdb->option($opt, $val); + } elsif ($TLPDBOptionType{$opt} eq "u") { + info("tlmgr: setting option $what to $val.\n"); + $localtlpdb->option($opt, $val); + } elsif ($TLPDBOptionType{$opt} =~ m/^n(:((-)?\d+)?..((-)?\d+)?)?$/) { + my $isgood = 1; + my $n = int($val); + my $low; + my $up; + if (defined($1)) { + # range given + if (defined($2)) { + # lower border + if ($2 > $n) { + tlwarn("value $n for $what out of range ($TLPDBOptionType{$opt})\n"); + $isgood = 0; + } + } + if (defined($4)) { + # upper border + if ($4 < $n) { + tlwarn("value $n for $what out of range ($TLPDBOptionType{$opt})\n"); + $isgood = 0; + } + } + } + if ($isgood) { + info("tlmgr: setting option $what to $n.\n"); + $localtlpdb->option($opt, $n); + } + } else { + tlwarn ("Unknown type of option $opt: $TLPDBOptionType{$opt}\n"); + } + } + $localtlpdb->save; + } else { + # show current value + info ("$TLPDBOptionDesc{$opt} ($TLPDBOptionTlmgrName{$opt}): " . + $localtlpdb->option($opt) . "\n"); + } + last; + } + } + if (!$found) { + tlwarn("tlmgr: option $what not supported!\n"); + } } return; } @@ -2198,10 +2151,10 @@ sub action_arch { info("install: tlpsv.win32\n"); $tlmediasrc->install_package("tlpsv.win32", $localtlpdb); } - # update the option_archs list of installed archs - my @larchs = $localtlpdb->option_available_architectures; + # update the option("available_architectures") list of installed archs + my @larchs = $localtlpdb->setting("available_architectures"); push @larchs, @todoarchs; - $localtlpdb->option_available_architectures(@larchs); + $localtlpdb->setting("available_architectures",@larchs); $localtlpdb->save; } else { die "Unknown option for arch: $what"; @@ -2351,7 +2304,7 @@ sub action_uninstall { } print ("Ok, removing the whole installation:\n"); init_local_db(); - $localtlpdb->remove_symlinks; + $localtlmedia->remove_symlinks; # now do remove the rest system("rm", "-rf", "$Master/texmf-dist"); system("rm", "-rf", "$Master/texmf-doc"); @@ -2409,9 +2362,10 @@ sub action_recreate_tlpdb { # we have to find out the default arch # if there is only one dir in $Master/bin then we are settled, # otherwise we expect the user to pass a correct arch string - if ($^O =~ /^MSWin(32|64)$/i) { - push @deps, "platform:win32"; - } else { + if (!TeXLive::TLUtils::member(TeXLive::TLUtils::platform(), @archs)) { + # hmm that is bad, the platform as detected is not in the list + # of installed platforms, so the option --arch has to be given + # if only one is installed use that one if ($#archs == 0) { # only one arch available, fine, use it as default push @deps, "platform:$archs[0]"; @@ -2557,7 +2511,7 @@ sub check_files { # we need the -use-svn version only for the check-file-coverage # replacement anyway, so it will be used on tug, which is neither w32 nor # darwin. - my $arch = $localtlpdb->option_platform; + my $arch = $localtlmedia->platform(); return $ret if ($arch eq "win32" || $arch eq "universal-darwin"); # do check that all files in the trees are covered @@ -2920,8 +2874,7 @@ sub init_local_db { die("cannot find tlpdb in $Master") unless (defined($localtlpdb)); # setup the programs, for w32 we need the shipped wget/xz etc, so we # pass the location of these files to setup_programs. - if (!setup_programs("$Master/tlpkg/installer", - $localtlpdb->option_platform)) { + if (!setup_programs("$Master/tlpkg/installer", $localtlmedia->platform)) { tlwarn("Couldn't set up the necessary programs.\nInstallation of packages is not supported.\nPlease report to texlive\@tug.org.\n"); if (defined($should_i_die) && $should_i_die) { finish(1); @@ -2930,7 +2883,7 @@ sub init_local_db { } } # let cmd line options override the settings in localtlpdb - my $loc = $localtlpdb->option_location; + my $loc = $localtlpdb->option("location"); if (defined($loc)) { $location = $loc; } @@ -3485,27 +3438,34 @@ written to the terminal. =item B