diff options
Diffstat (limited to 'Master/tlpkg/TeXLive')
-rw-r--r-- | Master/tlpkg/TeXLive/TLPDB.pm | 10 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLPOBJ.pm | 50 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 69 |
3 files changed, 114 insertions, 15 deletions
diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm index a5107eb3e5d..06ead92182e 100644 --- a/Master/tlpkg/TeXLive/TLPDB.pm +++ b/Master/tlpkg/TeXLive/TLPDB.pm @@ -21,6 +21,7 @@ C<TeXLive::TLPDB> -- A database of TeX Live Packages TeXLive::TLPDB->new (root => "/path/to/texlive/installation/root"); $tlpdb->root("/path/to/root/of/texlive/installation"); + $tlpdb->copy; $tlpdb->from_file($filename); $tlpdb->writeout; $tlpdb->writeout(FILEHANDLE); @@ -92,6 +93,15 @@ sub new { return $self; } + +sub copy { + my $self = shift; + my $bla = {}; + %$bla = %$self; + bless $bla, "TeXLive::TLPDB"; + return $bla; +} + =pod =item C<< $tlpdb->add_tlpobj($tlpobj) >> diff --git a/Master/tlpkg/TeXLive/TLPOBJ.pm b/Master/tlpkg/TeXLive/TLPOBJ.pm index 1395279ca66..f911f2a6cff 100644 --- a/Master/tlpkg/TeXLive/TLPOBJ.pm +++ b/Master/tlpkg/TeXLive/TLPOBJ.pm @@ -167,6 +167,18 @@ sub from_fh { $self->{'revision'} = "$1"; $lastcmd = "revision"; next; + } elsif ($line =~ /^containersize\s+([0-9]+)\s*/o) { + $self->containersize("$1"); + $lastcmd = "containersize"; + next; + } elsif ($line =~ /^srccontainersize\s+([0-9]+)\s*/o) { + $self->srccontainersize("$1"); + $lastcmd = "srccontainersize"; + next; + } elsif ($line =~ /^doccontainersize\s+([0-9]+)\s*/o) { + $self->doccontainersize("$1"); + $lastcmd = "doccontainersize"; + next; } elsif ($line =~ /^catalogue\s+(.*)\s*/o) { $self->catalogue("$1"); $lastcmd = "catalogue"; @@ -290,6 +302,12 @@ sub writeout { print $fd "execute $_\n"; } } + if (defined($self->{'containersize'})) { + print $fd "containersize $self->{'containersize'}\n"; + } + if (defined($self->{'doccontainersize'})) { + print $fd "doccontainersize $self->{'doccontainersize'}\n"; + } if (defined($self->{'docfiles'}) && (@{$self->{'docfiles'}})) { print $fd "docfiles size=$self->{'docsize'}\n"; foreach my $f (sort @{$self->{'docfiles'}}) { @@ -303,6 +321,9 @@ sub writeout { print $fd "\n"; } } + if (defined($self->{'srccontainersize'})) { + print $fd "srccontainersize $self->{'srccontainersize'}\n"; + } if (defined($self->{'srcfiles'}) && (@{$self->{'srcfiles'}})) { print $fd "srcfiles size=$self->{'srcsize'}\n"; foreach (sort @{$self->{'srcfiles'}}) { @@ -564,11 +585,14 @@ sub make_container { } else { tlwarn("Couldn't find $destdir/$tarname"); } + # compute the size + my $size = (stat "$destdir/$tarname.lzma") [7]; # cleaning up unlink("$tlpobjdir/$self->{'name'}.tlpobj"); rmdir("$tlpobjdir") if $removetlpobjdir; chdir($cwd); ddebug("Done $containername\n"); + return($size); } @@ -868,6 +892,21 @@ sub srcfiles { if (@_) { $self->{'srcfiles'} = [ @_ ] } return @{ $self->{'srcfiles'} }; } +sub containersize { + my $self = shift; + if (@_) { $self->{'containersize'} = shift } + return ( defined($self->{'containersize'}) ? $self->{'containersize'} : -1 ); +} +sub srccontainersize { + my $self = shift; + if (@_) { $self->{'srccontainersize'} = shift } + return ( defined($self->{'srccontainersize'}) ? $self->{'srccontainersize'} : -1 ); +} +sub doccontainersize { + my $self = shift; + if (@_) { $self->{'doccontainersize'} = shift } + return ( defined($self->{'doccontainersize'}) ? $self->{'doccontainersize'} : -1 ); +} sub srcsize { my $self = shift; if (@_) { $self->{'srcsize'} = shift } @@ -1124,6 +1163,17 @@ which set or get the current value of the respective sizes. Note that also the C<binsize> function returns (and takes as argument) a hash with the architectures as keys, similar to the C<runfiles> functions (see above). +Futhermore, if the tlpobj is contained ina tlpdb which describes a media +where the files are distributed in packed format (usually as .tar.lzma), +there are 3 more possible keys: + + $tlpobj->containersize + $tlpobj->doccontainersize + $tlpobj->srccontainersize + +describing the respective sizes in bytes. The latter two are only present +if src/doc file container splitting is activated for that install medium. + =head1 OTHER FUNCTIONS The following functions can be called for an C<TLPOBJ> object: diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index 4b9e18d2863..69f73071552 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -620,7 +620,7 @@ sub install_packages { } elsif (&media eq 'NET') { $container = "$TeXLiveURL/$NetArchive/$package.$DefaultContainerExtension"; } - install_package($container,\@installfiles,$totlpdb->root,$vars{'this_platform'}); + install_package($container, $tlpobj->containersize,\@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')) { @@ -633,13 +633,13 @@ sub install_packages { ($package !~ m/\./) && $tlpobj->srcfiles) { my $srccontainer = $container; $srccontainer =~ s/(\.tar\.lzma|\.zip)$/.source$1/; - install_package($srccontainer,\@installfiles,$totlpdb->root,$vars{'this_platform'}); + install_package($srccontainer, $tlpobj->srccontainersize,\@installfiles,$totlpdb->root,$vars{'this_platform'}); } if ($container_doc_split && $real_opt_doc && ($package !~ m/\./) && $tlpobj->docfiles) { my $doccontainer = $container; $doccontainer =~ s/(\.tar\.lzma|\.zip)$/.doc$1/; - install_package($doccontainer,\@installfiles,$totlpdb->root,$vars{'this_platform'}); + install_package($doccontainer, $tlpobj->doccontainersize, \@installfiles,$totlpdb->root,$vars{'this_platform'}); } } # we don't want to have wrong information in the tlpdb, so remove the @@ -665,11 +665,14 @@ sub install_packages { =pod -=item C<install_package($what, $filelistref, $target, $platform)> +=item C<install_package($what, $size, $filelistref, $target, $platform)> This function installs the files given in @$filelistref from C<$what> into C<$target>. +C<$size> gives the size in bytes of the container, or -1 if we are +installing from DVD, i.e., from a list of files to be copied. + If C<$what> is a reference to a list of files then these files are assumed to be readable and are copied to C<$target>, creating dirs on the way. In this case the list C<@$filelistref> is not taken into @@ -688,7 +691,7 @@ is not taken into account (should be fixed!). =cut sub install_package { - my ($what, $filelistref, $target, $platform) = @_; + my ($what, $whatsize, $filelistref, $target, $platform) = @_; my @filelist = @$filelistref; @@ -729,16 +732,40 @@ sub install_package { $lzmafile_quote = "\"$lzmafile\""; $tarfile_quote = "\"$tarfile\""; $target_quote = "\"$target\""; - if ($what =~ m,http://|ftp://,) { - # we are installing from the NET - # download the file and put it into temp - if (!download_file($what, $lzmafile) || (! -r $lzmafile)) { - die "Downloading $what did not succeed, please retry!"; + my $gotfiledone = 0; + if (-r $lzmafile) { + # check that the downloaded file is not partial + my $size = (stat $lzmafile)[7]; + if ($size == $whatsize) { + debug("Reusing already downloaded container $lzmafile\n"); + $gotfiledone = 1; + } else { + tlwarn("Partial download of $what found, removing it!\n"); + unlink($tarfile, $lzmafile); + } + } + if (!$gotfiledone) { + if ($what =~ m,http://|ftp://,) { + # we are installing from the NET + # download the file and put it into temp + if (!download_file($what, $lzmafile) || (! -r $lzmafile)) { + &main::create_profile("./installation.profile"); + tlwarn("Downloading $what did not succeed!\n"); + tlwarn("Please retry the install process.\n"); + tlwarn("Starting the installer will try to restart the installation!\n"); + tlwarn("If that doesn't work you can restart by running the installer with\n"); + if (win32()) { + tlwarn(" install-tl.bat --profile texlive.profile [other args]\n"); + } else { + tlwarn(" install-tl --profile texlive.profile [other args]\n"); + } + die "Downloading $what did not succeed!\n"; + } + } else { + # we are installing from CD + # copy it to temp + copy($what, "$target/temp"); } - } else { - # we are installing from CD - # copy it to temp - copy($what, "$target/temp"); } debug("Un-lzmaing $lzmafile to $tarfile\n"); system("$lzmadec < $lzmafile_quote > $tarfile_quote"); @@ -747,7 +774,9 @@ sub install_package { } debug("Unpacking $tarfile\n"); system($tar,"-x","-C",$target,"-f",$tarfile); - unlink($tarfile, $lzmafile); + unlink($tarfile); + debug("Keeping $lzmafile for restarting ...\n"); + # unlink($lzmafile); } else { die "Don't know how to install $what!\n"; } @@ -1391,6 +1420,16 @@ sub conv_to_win_path { return($p); } + +sub give_ctan_mirror { + my $originalurl = "http://mirror.ctan.org"; + my $wget = $::progs{'wget'}; + if (!defined($wget)) { + tlwarn("programs not set up, trying wget\n"); + } + + +} ############################################# # # Taken from Text::ParseWords |