texlive[47801] Master/tlpkg/TeXLive/TLPDB.pm: use imported names

commits+preining at tug.org commits+preining at tug.org
Wed May 23 04:32:20 CEST 2018


Revision: 47801
          http://tug.org/svn/texlive?view=revision&revision=47801
Author:   preining
Date:     2018-05-23 04:32:20 +0200 (Wed, 23 May 2018)
Log Message:
-----------
use imported names instead of fully qualified names of TLConfig

Modified Paths:
--------------
    trunk/Master/tlpkg/TeXLive/TLPDB.pm

Modified: trunk/Master/tlpkg/TeXLive/TLPDB.pm
===================================================================
--- trunk/Master/tlpkg/TeXLive/TLPDB.pm	2018-05-23 02:32:11 UTC (rev 47800)
+++ trunk/Master/tlpkg/TeXLive/TLPDB.pm	2018-05-23 02:32:20 UTC (rev 47801)
@@ -92,7 +92,10 @@
 
 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 @@
     #
     # 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 @@
     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,20 +505,20 @@
   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());
     #   }
@@ -522,13 +525,13 @@
     #   $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 @@
   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 @@
   # 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 @@
     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 @@
     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 @@
       # - 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 @@
       # 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 @@
     # 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 @@
     }
     # 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 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]);
     }
   }
 }



More information about the tex-live-commits mailing list