"Fossies" - the Fresh Open Source Software Archive

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