summaryrefslogtreecommitdiff
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
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
-rwxr-xr-xMaster/texmf-dist/scripts/texlive/tlmgr.pl88
-rw-r--r--Master/tlpkg/TeXLive/TLPDB.pm67
2 files changed, 110 insertions, 45 deletions
diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl
index 1c073b7c17d..5d6e3448ac0 100755
--- a/Master/texmf-dist/scripts/texlive/tlmgr.pl
+++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl
@@ -1529,46 +1529,56 @@ sub action_info {
print "longdesc: ", $tlp->longdesc, "\n" if ($tlp->longdesc);
print "installed: ", ($installed ? "Yes" : "No"), "\n";
print "revision: ", $tlp->revision, "\n" if ($installed);
- # print out sizes
+ #
+ # size computation: for normal packages give src/run/doc/bin sizes
+ # for scheme/collection accumulated (including deps) sizes
my $sizestr = "";
- my $srcsize = $tlp->srcsize * $TeXLive::TLConfig::BlockSize;
- $sizestr = sprintf("%ssrc: %dk", $sizestr, int($srcsize / 1024) + 1)
- if ($srcsize > 0);
- my $docsize = $tlp->docsize * $TeXLive::TLConfig::BlockSize;
- $sizestr .= sprintf("%sdoc: %dk",
- ($sizestr ? ", " : ""), int($docsize / 1024) + 1)
- if ($docsize > 0);
- my $runsize = $tlp->runsize * $TeXLive::TLConfig::BlockSize;
- $sizestr .= sprintf("%srun: %dk",
- ($sizestr ? ", " : ""), int($runsize / 1024) + 1)
- if ($runsize > 0);
- # check for .ARCH expansions
- my $do_archs = 0;
- for my $d ($tlp->depends) {
- if ($d =~ m/^(.*)\.ARCH$/) {
- $do_archs = 1;
- last;
+ if ($tlp->category ne "Collection" && $tlp->category ne "Scheme") {
+ my $srcsize = $tlp->srcsize * $TeXLive::TLConfig::BlockSize;
+ $sizestr = sprintf("%ssrc: %dk", $sizestr, int($srcsize / 1024) + 1)
+ if ($srcsize > 0);
+ my $docsize = $tlp->docsize * $TeXLive::TLConfig::BlockSize;
+ $sizestr .= sprintf("%sdoc: %dk",
+ ($sizestr ? ", " : ""), int($docsize / 1024) + 1)
+ if ($docsize > 0);
+ my $runsize = $tlp->runsize * $TeXLive::TLConfig::BlockSize;
+ $sizestr .= sprintf("%srun: %dk",
+ ($sizestr ? ", " : ""), int($runsize / 1024) + 1)
+ if ($runsize > 0);
+ # check for .ARCH expansions
+ my $do_archs = 0;
+ for my $d ($tlp->depends) {
+ if ($d =~ m/^(.*)\.ARCH$/) {
+ $do_archs = 1;
+ last;
+ }
}
- }
- if ($do_archs) {
- my @a = $localtlpdb->available_architectures;
- my %binsz = %{$tlp->binsize};
- my $binsize = 0;
- for my $a (@a) {
- $binsize += $binsz{$a} if defined($binsz{$a});
- my $atlp = $tlpdb->get_package($tlp->name . ".$a");
- if (!$atlp) {
- tlwarn("$prg: cannot find depending package" . $tlp->name . ".$a\n");
- $ret |= $F_WARNING;
- next;
+ if ($do_archs) {
+ my @a = $localtlpdb->available_architectures;
+ my %binsz = %{$tlp->binsize};
+ my $binsize = 0;
+ for my $a (@a) {
+ $binsize += $binsz{$a} if defined($binsz{$a});
+ my $atlp = $tlpdb->get_package($tlp->name . ".$a");
+ if (!$atlp) {
+ tlwarn("$prg: cannot find depending package" . $tlp->name . ".$a\n");
+ $ret |= $F_WARNING;
+ next;
+ }
+ my %abinsz = %{$atlp->binsize};
+ $binsize += $abinsz{$a} if defined($abinsz{$a});
}
- my %abinsz = %{$atlp->binsize};
- $binsize += $abinsz{$a} if defined($abinsz{$a});
+ $binsize *= $TeXLive::TLConfig::BlockSize;
+ $sizestr .= sprintf("%sbin: %dk",
+ ($sizestr ? ", " : ""), int($binsize / 1024) + 1)
+ if ($binsize > 0);
+ }
+ } else {
+ # case of collection or scheme
+ my $foo = $tlpdb->sizes_of_packages_with_deps ( 1, 1, undef, $pkg);
+ if (defined($foo->{$pkg})) {
+ $sizestr = sprintf("%dk", int($foo->{$pkg} / 1024) + 1);
}
- $binsize *= $TeXLive::TLConfig::BlockSize;
- $sizestr .= sprintf("%sbin: %dk",
- ($sizestr ? ", " : ""), int($binsize / 1024) + 1)
- if ($binsize > 0);
}
print "sizes: ", $sizestr, "\n";
print "relocatable: ", ($tlp->relocated ? "Yes" : "No"), "\n";
@@ -7367,10 +7377,14 @@ With the single word C<collections> or C<schemes> as the argument, lists
the request type instead of all packages.
With any other arguments, display information about I<pkg>: the name,
-category, short and long description, installation status, and TeX Live
+category, short and long description, sizes, installation status, and TeX Live
revision number. If I<pkg> is not locally installed, searches in the
remote installation source.
+For normal packages (not collections or schemes), the sizes of the
+four groups of files (run/src/doc/bin files) are shown. For collections
+and schemes the B<accumulated> size including depending packages.
+
If I<pkg> is not found locally or remotely, the search action is used
and lists matching packages and files.
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 {