diff options
author | Norbert Preining <preining@logic.at> | 2018-05-23 02:32:20 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2018-05-23 02:32:20 +0000 |
commit | 192a295280da343cff8dd0fb7f89a843d96c8368 (patch) | |
tree | 9b0eadbcb44b19fb9c1826f7599bdd97f4aee04a /Master | |
parent | e17e5c56b96323c959244814ff715acfe8cac5fb (diff) |
use imported names instead of fully qualified names of TLConfig
git-svn-id: svn://tug.org/texlive/trunk@47801 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/tlpkg/TeXLive/TLPDB.pm | 69 |
1 files changed, 36 insertions, 33 deletions
diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm index 236f344851b..9ba592e4115 100644 --- a/Master/tlpkg/TeXLive/TLPDB.pm +++ b/Master/tlpkg/TeXLive/TLPDB.pm @@ -92,7 +92,10 @@ C<TeXLive::TLPDB> -- A database of TeX Live Packages use TeXLive::TLConfig qw($CategoriesRegexp $DefaultCategory $InfraLocation $DatabaseName $MetaCategoriesRegexp $Archive - %TLPDBOptions %TLPDBSettings + $DefaultContainerFormat $DefaultContainerExtension + @AcceptedCompressors $AcceptedCompressorsRegexp %CompressorProgram + %CompressorExtension %CompressorArgs %DecompressorProgram %DecompressorArgs + %TLPDBOptions %TLPDBSettings $ChecksumExtension $RelocPrefix $RelocTree); use TeXLive::TLCrypto; use TeXLive::TLPOBJ; @@ -369,7 +372,7 @@ sub from_file { # # before we open and proceed, verify the downloaded file if ($params{'verify'} && $media ne 'local_uncompressed') { - my ($r, $m) = TeXLive::TLCrypto::verify_checksum($tlpdbfile, "$path.$TeXLive::TLConfig::ChecksumExtension"); + my ($r, $m) = TeXLive::TLCrypto::verify_checksum($tlpdbfile, "$path.$ChecksumExtension"); if ($r == $VS_CHECKSUM_ERROR) { tldie("$0: checksum error when downloading $tlpdbfile from $path: $m\n"); } elsif ($r == $VS_SIGNATURE_ERROR) { @@ -395,7 +398,7 @@ sub from_file { open($retfh, "<$tlpdbfile") || die "$0: open($tlpdbfile) failed: $!"; } else { if ($params{'verify'} && $media ne 'local_uncompressed') { - my ($r, $m) = TeXLive::TLCrypto::verify_checksum($path, "$path.$TeXLive::TLConfig::ChecksumExtension"); + my ($r, $m) = TeXLive::TLCrypto::verify_checksum($path, "$path.$ChecksumExtension"); if ($r == $VS_CHECKSUM_ERROR) { tldie("$0: checksum error when downloading $path from $path: $m\n"); } elsif ($r == $VS_SIGNATURE_ERROR) { @@ -502,33 +505,33 @@ sub options_as_json { die("calling _as_json on virtual is not supported!") if ($self->is_virtual); my $opts = $self->options; my @opts; - for my $k (keys %TeXLive::TLConfig::TLPDBOptions) { + for my $k (keys %TLPDBOptions) { my %foo; $foo{'name'} = $k; - $foo{'tlmgrname'} = $TeXLive::TLConfig::TLPDBOptions{$k}[2]; - $foo{'description'} = $TeXLive::TLConfig::TLPDBOptions{$k}[3]; - $foo{'format'} = $TeXLive::TLConfig::TLPDBOptions{$k}[0]; - $foo{'default'} = "$TeXLive::TLConfig::TLPDBOptions{$k}[1]"; - # if ($TeXLive::TLConfig::TLPDBOptions{$k}[0] =~ m/^n/) { + $foo{'tlmgrname'} = $TLPDBOptions{$k}[2]; + $foo{'description'} = $TLPDBOptions{$k}[3]; + $foo{'format'} = $TLPDBOptions{$k}[0]; + $foo{'default'} = "$TLPDBOptions{$k}[1]"; + # if ($TLPDBOptions{$k}[0] =~ m/^n/) { # if (exists($opts->{$k})) { # $foo{'value'} = $opts->{$k}; # $foo{'value'} += 0; # } # $foo{'default'} += 0; - # } elsif ($TeXLive::TLConfig::TLPDBOptions{$k}[0] eq "b") { + # } elsif ($TLPDBOptions{$k}[0] eq "b") { # if (exists($opts->{$k})) { # $foo{'value'} = ($opts->{$k} ? TeXLive::TLUtils::True() : TeXLive::TLUtils::False()); # } # $foo{'default'} = ($foo{'default'} ? TeXLive::TLUtils::True() : TeXLive::TLUtils::False()); # } elsif ($k eq "location") { # my %def; - # $def{'main'} = $TeXLive::TLConfig::TLPDBOptions{$k}[1]; + # $def{'main'} = $TLPDBOptions{$k}[1]; # $foo{'default'} = \%def; # if (exists($opts->{$k})) { # my %repos = TeXLive::TLUtils::repository_to_array($opts->{$k}); # $foo{'value'} = \%repos; # } - # } elsif ($TeXLive::TLConfig::TLPDBOptions{$k}[0] eq "p") { + # } elsif ($TLPDBOptions{$k}[0] eq "p") { # # strings/path # if (exists($opts->{$k})) { # $foo{'value'} = $opts->{$k}; @@ -551,16 +554,16 @@ sub settings_as_json { die("calling _as_json on virtual is not supported!") if ($self->is_virtual); my $sets = $self->settings; my @json; - for my $k (keys %TeXLive::TLConfig::TLPDBSettings) { + for my $k (keys %TLPDBSettings) { my %foo; $foo{'name'} = $k; - $foo{'type'} = $TeXLive::TLConfig::TLPDBSettings{$k}[0]; - $foo{'description'} = $TeXLive::TLConfig::TLPDBSettings{$k}[1]; - # if ($TeXLive::TLConfig::TLPDBSettings{$k}[0] eq "b") { + $foo{'type'} = $TLPDBSettings{$k}[0]; + $foo{'description'} = $TLPDBSettings{$k}[1]; + # if ($TLPDBSettings{$k}[0] eq "b") { # if (exists($sets->{$k})) { # $foo{'value'} = ($sets->{$k} ? TeXLive::TLUtils::True() : TeXLive::TLUtils::False()); # } - # } elsif ($TeXLive::TLConfig::TLPDBSettings{$k} eq "available_architectures") { + # } elsif ($TLPDBSettings{$k} eq "available_architectures") { # if (exists($sets->{$k})) { # my @lof = $self->available_architectures; # $foo{'value'} = \@lof; @@ -755,7 +758,7 @@ sub _add_tlpcontainer { # we only create/add tlpobj for arch eq "all" if ($arch eq "all") { my $tlpobj = new TeXLive::TLPOBJ; - $tlpobj->from_file("$dest/$TeXLive::TLConfig::InfraLocation/tlpobj/$package.tlpobj"); + $tlpobj->from_file("$dest/$InfraLocation/tlpobj/$package.tlpobj"); $self->add_tlpobj($tlpobj); return $tlpobj; } @@ -1759,7 +1762,7 @@ sub install_package_files { if ($opt_doc) { foreach ($tlpobj->docfiles) { push @installfiles, $_; } } # # remove the RELOC prefix, but do NOT replace it with RelocTree - @installfiles = map { s!^$TeXLive::TLConfig::RelocPrefix/!!; $_; } @installfiles; + @installfiles = map { s!^$RelocPrefix/!!; $_; } @installfiles; # if the first argument of _install_data is scalar, it is the # place from where files should be installed if (!_install_data ($tmpdir, \@installfiles, $reloc, \@installfiles, $self)) { @@ -1891,17 +1894,17 @@ sub not_virtual_install_package { if ($media eq 'local_uncompressed') { $container = \@installfiles; } elsif ($media eq 'local_compressed') { - for my $ext (@TeXLive::TLConfig::AcceptedCompressors) { + for my $ext (@AcceptedCompressors) { if (-r "$root/$Archive/$pkg.tar.$ext") { $container = "$root/$Archive/$pkg.tar.$ext"; } } if (!$container) { - tlwarn("TLPDB: cannot find package $pkg.tar.$TeXLive::TLConfig::AcceptedCompressorsRegexp in $root/$Archive\n"); + tlwarn("TLPDB: cannot find package $pkg.tar.$AcceptedCompressorsRegexp in $root/$Archive\n"); return(0); } } elsif (&media eq 'NET') { - $container = "$root/$Archive/$pkg.$TeXLive::TLConfig::DefaultContainerExtension"; + $container = "$root/$Archive/$pkg.$DefaultContainerExtension"; } $self->_install_data ($container, $reloc, \@installfiles, $totlpdb, $tlpobj->containersize, $tlpobj->containerchecksum) || return(0); @@ -1921,13 +1924,13 @@ sub not_virtual_install_package { # - there are actually src/doc files present if ($container_src_split && $opt_src && $tlpobj->srcfiles) { my $srccontainer = $container; - $srccontainer =~ s/\.tar\.$TeXLive::TLConfig::AcceptedCompressorsRegexp$/.source.tar.$1/; + $srccontainer =~ s/\.tar\.$AcceptedCompressorsRegexp$/.source.tar.$1/; $self->_install_data ($srccontainer, $reloc, \@installfiles, $totlpdb, $tlpobj->srccontainersize, $tlpobj->srccontainerchecksum) || return(0); } if ($container_doc_split && $real_opt_doc && $tlpobj->docfiles) { my $doccontainer = $container; - $doccontainer =~ s/\.tar\.$TeXLive::TLConfig::AcceptedCompressorsRegexp$/.doc.tar.$1/; + $doccontainer =~ s/\.tar\.$AcceptedCompressorsRegexp$/.doc.tar.$1/; $self->_install_data ($doccontainer, $reloc, \@installfiles, $totlpdb, $tlpobj->doccontainersize, $tlpobj->doccontainerchecksum) || return(0); } @@ -1937,8 +1940,8 @@ sub not_virtual_install_package { # in USER MODE that should NOT be done because we keep the information # there, but for now do it unconditionally if ($tlpobj->relocated) { - my $reloctree = $totlpdb->root . "/" . $TeXLive::TLConfig::RelocTree; - my $tlpkgdir = $reloctree . "/" . $TeXLive::TLConfig::InfraLocation; + my $reloctree = $totlpdb->root . "/" . $RelocTree; + my $tlpkgdir = $reloctree . "/" . $InfraLocation; my $tlpod = $tlpkgdir . "/tlpobj"; TeXLive::TLUtils::rmtree($tlpod) if (-d $tlpod); # we try to remove the tlpkg directory, that will succeed only @@ -2034,7 +2037,7 @@ sub _install_data { # if we are installing a reloc, add the RelocTree to the target if ($reloc) { if (!$totlpdb->setting("usertree")) { - $target .= "/$TeXLive::TLConfig::RelocTree"; + $target .= "/$RelocTree"; } } @@ -2047,10 +2050,10 @@ sub _install_data { } # we always assume that copy will work return(1); - } elsif ($what =~ m,\.tar\.$TeXLive::TLConfig::AcceptedCompressorsRegexp$,) { + } elsif ($what =~ m,\.tar\.$AcceptedCompressorsRegexp$,) { if ($reloc) { if (!$totlpdb->setting("usertree")) { - $target .= "/$TeXLive::TLConfig::RelocTree"; + $target .= "/$RelocTree"; } } my $ww = ($whatsize || "<unset>"); @@ -2418,17 +2421,17 @@ sub setting { sub reset_options { my $self = shift; - for my $k (keys %TeXLive::TLConfig::TLPDBOptions) { - $self->option($k, $TeXLive::TLConfig::TLPDBOptions{$k}->[1]); + for my $k (keys %TLPDBOptions) { + $self->option($k, $TLPDBOptions{$k}->[1]); } } sub add_default_options { my $self = shift; - for my $k (sort keys %TeXLive::TLConfig::TLPDBOptions) { + for my $k (sort keys %TLPDBOptions) { # if the option is not set already, do set it to defaults if (! $self->option($k) ) { - $self->option($k, $TeXLive::TLConfig::TLPDBOptions{$k}->[1]); + $self->option($k, $TLPDBOptions{$k}->[1]); } } } |