diff options
author | Norbert Preining <preining@logic.at> | 2012-05-23 05:37:03 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2012-05-23 05:37:03 +0000 |
commit | 85722e162ab8bc579a5d6e199ea7d70ebc5d2bec (patch) | |
tree | 7b03e3522be968ee0cd94faf52cb97ccf37b4f87 /Master | |
parent | ed64153cb6d4b37b71ccc90c0d831943323ddeed (diff) |
allow computation of sizes of packages based on a set of platforms
git-svn-id: svn://tug.org/texlive/trunk@26588 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rwxr-xr-x | Master/texmf/scripts/texlive/tlmgr.pl | 6 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLPDB.pm | 26 |
2 files changed, 24 insertions, 8 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl index 181ff6702c4..a8d31c8f005 100755 --- a/Master/texmf/scripts/texlive/tlmgr.pl +++ b/Master/texmf/scripts/texlive/tlmgr.pl @@ -2564,11 +2564,12 @@ sub action_update { # sizes_of_packages returns the sizes of *all* packages if nothing # is passed over, so if @new and @updated both are empty we will # get something wrong back, namely the total size of all packages + # the third argument is undef to compute *all* platforms my %sizes; if (@alltodo) { %sizes = %{$remotetlpdb->sizes_of_packages( $localtlpdb->option("install_srcfiles"), - $localtlpdb->option("install_docfiles"), @alltodo)}; + $localtlpdb->option("install_docfiles"), undef, @alltodo)}; } else { $sizes{'__TOTAL__'} = 0; } @@ -3319,9 +3320,10 @@ sub action_install { return if (!@todo); my $currnr = 1; + # undef here is a ref to array of platforms, if undef all are used my %sizes = %{$remotetlpdb->sizes_of_packages( $localtlpdb->option("install_srcfiles"), - $localtlpdb->option("install_docfiles"), @todo)}; + $localtlpdb->option("install_docfiles"), undef, @todo)}; defined($sizes{'__TOTAL__'}) || ($sizes{'__TOTAL__'} = 0); my $totalsize = $sizes{'__TOTAL__'}; my $donesize = 0; diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm index 0cfb61bc74f..f5544485456 100644 --- a/Master/tlpkg/TeXLive/TLPDB.pm +++ b/Master/tlpkg/TeXLive/TLPDB.pm @@ -69,7 +69,7 @@ C<TeXLive::TLPDB> -- A database of TeX Live Packages $tlpdb->add_default_options(); $tlpdb->settings; $tlpdb->setting($key, [$value]); - $tlpdb->sizes_of_packages($opt_src, $opt_doc [, @packs ]); + $tlpdb->sizes_of_packages($opt_src, $opt_doc, $ref_arch_list [, @packs ]); $tlpdb->install_package($pkg, $dest_tlpdb); $tlpdb->remove_package($pkg, %options); $tlpdb->install_package_files($file [, $file ]); @@ -1242,7 +1242,7 @@ sub config_revision { =pod -=item C<< $tlpdb->sizes_of_packages ( $opt_src, $opt_doc, [ @packs ] ) >> +=item C<< $tlpdb->sizes_of_packages ( $opt_src, $opt_doc, $ref_arch_list, [ @packs ] ) >> This function returns a reference to a hash with package names as keys and the sizes in bytes as values. The sizes are computed for the arguments, @@ -1251,11 +1251,21 @@ or all packages if nothing was given. In case something has been computed one addition key is added C<__TOTAL__> which contains the total size of all packages under discussion. +If the third argument is a reference to a list of architectures, then +only the sizes for the binary packages for these architectures are used, +otherwise all sizes for all architectures are summed up. + =cut sub sizes_of_packages { - my ($self, $opt_src, $opt_doc, @packs) = @_; + my ($self, $opt_src, $opt_doc, $arch_list_ref, @packs) = @_; @packs || ( @packs = $self->list_packages() ); + my @archs; + if (defined($arch_list_ref)) { + @archs = @$arch_list_ref; + } + # if nothing is passed on, then we keep @archs undefined, which means + # use all architectures my %tlpsizes; my %tlpobjs; my $totalsize; @@ -1266,7 +1276,7 @@ sub sizes_of_packages { warn "STRANGE: $p not to be found in ", $self->root; next; } - $tlpsizes{$p} = $self->size_of_one_package($media, $tlpobjs{$p}, $opt_src, $opt_doc); + $tlpsizes{$p} = $self->size_of_one_package($media, $tlpobjs{$p}, $opt_src, $opt_doc, @archs); $totalsize += $tlpsizes{$p}; } if ($totalsize) { @@ -1276,7 +1286,7 @@ sub sizes_of_packages { } sub size_of_one_package { - my ($self, $media, $tlpobj, $opt_src, $opt_doc) = @_; + my ($self, $media, $tlpobj, $opt_src, $opt_doc, @used_archs) = @_; my $size = 0; if ($media ne 'local_uncompressed') { # we use the container size as the measuring unit since probably @@ -1291,7 +1301,11 @@ sub size_of_one_package { $size += $tlpobj->srcsize if $opt_src; $size += $tlpobj->docsize if $opt_doc; my %foo = %{$tlpobj->binsize}; - for my $k (keys %foo) { $size += $foo{$k}; } + for my $k (keys %foo) { + if (@used_archs && member($k, @used_archs)) { + $size += $foo{$k}; + } + } # all the packages sizes are in blocks, so transfer that to bytes $size *= $TeXLive::TLConfig::BlockSize; } |