diff options
author | Reinhard Kotucha <reinhard.kotucha@web.de> | 2007-11-22 00:22:39 +0000 |
---|---|---|
committer | Reinhard Kotucha <reinhard.kotucha@web.de> | 2007-11-22 00:22:39 +0000 |
commit | dfb6bdbf57381dee41c53ad055efe834086443d7 (patch) | |
tree | daba61120e874efe08ea3516612c652b67fbfc54 /Master/install-tl.pl | |
parent | 8d88a7c56c0ec28e74131518d5dbffcb1902b9ff (diff) |
install-tl.pl: Norbert's functions added.
git-svn-id: svn://tug.org/texlive/trunk@5540 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/install-tl.pl')
-rwxr-xr-x | Master/install-tl.pl | 168 |
1 files changed, 91 insertions, 77 deletions
diff --git a/Master/install-tl.pl b/Master/install-tl.pl index 0366d8428c3..619f286a556 100755 --- a/Master/install-tl.pl +++ b/Master/install-tl.pl @@ -7,7 +7,7 @@ # This file is licensed under the GNU General Public License version 2 # or any later version. -$texlive_release="2007"; +$texlive_release="2008"; BEGIN { $^W = 1; @@ -22,12 +22,16 @@ use TeXLive::TLUtils qw(initialize_installer media platform platform_desc additional_architectures_available_from_net get_system_tmpdir member); use TeXLive::TLPOBJ; use TeXLive::TLPDB; +use TeXLive::TLConfig; use Cwd; +#print "$TeXLive::TLConfig::InfraLocation/texlive.tlpdb\n"; + $default_scheme='scheme-full'; ###$texlive_url='http://localhost/texlive/Contents/inst'; -$texlive_url='http://tug.org/svn/texlive/trunk/Master'; +$texlive_url='http://tug.org/svn/texlive/trunk/Master/' + . "$TeXLive::TLConfig::InfraLocation"; # The maximum number of binary systems on the CD. This number must be # smaller than the number of binaries available from the network. @@ -49,12 +53,13 @@ print "Directory for Temporary Files: '", get_system_tmpdir, "\'\n"; my %vars; sub dump_vars { - open VARS, ">./vars"; + my $filename=shift; + open VARS, ">$filename"; foreach $key (keys %vars) { print VARS "$key $vars{$key}\n"; } close VARS; - print "\n%vars dumped to ./vars.\n"; + print "\n%vars dumped to '$filename'.\n"; } @@ -136,6 +141,71 @@ sub set_texlive_default_dirs { ); +sub calc_depends { + my $size; + # First look for packages in the selected scheme. + + my $scheme=$tlpdb->get_package($vars{'selected_scheme'}); + + for my $scheme_content ($scheme->depends) { + $install{"$scheme_content"}=1 unless ($scheme_content=~/^collection-/); + } + + # Now look for collections in the %vars hash. These are not + # necessarily the collections required by a scheme. The final + # decision is made in the collections/languages menu. + + my @collections; + + foreach my $key (keys %vars) { + if ($key=~/^collection-/) { + push @collections, $key if $vars{$key}; + } + } + + # Now we look for packages in collections. A collection can contain + # other collections. In this case we push it to the @collections + # list if it doesn't exist already. + + foreach my $selected_collection (@collections) { + my $collection=$tlpdb->get_package($selected_collection); + + for my $package ($collection->depends) { + if ($package=~/^collection-/) { + push @collections, $package + unless member $package, @collections; + } else { + my $tlpobj = $tlpdb->{'tlps'}{$package}; + if ($tlpobj->category eq "Package") { + $install{"$package"}=1; + $size+=$tlpobj->docsize if $vars{'option_doc'}; + $size+=$tlpobj->srcsize if $vars{'option_src'}; + $size+=$tlpobj->runsize; + } elsif ($tlpobj->category eq "TLCore") { + if ($package=~/^bin-/) { + my %binsizes = %{$tlpobj->binsize}; + foreach my $arch (keys %binsizes) { + if ((defined $vars{"diskbin_$arch"} and + $vars{"diskbin_$arch"}==1) || + (defined $vars{"netbin_$arch"} and + $vars{"netbin_$arch"}==1)) { + $install{"$package"}=1; + $size+=$binsizes{$arch}; + } + } + } else { + $install{"$package"}=1; + } + } + } + } + } + $vars{'total_size'}=sprintf "%d", $size/1024**2; +# printf "Total: %d MB\n", $size/1024**2; +} + + + sub clear_screen { # return 0; (unix)? system 'clear':system 'cls'; @@ -200,9 +270,9 @@ sub prompt { sub load_tlpdb { my $database; if (media eq 'NET') { - $database='http://www.tug.org/svn/texlive/trunk/Master/texlive.tlpdb'; + $database="http://www.tug.org/svn/texlive/trunk/Master/$TeXLive::TLConfig::InfraLocation/texlive.tlpdb"; } else { - $database='./texlive.tlpdb'; + $database="./$TeXLive::TLConfig::InfraLocation/texlive.tlpdb"; } print "Loading $database ...\n"; $::tlpdb=TeXLive::TLPDB->new(location => "$database"); @@ -768,7 +838,7 @@ EOF sub quit { - dump_vars; + dump_vars './vars'; exit 0; } @@ -798,6 +868,7 @@ sub main_menu { ++$vars{'n_collections_selected'} if $vars{$key}==1; } } + calc_depends; my %command=( 'self' => \&main_menu, @@ -861,67 +932,12 @@ EOF } -sub calc_depends { - # First look for packages in the selected scheme. - - my $scheme=$tlpdb->get_package($vars{'selected_scheme'}); - - for my $scheme_content ($scheme->depends) { - $install{"$scheme_content"}=1 unless ($scheme_content=~/^collection-/); - } - - # Now look for collections in the %vars hash. These are not - # necessarily the collections required by a scheme. The final - # decision is made in the collections/languages menu. - - my @collections; - - foreach my $key (keys %vars) { - if ($key=~/^collection-/) { - push @collections, $key if $vars{$key}; - } - } -# printf "%d collections\n", @collections+0; - - # Now we look for packages in collections. A collection can contain - # other collections. In this case we push it to the @collections - # list if it doesn't exist already. - - foreach my $selected_collection (@collections) { - my $collection=$tlpdb->get_package($selected_collection); - - for my $collection_content ($collection->depends) { - if ($collection_content=~/^collection-/) { - push @collections, $collection_content - unless member $collection_content, @collections; - } else { - $install{"$collection_content"}=1; - } - } - } - - # we also want to packages of the collections, so we add the collections - # now to the list of install packages - foreach $selected_collection (@collections) { - $install{"$selected_collection"}=1; - } - -# printf "%d\n", @collections+0; -# print "---------------\n"; -# foreach my $pkg (keys %install) { -# print "Package $pkg\n"; -# } -# print "---------------\n"; -# foreach my $col (@collections) { -# print "$col\n"; -# } -} sub create_profile { # The file "TLprofile" is created at the beginning of the # installation process and contains information about the current # setup. The purpose is to allow non-interactive installations. - open PROFILE, ">$profilepath/TLprofile"; + open PROFILE, ">$profilepath/texlive.profile"; print PROFILE "selected_scheme $vars{selected_scheme}\n"; foreach my $key (keys %vars) { print PROFILE "$key $vars{$key}\n" @@ -962,27 +978,27 @@ sub add_tlpcontainer { } sub _add_tlpcontainer { - my ($package, $ziplocation, $arch, $dest) = @_; + my ($package, $ziplocation, $arch, $dest)=@_; my $unpackprog; my $args; # WARNING: If you change the location of the texlive.tlpdb this # has to be changed, too!! die ("No destination given, bad!\n") unless (defined($dest)); if ($arch ne "all") { - $package .= ".$arch"; + $package.=".$arch"; } my $container = "$ziplocation/$package"; if (-r "$container.zip") { - $container .= ".zip"; + $container.=".zip"; $unpackprog="unzip -o -qq $container -d $dest"; } elsif (-r "$container.tar.lzma") { - $container .= ".tar.lzma"; - $unpackprog = "lzcat $conainer | tar -xf - -C $dest"; + $container.=".tar.lzma"; + $unpackprog="lzcat $conainer | tar -xf - -C $dest"; die("lzma is checked for but not implemented, please edit TLPDB.pm\n"); } else { warn "Cannot find a package $package (.zip or .lzma) in $ziplocation\n"; # should be die, only for testing - my $tlpobj = $::tlpdb->get_package($package); + my $tlpobj=$::tlpdb->get_package($package); return $tlpobj; } warn "Huuu, this needs testing and error checking!\n"; @@ -990,14 +1006,12 @@ sub _add_tlpcontainer { `$unpackprog`; # we only create/add tlpobj for arch eq "all" if ($arch eq "all") { - my $tlpobj = $::tlpdb->get_package($package); + my $tlpobj=$::tlpdb->get_package($package); $::localtlpdb->add_tlpobj($tlpobj); return $tlpobj; } } - - # container_location # returns for every package (argument) the location of the respective # containers. It also COULD download necessary packages and return a @@ -1019,12 +1033,12 @@ sub install_files { my @archs = (); foreach (keys %vars) { if (m/^diskbin_(.*)$/ ) { - if ($vars{$_}) { push @archs, $1; } + if ($vars{$_}) {push @archs, $1;} } } - my $destination = "$vars{TEXDIR}/$texlive_release"; + my $destination="$vars{TEXDIR}/$texlive_release"; foreach my $p (keys %install) { - my $containerdir = container_location($p); + my $containerdir=container_location($p); add_tlpcontainer($p, $containerdir, \@archs, $destination); } } @@ -1043,10 +1057,10 @@ foreach my $k (keys %install) { print "INSTALL $k\n"; } -dump_vars; +dump_vars './vars'; $profilepath='.'; create_profile; -print "Profile written to $profilepath/TLprofile\n"; +print "Profile written to $profilepath/texlive.profile\n"; __END__ |