diff options
Diffstat (limited to 'Master/tlpkg/TeXLive')
-rw-r--r-- | Master/tlpkg/TeXLive/TLConfig.pm | 12 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLMedia.pm | 14 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 164 |
3 files changed, 33 insertions, 157 deletions
diff --git a/Master/tlpkg/TeXLive/TLConfig.pm b/Master/tlpkg/TeXLive/TLConfig.pm index 41b31fcccb6..67f260a00f3 100644 --- a/Master/tlpkg/TeXLive/TLConfig.pm +++ b/Master/tlpkg/TeXLive/TLConfig.pm @@ -21,12 +21,10 @@ BEGIN { $InfraLocation $DatabaseName $BlockSize - $NetArchive - $DiskArchive + $Archive $TeXLiveServerURL $TeXLiveServerPath $TeXLiveURL - $TeXLiveAlternativeURL $WinSpecialUpdatePackagesRegexp ); @EXPORT = @EXPORT_OK; @@ -55,14 +53,11 @@ our $BlockSize = 4096; # the way we package things on the web our $DefaultContainerExtension = "tar.lzma"; -our $NetArchive = "tlpkg"; -our $DiskArchive = "archive"; +our $Archive = "archive"; our $TeXLiveServerURL = "http://mirror.ctan.org"; our $TeXLiveServerPath = "systems/texlive/tlnet/tldev"; our $TeXLiveURL = "$TeXLiveServerURL/$TeXLiveServerPath"; -our $TeXLiveAlternativeURL; # idea that didn't pan out - our $WinSpecialUpdatePackagesRegexp = '^(texlive\.infra|luatex|bin-tlperl\.win32$|bin-texlive|bin-kpathsea)'; @@ -123,8 +118,7 @@ C<tlpkg>. The assumed block size, currently 4k. -=item C<$TeXLive::TLConfig::NetArchive> -=item C<$TeXLive::TLConfig::DiskArchive> +=item C<$TeXLive::TLConfig::Archive> =item C<$TeXLive::TLConfig::TeXLiveURL> These values specify where to find packages. diff --git a/Master/tlpkg/TeXLive/TLMedia.pm b/Master/tlpkg/TeXLive/TLMedia.pm index 71be3ea3dee..03fb7301bed 100644 --- a/Master/tlpkg/TeXLive/TLMedia.pm +++ b/Master/tlpkg/TeXLive/TLMedia.pm @@ -30,7 +30,7 @@ sub new } else { if (-d "$location/texmf/web2c") { $media = 'DVD'; - } elsif (-d "$location/$DiskArchive") { + } elsif (-d "$location/$Archive") { $media = 'CD'; } else { # we cannot find the right type, return undefined, that should @@ -143,17 +143,17 @@ sub install_package { if ($media eq 'DVD') { $container = \@installfiles; } elsif ($media eq 'CD') { - if (-r "$location/$DiskArchive/$pkg.zip") { - $container = "$location/$DiskArchive/$pkg.zip"; - } elsif (-r "$location/$DiskArchive/$pkg.tar.lzma") { - $container = "$location/$DiskArchive/$pkg.tar.lzma"; + if (-r "$location/$Archive/$pkg.zip") { + $container = "$location/$Archive/$pkg.zip"; + } elsif (-r "$location/$Archive/$pkg.tar.lzma") { + $container = "$location/$Archive/$pkg.tar.lzma"; } else { # for now only warn and return, should (?) be die!? - tlwarn("Cannot find a package $pkg (.zip or .lzma) in $location/$DiskArchive\n"); + tlwarn("Cannot find a package $pkg (.zip or .lzma) in $location/$Archive\n"); next; } } elsif (&media eq 'NET') { - $container = "$location/$NetArchive/$pkg.$DefaultContainerExtension"; + $container = "$location/$Archive/$pkg.$DefaultContainerExtension"; } $self->_install_package($container,\@installfiles,$totlpdb); # if we are installing from CD or NET we have to fetch the respective diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index a3470b09a43..e337fe845d3 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -46,15 +46,13 @@ C<TeXLive::TLUtils> -- utilities used in the TeX Live infrastructure =head2 Installer Functions - TeXLive::TLUtils::media; - TeXLive::TLUtils::initialize_installer; TeXLive::TLUtils::make_var_skeleton($path); TeXLive::TLUtils::make_local_skeleton($path); TeXLive::TLUtils::create_fmtutil($tlpdb,$dest,$localconf); TeXLive::TLUtils::create_updmap($tlpdb,$dest,$localconf); TeXLive::TLUtils::create_language_dat($tlpdb,$dest,$localconf); TeXLive::TLUtils::create_language_def($tlpdb,$dest,$localconf); - TeXLive::TLUtils::install_packages($from_tlpdb,$to_tlpdb,$what,$opt_src, $opt_doc)>); + TeXLive::TLUtils::install_packages($from_tlpdb,$media,$to_tlpdb,$what,$opt_src, $opt_doc)>); TeXLive::TLUtils::install_package($what, $filelistref, $target, $platform); =head2 Miscellaneous @@ -96,8 +94,6 @@ BEGIN { © &install_package &install_packages - &media - &initialize_installer &make_var_skeleton &make_local_skeleton &create_fmtutil @@ -751,7 +747,7 @@ sub copy { =pod -=item C<install_packages($from_tlpdb, $to_tlpdb, $what, $opt_src, $opt_doc)> +=item C<install_packages($from_tlpdb, $media, $to_tlpdb, $what, $opt_src, $opt_doc)> Installs the list of packages found in C<@$what> (a ref to a list) into the TLPDB given by C<$to_tlpdb>. Information on files are taken from @@ -763,9 +759,10 @@ installed (currently implemented only for installation from DVD). =cut sub install_packages { - my ($fromtlpdb,$totlpdb,$what,$opt_src,$opt_doc) = @_; + my ($fromtlpdb,$media,$totlpdb,$what,$opt_src,$opt_doc) = @_; my $container_src_split = $fromtlpdb->config_src_container; my $container_doc_split = $fromtlpdb->config_doc_container; + my $root = $fromtlpdb->root; foreach my $package (@$what) { info("Installing: $package\n"); foreach my $h (@::install_packages_hook) { @@ -788,25 +785,25 @@ sub install_packages { push @installfiles, $tlpobj->allbinfiles; push @installfiles, $tlpobj->srcfiles if ($opt_src); push @installfiles, $tlpobj->docfiles if ($real_opt_doc); - if (&media eq 'DVD') { - $container = \@installfiles; - } elsif (&media eq 'CD') { - if (-r "$::installerdir/$DiskArchive/$package.zip") { - $container = "$::installerdir/$DiskArchive/$package.zip"; - } elsif (-r "$::installerdir/$DiskArchive/$package.tar.lzma") { - $container = "$::installerdir/$DiskArchive/$package.tar.lzma"; + if ($media eq 'DVD') { + $container = [ $root, @installfiles ]; + } elsif ($media eq 'CD') { + if (-r "$root/$Archive/$package.zip") { + $container = "$root/$Archive/$package.zip"; + } elsif (-r "$root/$Archive/$package.tar.lzma") { + $container = "$root/$Archive/$package.tar.lzma"; } else { # for now only warn and return, should (?) be die!? - tlwarn("Cannot find a package $package (.zip or .lzma) in $::installerdir/$DiskArchive\n"); + tlwarn("Cannot find a package $package (.zip or .lzma) in $root/$Archive\n"); next; } - } elsif (&media eq 'NET') { - $container = "$TeXLiveURL/$NetArchive/$package.$DefaultContainerExtension"; + } elsif ($media eq 'NET') { + $container = "$root/$Archive/$package.$DefaultContainerExtension"; } install_package($container, $tlpobj->containersize, $tlpobj->containermd5, \@installfiles,$totlpdb->root,$vars{'this_platform'}); # if we are installing from CD or NET we have to fetch the respective # source and doc packages $pkg.source and $pkg.doc and install them, too - if ((&media eq 'NET') || (&media eq 'CD')) { + if (($media eq 'NET') || ($media eq 'CD')) { # we install split containers under the following conditions: # - the container were split generated # - src/doc files should be installed @@ -888,12 +885,13 @@ sub install_package { } if (ref $what) { # we are getting a ref to a list of files, so install from DVD - foreach my $file (@$what) { + my ($root, @files) = @$what; + foreach my $file (@files) { # @what is taken, not @filelist! # is this still needed? my $dn=dirname($file); mkdirhier("$target/$dn"); - copy "$file", "$target/$dn"; + copy "$root/$file", "$target/$dn"; } } elsif ($what =~ m,\.tar.lzma$,) { # this is the case when we install from CD or the NET @@ -1010,8 +1008,8 @@ sub setup_programs { if (!defined($platform) || ($platform eq "")) { # we assume that we run from the DVD, so we can call platform() and # thus also the config.guess script - # but we have to setup $::installerdir because that stupid - # platform script relies on it + # but we have to setup $::installerdir because the platform script + # relies on it $::installerdir = "$bindir/../.."; $platform = platform(); } @@ -1034,8 +1032,8 @@ sub setup_programs { =item C<download_file( $relpath, $destination [, $progs ] )> -Try to download the file given in C<$relpath> from either C<$TeXLiveURL> -or C<TeXLiveAlternativeURL> into C<$destination>, which can be either +Try to download the file given in C<$relpath> from C<$TeXLiveURL> +into C<$destination>, which can be either a filename of simply C<|>. In the latter case a file handle is returned. The optional argument C<$progs> is a reference to a hash giving full pathes @@ -1077,20 +1075,7 @@ sub download_file { $url = "$TeXLiveURL/$relpath"; } my $ret = _download_file($url, $dest, $wget); - return($ret) if $ret; - # if we have a full url given do NOT try an alternative url - if ($relpath =~ /^(http|ftp):\/\//) { - # we did get a full url, give up immediately - return undef; - } - # we are still here ... try it with Alternative URL: - return undef unless ($TeXLiveAlternativeURL); - # we are still here and TeXLiveAlternativeURL is defined - $url = "$TeXLiveAlternativeURL/$relpath"; - $ret = _download_file($url, $dest, $wget); - return($ret) if $ret; - # still not found, give up - return undef; + return($ret); } sub _download_file { @@ -1128,63 +1113,6 @@ sub _download_file { } } -sub install_package_old { -# either a list of files or a name of one .zip or .tar.lzma file. - my @what=@_; - - my $target="$::vars{'TEXDIR'}"; - my $bindir="$::installerdir/tlpkg/bin"; - my $platform=&platform; - my $buffer; - my $offset; - # shouldn't it be 4096 - my $blocksize=2048; - - #my $lzmadec="$bindir/lzmadec_$platform"; - my $lzmadec="lzmadec"; - my $tar="/bin/tar -xf - -C"; - my $wget="wget -nv -O-"; - if (win32) { - $lzmadec="$bindir/lzma/lzma.exe -si -so"; - $tar="$bindir/tar.exe -xf - -C"; - $wget="$bindir/wget.exe -nv -O-"; - } - - if (&media eq 'DVD') { - foreach my $file (@what) { - my $dn=dirname($file); - mkdirhier("$target/$dn"); - copy "$file", "$target/$dn"; - } - } elsif (&media eq 'CD') { - my $package="$::installerdir/$DiskArchive/$what[0]"; - open IN, "$package" - or die "Can't open '$package': $!\n"; - binmode IN; - - open OUT, "|$lzmadec|$tar $target"; - binmode OUT; - - while ($read=sysread IN, $buffer, $blocksize) { - die "system read error: $!\n" unless defined $read; - $offset=0; - while ($read) { - $written=syswrite OUT, $buffer, $read, $offset; - die "system write error: $!\n" unless defined $written; - $read-=$written; - $offset+=$written; - } - } - close OUT; - close IN; - } elsif (&media eq 'NET') { - my $package="$TeXLiveURL/$NetArchive/$what[0]"; - system "$wget $package|$lzmadec|$tar $target"; - } else { - die "This can't happen."; - } -} - =pod =back @@ -1193,52 +1121,6 @@ sub install_package_old { =over 6 - -=item C<media> - -Return media type. Either C<CD>, C<DVD>, or C<NET>. - -The result is stored in a global variable C<$::_media_>. If you call -C<media> repeatedly, only the first call of C<media> will access the -CD/DVD. - -=cut - -sub media { - unless (defined $::_media_) { - if (-d "$::installerdir/$DiskArchive") { - $::_media_='CD'; - } elsif (-d "$::installerdir/texmf/web2c") { - $::_media_='DVD'; - } else { - $::_media_='NET'; - } - } - return $::_media_; -} - -=pod - -=item C<initialize_installer> - -The function C<initialize_installer> calls C<media> and C<platform> in -order to set the variables C<$::_media_> and C<$::_platform_>. - -Note that C<$0> contains backslashes as path separators on Windows. - -Repeatedly calls to C<media> or C<platform> do not access the CD/DVD -again. - -=cut - -sub initialize_installer { - &media; - &platform; - $ENV{'WGETRC'}="$::installerdir/tlpkg/installer/wgetrc" -} - -=pod - =item C<make_var_skeleton($prefix)> Generate a skeleton of empty directories in the C<TEXMFSYSVAR> tree. |