"Fossies" - the Fresh Open Source Software Archive

Member "install-tl-20231204/tlpkg/TeXLive/TLConfig.pm" (26 Feb 2023, 12192 Bytes) of package /linux/misc/install-tl-unx.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 # $Id: TLConfig.pm 66204 2023-02-26 22:10:41Z karl $
    2 # TeXLive::TLConfig.pm - module exporting configuration values
    3 # Copyright 2007-2023 Norbert Preining
    4 # This file is licensed under the GNU General Public License version 2
    5 # or any later version.
    6 
    7 use strict; use warnings;
    8 package TeXLive::TLConfig;
    9 
   10 my $svnrev = '$Revision: 66204 $';
   11 my $_modulerevision = ($svnrev =~ m/: ([0-9]+) /) ? $1 : "unknown";
   12 sub module_revision { return $_modulerevision; }
   13 
   14 BEGIN {
   15   use Exporter ();
   16   use vars qw( @ISA @EXPORT_OK @EXPORT );
   17   @ISA = qw(Exporter);
   18   @EXPORT_OK = qw(
   19     $ReleaseYear
   20     @MetaCategories
   21     @NormalCategories
   22     @Categories
   23     $MetaCategoriesRegexp
   24     $CategoriesRegexp
   25     $DefaultCategory
   26     @AcceptedFallbackDownloaders
   27     %FallbackDownloaderProgram
   28     %FallbackDownloaderArgs
   29     $DefaultCompressorFormat
   30     $CompressorExtRegexp
   31     %Compressors
   32     $InfraLocation
   33     $DatabaseName
   34     $DatabaseLocation
   35     $PackageBackupDir 
   36     $BlockSize
   37     $Archive
   38     $TeXLiveServerURL
   39     $TeXLiveServerURLRegexp
   40     $TeXLiveServerPath
   41     $TeXLiveURL
   42     @CriticalPackagesList
   43     $CriticalPackagesRegexp
   44     @InstallExtraRequiredPackages
   45     $WindowsMainMenuName
   46     $RelocPrefix
   47     $RelocTree
   48     %TLPDBOptions
   49     %TLPDBSettings
   50     %TLPDBConfigs
   51     $NetworkTimeout
   52     $MaxLWPErrors
   53     $MaxLWPReinitCount
   54     $PartialEngineSupport
   55     $F_OK $F_WARNING $F_ERROR $F_NOPOSTACTION
   56     $ChecksumLength
   57     $ChecksumProgram
   58     $ChecksumExtension
   59   );
   60   @EXPORT = @EXPORT_OK;
   61 }
   62 
   63 # the year of our release, will be used in the location of the
   64 # network packages, and in menu names, and other places.
   65 our $ReleaseYear = 2023;
   66 
   67 # users can upgrade from this year to the current year; might be the
   68 # same as the release year, or any number of releases earlier.
   69 # Generally not tested, but should be.
   70 our $MinRelease = 2016;
   71 
   72 # Meta Categories do not ship files, but only call for other packages.
   73 our @MetaCategories = qw/Collection Scheme/;
   74 our $MetaCategoriesRegexp = '(Collection|Scheme)';
   75 #
   76 # Normal Categories contain actial files and do not depend on other things.
   77 our @NormalCategories = qw/Package TLCore ConTeXt/;
   78 #
   79 # list of all Categories
   80 our @Categories = (@MetaCategories, @NormalCategories);
   81 
   82 # repeat, as a regexp.
   83 our $CategoriesRegexp = '(Collection|Scheme|Package|TLCore|ConTeXt)';
   84 
   85 our $DefaultCategory = "Package";
   86 
   87 # location of various infra files (texlive.tlpdb, .tlpobj etc)
   88 # relative to a root (e.g., the Master/, or the installation path)
   89 our $InfraLocation = "tlpkg";
   90 our $DatabaseName = "texlive.tlpdb";
   91 our $DatabaseLocation = "$InfraLocation/$DatabaseName";
   92 
   93 # location of backups in default autobackup setting (under tlpkg)
   94 our $PackageBackupDir = "$InfraLocation/backups";
   95 
   96 # for computing disk usage; this is most common.
   97 our $BlockSize = 4096;
   98 
   99 # timeout for network connections (wget, LWP) in seconds
  100 our $NetworkTimeout = 30;
  101 # number of errors during an LWP session until it is marked as disabled
  102 our $MaxLWPErrors = 5;
  103 # max number of times we reenable LWP after it was disabled
  104 our $MaxLWPReinitCount = 10;
  105 
  106 our $Archive = "archive";
  107 our $TeXLiveServerURL = "https://mirror.ctan.org";
  108 our $TeXLiveServerURLRegexp = 'https?://mirror\.ctan\.org';
  109 # from 2009 on we try to put them all into tlnet directly without any
  110 # release year since we hope that we can switch over to 2010 on the fly
  111 # our $TeXLiveServerPath = "systems/texlive/tlnet/$ReleaseYear";
  112 our $TeXLiveServerPath = "systems/texlive/tlnet";
  113 our $TeXLiveURL = "$TeXLiveServerURL/$TeXLiveServerPath";
  114 
  115 # Relocatable packages.
  116 our $RelocTree = "texmf-dist";
  117 our $RelocPrefix = "RELOC";
  118 
  119 our @CriticalPackagesList = qw/texlive.infra/;
  120 our $CriticalPackagesRegexp = '^(texlive\.infra)';
  121 if ($^O =~ /^MSWin/i) {
  122   push (@CriticalPackagesList, "tlperl.windows");
  123   $CriticalPackagesRegexp = '^(texlive\.infra|tlperl\.windows$)';
  124 }
  125 
  126 
  127 # Extra package that are required for installation and installed
  128 # during the first run of the installer.
  129 # texlive-scripts are necessary for mktexlsr, updmap, fmtutil, ...
  130 # the installation cannot continue without those
  131 our @InstallExtraRequiredPackages = qw/texlive-scripts kpathsea hyphen-base/;
  132 if ($^O =~ /^MSWin/i) {
  133   push @InstallExtraRequiredPackages, "luatex";
  134 }
  135 
  136 #
  137 our @AcceptedFallbackDownloaders = qw/curl wget/;
  138 our %FallbackDownloaderProgram = ( 'wget' => 'wget', 'curl' => 'curl');
  139 our %FallbackDownloaderArgs = (
  140   'curl' => ['--user-agent', 'texlive/curl',
  141              '--retry', '4', '--retry-delay', '4',
  142              '--connect-timeout', "$NetworkTimeout", 
  143              '--fail', '--location', '--silent', '--output'],
  144   'wget' => ['--user-agent=texlive/wget', '--tries=4',
  145              "--timeout=$NetworkTimeout", '-q', '-O'],
  146 );
  147 # the way we package things on the web
  148 our $DefaultCompressorFormat = "xz";
  149 # priority defines which compressor is selected for backups/rollback containers
  150 # less is better
  151 our %Compressors = (
  152   "lz4" => {
  153     "decompress_args" => ["-dcf"],
  154     "compress_args"   => ["-zfmq"],
  155     "extension"       => "lz4",
  156     "priority"        => 10,
  157   },
  158   "gzip" => {
  159     "decompress_args" => ["-dcf"],
  160     "compress_args"   => ["-f"],
  161     "extension"       => "gz",
  162     "priority"        => 20,
  163   },
  164   "xz" => {
  165     "decompress_args" => ["-dcf"],
  166     "compress_args"   => ["-zf"],
  167     "extension"       => "xz",
  168     "priority"        => 30,
  169   },
  170 );
  171 our $CompressorExtRegexp = "("
  172     . join("|", map { $Compressors{$_}{'extension'} } keys %Compressors)
  173     . ")";
  174 
  175 # archive (not user) settings.
  176 # these can be overridden by putting them into 00texlive.config.tlpsrc
  177 # in the format
  178 #   depend key/value
  179 our %TLPDBConfigs = (
  180   "container_split_src_files" => 1,
  181   "container_split_doc_files" => 1,
  182   "container_format" => $DefaultCompressorFormat,
  183   "minrelease" => $MinRelease,
  184   "release" => $ReleaseYear,
  185   "frozen" => 0,
  186 );
  187 
  188 # definition of the option strings and their value types 
  189 # possible types are:
  190 # - u: url
  191 # - b: boolean, saved as 0/1
  192 # - p: path (local path)
  193 # - n: natural number
  194 #      it allows n:[a]..[b]
  195 #         if a is empty start at -infty
  196 #         if b is empty end at +infty
  197 #      so "n:.." is equivalent to "n"
  198 
  199 # $TLPDBOptions{"option"}->[0] --> type
  200 #                        ->[1] --> default value
  201 #                        ->[2] --> tlmgr name
  202 #                        ->[3] --> tlmgr description
  203 # the "option" is the value in the TLPDB
  204 
  205 our %TLPDBOptions = (
  206   "autobackup" =>
  207     [ "n:-1..", 1, "autobackup",
  208       "Number of backups to keep" ],
  209   "backupdir" =>
  210     [ "p", $PackageBackupDir, "backupdir",
  211       "Directory for backups" ],
  212   "create_formats" =>
  213     [ "b", 1, "formats",  
  214       "Generate formats at installation or update" ],
  215   "desktop_integration" =>
  216     [ "b", 1, "desktop_integration",
  217       "Create Start menu shortcuts (Windows)" ],
  218   "file_assocs" =>
  219     [ "n:0..2", 1, "fileassocs",
  220       "Change file associations (Windows)" ],
  221   "generate_updmap" =>
  222     [ "b", 0, "generate_updmap",
  223       "Run tlmgr generate updmap after maps have changed" ],
  224   "install_docfiles" =>
  225     [ "b", 1, "docfiles",
  226       "Install documentation files" ],
  227   "install_srcfiles" =>
  228     [ "b", 1, "srcfiles",
  229       "Install source files" ],
  230   "location" =>
  231     [ "u", "__MASTER__", "repository", 
  232       "Default package repository" ],
  233   "post_code" =>
  234     [ "b", 1, "postcode",
  235       "Run postinst code blobs" ],
  236   "sys_bin" =>
  237     [ "p", "/usr/local/bin", "sys_bin",
  238       "Destination for symlinks for binaries" ],
  239   "sys_info" =>
  240     [ "p", "/usr/local/share/info", "sys_info",
  241       "Destination for symlinks for info docs" ],
  242   "sys_man" =>
  243     [ "p", "/usr/local/share/man", "sys_man",
  244       "Destination for symlinks for man pages" ],
  245   "w32_multi_user" =>
  246     [ "b", 1, "multiuser",
  247       "Install for all users (Windows)" ],
  248 );
  249 
  250 
  251 our %TLPDBSettings = (
  252   "platform" => [ "s", "Main platform for this computer" ],
  253   "available_architectures" => [ "l","All available/installed architectures" ],
  254   "usertree" => [ "b", "This tree acts as user tree" ]
  255 );
  256 
  257 our $WindowsMainMenuName = "TeX Live $ReleaseYear";
  258 
  259 # Comma-separated list of engines which do not exist on all platforms.
  260 our $PartialEngineSupport = "luametatex,luajithbtex,luajittex,mfluajit";
  261 
  262 # Flags for error handling across the scripts and modules
  263 # all fine
  264 our $F_OK = 0;
  265 #
  266 # some warnings, but we still try to run post actions
  267 our $F_WARNING = 1;
  268 #
  269 # error, terminating
  270 our $F_ERROR = 2;
  271 #
  272 # all fine, but no need to run post actions
  273 our $F_NOPOSTACTION = 4;
  274 
  275 # The length of a checksum generated by tlchecksum and contained in
  276 # texlive.tlpdb.checksum. Needs to be in agreement with the hash
  277 # method used in TLCrypto::tlchecksum and TLCrypto::tldigest
  278 our $ChecksumLength = 128;
  279 
  280 # The program generating the checksum for the file given as first
  281 # argument
  282 our $ChecksumProgram = "sha512sum";
  283 
  284 # The extension of the checksum file
  285 our $ChecksumExtension = "sha512";
  286 
  287 1;
  288 
  289 
  290 =head1 NAME
  291 
  292 C<TeXLive::TLConfig> -- TeX Live configuration parameters
  293 
  294 =head1 SYNOPSIS
  295 
  296   use TeXLive::TLConfig;
  297 
  298 =head1 DESCRIPTION
  299 
  300 The L<TeXLive::TLConfig> module contains definitions of variables 
  301 configuring all of TeX Live.
  302 
  303 =head2 EXPORTED VARIABLES
  304 
  305 All of the following variables are pulled into the callers namespace,
  306 i.e., are declared with C<EXPORT> (and C<EXPORT_OK>).
  307 
  308 =over 4
  309 
  310 =item C<@TeXLive::TLConfig::MetaCategories>
  311 
  312 The list of meta categories, i.e., those categories whose packages only
  313 depend on other packages, but don't ship any files. Currently 
  314 C<Collection> and <Scheme>.
  315 
  316 =item C<@TeXLive::TLConfig::NormalCategories>
  317 
  318 The list of normal categories, i.e., those categories whose packages do
  319 ship files. Currently C<TLCore>, C<Package>, C<ConTeXt>.
  320 
  321 =item C<@TeXLive::TLConfig::Categories>
  322 
  323 The list of all categories, i.e., the union of the above.
  324 
  325 =item C<$TeXLive::TLConfig::CategoriesRegexp>
  326 
  327 A regexp matching any category.
  328 
  329 =item C<$TeXLive::TLConfig::DefaultCategory>
  330 
  331 The default category used when creating new packages.
  332 
  333 =item C<$TeXLive::TLConfig::InfraLocation>
  334 
  335 The subdirectory with various infrastructure files (C<texlive.tlpdb>,
  336 tlpobj files, ...) relative to the root of the installation; currently
  337 C<tlpkg>.
  338 
  339 =item C<$TeXLive::TLConfig::DatabaseName>
  340 
  341 The name of our so-called database file: C<texlive.tlpdb>. It's just a
  342 plain text file, not any kind of relational or other database.
  343 
  344 =item C<$TeXLive::TLConfig::DatabaseLocation>
  345 
  346 Concatenation of C<InfraLocation> "/" C<DatabaseName>, i.e.,
  347 C<tlpkg/texlive.tlpdb>.
  348 
  349 =item C<$TeXLive::TLConfig::BlockSize>
  350 
  351 The assumed block size, currently 4k.
  352 
  353 =item C<$TeXLive::TLConfig::Archive>
  354 =item C<$TeXLive::TLConfig::TeXLiveURL>
  355 
  356 These values specify where to find packages.
  357 
  358 =item C<$TeXLive::TLConfig::TeXLiveServerURL>
  359 =item C<$TeXLive::TLConfig::TeXLiveServerURLRegexp>
  360 =item C<$TeXLive::TLConfig::TeXLiveServerPath>
  361 
  362 C<TeXLiveURL> is concatenated from these values, with a string between.
  363 The defaults are respectively, C<https://mirror.ctan.org> and
  364 C<systems/texlive/tlnet/>.
  365 
  366 =item C<@TeXLive::TLConfig::CriticalPackagesList>
  367 =item C<@TeXLive::TLConfig::CriticalPackagesRegexp>
  368 
  369 A list of all those packages which we do not update regularly since they
  370 are too central, currently texlive.infra and (for Windows) tlperl.windows.
  371 
  372 =item C<@TeXLive::TLConfig::InstallExtraRequiredPackages>
  373 
  374 A list of packages that are required in addition to those from
  375 C<@CriticalPackagesList> for the installer to be able to conclude
  376 installation.
  377 
  378 =item C<$TeXLive::TLConfig::RelocTree>
  379 
  380 The texmf-tree name that can be relocated, defaults to C<texmf-dist>.
  381 
  382 =item C<$TeXLive::TLConfig::RelocPrefix>
  383 
  384 The string that replaces the C<RelocTree> in the tlpdb if a package is
  385 relocated, defaults to C<RELOC>".
  386 
  387 =back
  388 
  389 =head1 SEE ALSO
  390 
  391 All the other TeX Live modules and scripts, especially C<tlmgr> and
  392 C<install-tl>, and the documentation in the repository:
  393 C<Master/tlpkg/doc/>.
  394 
  395 =head1 AUTHORS AND COPYRIGHT
  396 
  397 This script and its documentation were written for the TeX Live
  398 distribution (L<https://tug.org/texlive>) and both are licensed under the
  399 GNU General Public License Version 2 or later.
  400 
  401 =cut
  402 
  403 ### Local Variables:
  404 ### perl-indent-level: 2
  405 ### tab-width: 2
  406 ### indent-tabs-mode: nil
  407 ### End:
  408 # vim:set tabstop=2 expandtab: #