diff options
author | Norbert Preining <preining@logic.at> | 2008-12-20 00:42:40 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2008-12-20 00:42:40 +0000 |
commit | 4bd591bb16f9cdc69cb99b563c79a90e954b7259 (patch) | |
tree | aa13ca7a03813ffdb18f97ee3f705ee0136943a9 | |
parent | f6bc14e1abf07895c34f8feb1549e34d65bf1889 (diff) |
add some progress report to the output of tlmgr2 update
git-svn-id: svn://tug.org/texlive/trunk@11658 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-x | Master/texmf/scripts/texlive/tlmgr2.pl | 54 |
1 files changed, 34 insertions, 20 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr2.pl b/Master/texmf/scripts/texlive/tlmgr2.pl index 49b99664657..f078c594aa0 100755 --- a/Master/texmf/scripts/texlive/tlmgr2.pl +++ b/Master/texmf/scripts/texlive/tlmgr2.pl @@ -11,8 +11,12 @@ # # - tlmgr should support the opt_symlink option and create/remove symlinks in # system directories when installing/removing/updating packages. -# Bummer, that will be complicated... maybe should go to -# TLMedia->install_package ??? +# +# currently implemented in TLPDB->add_symlinks and ->remove_symlinks +# but where to interface it here: +# . either at all update/install/remove actions automatically for +# all symlinks +# . or an additional action symlinks that does that on command # # - when tlmgr2.pl is shipped globally as tlmgr.pl we can switch the # installer from using either texconfig paper or texlua ... to @@ -1251,11 +1255,11 @@ sub close_w32_updater { # anymore. That has all to be done by hand. # sub machine_line { - my ($pkg, $flag, $lrev, $rrev) = @_; + my ($pkg, $flag, $lrev, $rrev, @args) = @_; $lrev || ($lrev = "-"); $rrev || ($rrev = "-"); $flag || ($flag = "?"); - print "$pkg\t$flag\t$lrev\t$rrev\n"; + print "$pkg\t$flag\t$lrev\t$rrev\t", join("\t",@args), "\n"; } sub action_update { @@ -1265,7 +1269,6 @@ sub action_update { init_local_db(1); # initialize the TLMedia from $location $opts{"no-depends"} = 1 if $opts{"no-depends-at-all"}; - my $nrupdated = 0; my %ret; init_tlmedia(); @@ -1474,8 +1477,8 @@ sub action_update { # # we first collect the list of packages to be actually updated or installed - my %updated; - my %new; + my @updated; + my @new; foreach my $pkg (sort @todo) { next if ($pkg =~ m/^00texlive/); @@ -1516,7 +1519,7 @@ sub action_update { next; } my $mediarev = $mediatlp->revision; - $new{$pkg} = 1; + push @new, $pkg; next; } my $rev = $tlp->revision; @@ -1527,7 +1530,7 @@ sub action_update { } my $mediarev = $mediatlp->revision; if ($rev < $mediarev) { - $updated{$pkg} = 1; + push @updated, $pkg; # machine_line($pkg, $FLAG_UPDATE, $rev, $mediarev); } elsif ($rev > $mediarev) { if ($::machinereadable) { @@ -1538,15 +1541,20 @@ sub action_update { } } } - for my $i (keys %new) { + for my $i (sort @new) { debug("$i new package\n"); } - for my $i (keys %updated) { + for my $i (sort @updated) { debug("$i upd package\n"); } + # number calculation + my $totalnr = $#new + $#updated + 2; + my $nrupdated = 0; + my $currnr = 1; + # install all the new packages first - for my $pkg (sort keys %new) { + for my $pkg (sort @new) { # install new packages my $mediatlp = $mediatlpdb->get_package($pkg); if (!defined($mediatlp)) { @@ -1555,10 +1563,11 @@ sub action_update { } my $mediarev = $mediatlp->revision; if ($::machinereadable) { - machine_line($pkg, $FLAG_AUTOINSTALL, "-", $mediatlp->revision); + machine_line($pkg, $FLAG_AUTOINSTALL, "-", $mediatlp->revision, $currnr, $totalnr); } else { - info("auto-install: $pkg\n"); + info("[$currnr/$totalnr] auto-install: $pkg\n"); } + $currnr++; next if ($opts{"dry-run"} || $opts{"list"}); my $foo = $tlmediasrc->install_package($pkg, $localtlpdb); if (ref $foo) { @@ -1572,7 +1581,7 @@ sub action_update { } # - foreach my $pkg (sort keys %updated) { + foreach my $pkg (sort @updated) { next if ($pkg =~ m/^00texlive/); my $tlp = $localtlpdb->get_package($pkg); # we checked already that this package is present! @@ -1588,7 +1597,7 @@ sub action_update { $nrupdated++; if ($opts{"list"}) { if ($::machinereadable) { - machine_line($pkg, $FLAG_UPDATE, $rev, $mediarev); + machine_line($pkg, $FLAG_UPDATE, $rev, $mediarev, $currnr, $totalnr); } else { info("$pkg: local: $rev, source: $mediarev\n"); } @@ -1608,12 +1617,17 @@ sub action_update { if (win32() && ($pkg =~ m/$WinSpecialUpdatePackagesRegexp/)) { add_w32_updater($mediatlp, $opts{"dry-run"}); } else { - info("update: $pkg ($rev -> $mediarev)"); + if ($::machinereadable) { + machine_line($pkg, $FLAG_UPDATE, $rev, $mediarev, $currnr, $totalnr); + } else { + info("[$currnr/$totalnr] update: $pkg ($rev -> $mediarev)"); + } + $currnr++; if ($opts{"dry-run"}) { - info("\n"); + info("\n") unless $::machinereadable; next; } else { - info(" ... "); # more to come + info(" ... ") unless $::machinereadable; # more to come } if (!$unwind_package) { @@ -1680,7 +1694,7 @@ sub action_update { } unlink($unwind_package) if $remove_unwind_container; } - info("done\n"); + info("done\n") unless $::machinereadable; } } } |