summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2017-05-11 02:41:34 +0000
committerNorbert Preining <preining@logic.at>2017-05-11 02:41:34 +0000
commit7925f1b113e65204670e5ffc7b5555ceebcf679e (patch)
tree3652e642ffde29033c2af4c9bd811da59c1798be /Master/tlpkg/TeXLive
parent7715cab10d0dc23918aeb484da4a432f3e27fd14 (diff)
support display of accumulated size information for schemes/collections
git-svn-id: svn://tug.org/texlive/trunk@44289 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive')
-rw-r--r--Master/tlpkg/TeXLive/TLPDB.pm67
1 files changed, 59 insertions, 8 deletions
diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm
index d8a185eb60c..0682343804e 100644
--- a/Master/tlpkg/TeXLive/TLPDB.pm
+++ b/Master/tlpkg/TeXLive/TLPDB.pm
@@ -66,6 +66,7 @@ C<TeXLive::TLPDB> -- A database of TeX Live Packages
$tlpdb->setting($key, [$value]);
$tlpdb->setting([-clear], $key, [$value]);
$tlpdb->sizes_of_packages($opt_src, $opt_doc, $ref_arch_list [, @packs ]);
+ $tlpdb->sizes_of_packages_with_deps($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 ]);
@@ -1362,19 +1363,23 @@ sub config_revision {
return "";
}
-
=pod
+=item C<< $tlpdb->sizes_of_packages_with_deps ( $opt_src, $opt_doc, $ref_arch_list, [ @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
+These functions return a reference to a hash with package names as keys
and the sizes in bytes as values. The sizes are computed for the list of
package names given as the fourth argument, or all packages if not
-specified.
+specified. The difference between the two functions is that the C<_with_deps>
+gives the size of packages including the size of all depending sizes.
If anything has been computed one additional key is synthesized,
C<__TOTAL__>, which contains the total size of all packages under
-consideration.
+consideration. In the case of <_with_deps> this total computation
+does B<not> count packages multiple times, even if they appear
+multiple times as dependencies.
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,
@@ -1384,7 +1389,25 @@ otherwise all sizes for all architectures are summed.
sub sizes_of_packages {
my ($self, $opt_src, $opt_doc, $arch_list_ref, @packs) = @_;
+ return $self->_sizes_of_packages(0, $opt_src, $opt_doc, $arch_list_ref, @packs);
+}
+
+sub sizes_of_packages_with_deps {
+ my ($self, $opt_src, $opt_doc, $arch_list_ref, @packs) = @_;
+ return $self->_sizes_of_packages(1, $opt_src, $opt_doc, $arch_list_ref, @packs);
+}
+
+
+sub _sizes_of_packages {
+ my ($self, $with_deps, $opt_src, $opt_doc, $arch_list_ref, @packs) = @_;
@packs || ( @packs = $self->list_packages() );
+ my @expacks;
+ if ($with_deps) {
+ # don't expand collection->collection dependencies
+ @exppacks = $self->expand_dependencies('-no-collections', $self, @packs);
+ } else {
+ @exppacks = @packs;
+ }
my @archs;
if ($arch_list_ref) {
@archs = @$arch_list_ref;
@@ -1395,21 +1418,49 @@ sub sizes_of_packages {
my %tlpsizes;
my %tlpobjs;
my $totalsize;
- foreach my $p (@packs) {
+ foreach my $p (@exppacks) {
$tlpobjs{$p} = $self->get_package($p);
my $media = $self->media_of_package($p);
if (!defined($tlpobjs{$p})) {
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, @archs);
+ #
+ # in case we are calling the _with_deps variant, we always
+ # compute *UNCOMPRESSED* sizes (not the container sizes!!!)
+ if ($with_deps) {
+ $tlpsizes{$p} = $self->size_of_one_package('local_uncompressed' , $tlpobjs{$p},
+ $opt_src, $opt_doc, @archs);
+ } else {
+ $tlpsizes{$p} = $self->size_of_one_package($media, $tlpobjs{$p},
+ $opt_src, $opt_doc, @archs);
+ }
$totalsize += $tlpsizes{$p};
}
if ($totalsize) {
$tlpsizes{'__TOTAL__'} = $totalsize;
}
- return \%tlpsizes;
+ my %realtlpsizes;
+ for my $p (@packs) {
+ $realtlpsizes{$p} = $tlpsizes{$p};
+ if ($with_deps) {
+ # do a second round and compute the sizes with dependencies
+ for my $d ($tlpobjs{$p}->depends) {
+ next if ($d =~ m/\.ARCH/);
+ next if ($d =~ m/\.win32/ && !TeXLive::TLUtils::member('win32', @archs));
+ next if ($d =~ m/^collection-/);
+ next if ($d =~ m/^scheme-/);
+ if (defined($tlpsizes{$d})) {
+ $realtlpsizes{$p} += $tlpsizes{$d};
+ } else {
+ # silently ignore missing defined packages - they should have
+ # been computed by expand-dependencies
+ debug("TLPDB.pm: size with deps: sub package not found main=$d, dep=$p\n");
+ }
+ }
+ }
+ }
+ return \%realtlpsizes;
}
sub size_of_one_package {