diff options
author | Norbert Preining <preining@logic.at> | 2009-07-28 19:09:44 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2009-07-28 19:09:44 +0000 |
commit | b07703c29723a38ba270bfe830e2ea7e74e6f472 (patch) | |
tree | 428dc21755476aeed229e7c4c70d6aabd43f9442 /Master/texmf/scripts | |
parent | 64cdb9ed21254796873f1d844da04f96c59a7074 (diff) |
work on --self and restart
git-svn-id: svn://tug.org/texlive/trunk@14481 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf/scripts')
-rwxr-xr-x | Master/texmf/scripts/texlive/tlmgr.pl | 59 |
1 files changed, 41 insertions, 18 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl index 822d53086d1..26cfa77fbae 100755 --- a/Master/texmf/scripts/texlive/tlmgr.pl +++ b/Master/texmf/scripts/texlive/tlmgr.pl @@ -187,6 +187,10 @@ sub main { } } } + + # save command line options for later restart, if necessary + @::SAVEDARGV = @ARGV; + TeXLive::TLUtils::process_logging_options(); GetOptions(\%opts, keys(%optarg)) or pod2usage(2); @@ -1518,7 +1522,7 @@ sub action_update { @pretodo = $localtlpdb->list_packages if ($opts{"all"}); # filter out win32 special packages for my $p (@pretodo) { - push(@todo, $p) if ($p !~ m/$WinSpecialUpdatePackagesRegexp/); + push(@todo, $p) if ($p !~ m/$CriticalPackagesRegexp/); } } # don't do anything if we have been invoced in a strange way @@ -1536,8 +1540,8 @@ sub action_update { # # we first collect the list of packages to be actually updated or installed - my @updated; - my @w32_updated; # win32 special packages that need the updater batch script + my %updated; + my %w32_updated; # win32 special packages that need the updater batch script my @new; my @addlines; @@ -1593,10 +1597,10 @@ sub action_update { my $mediarev = $mediatlp->revision; if ($rev < $mediarev) { # w32 specials are treated as other packages for --list - if (win32() && !$opts{"list"} && ($pkg =~ m/$WinSpecialUpdatePackagesRegexp/)) { - push @w32_updated, $pkg; + if (win32() && !$opts{"list"} && ($pkg =~ m/$CriticalPackagesRegexp/)) { + $w32_updated{$pkg} = 0; # will be changed to one on successful update } else { - push @updated, $pkg; + $updated{$pkg} = 0; # will be changed to one on successful update } } elsif ($rev > $mediarev) { if ($::machinereadable) { @@ -1608,10 +1612,11 @@ sub action_update { } } } + my @updated = sort keys %updated; for my $i (sort @new) { debug("$i new package\n"); } - for my $i (sort @updated) { + for my $i (@updated) { debug("$i upd package\n"); } @@ -1741,7 +1746,7 @@ sub action_update { my @inst_packs; my @inst_colls; my @inst_schemes; - for my $pkg (sort @updated) { + for my $pkg (@updated) { # we do name checking here, not to load all tlpobj again and again if ($pkg =~ m/^scheme-/) { push @inst_schemes, $pkg; @@ -1773,6 +1778,7 @@ sub action_update { } else { info("$pkg: local: $rev, source: $mediarev (update)\n"); } + $updated{$pkg} = 1; next; } @@ -1796,6 +1802,7 @@ sub action_update { $currnr++; if ($opts{"dry-run"}) { info("\n") unless $::machinereadable; + $updated{$pkg} = 1; next; } else { info(" ... ") unless $::machinereadable; # more to come @@ -1827,6 +1834,8 @@ sub action_update { # installation succeeded because we got a reference logpackage("update: $pkg ($rev -> $mediarev)"); unlink($unwind_package) if $remove_unwind_container; + # remember successful update + $update{$pkg} = 1; } else { # install_package returned a scalar, so error. # now in fact we should do some cleanup, removing files and @@ -1869,25 +1878,39 @@ sub action_update { print "end-of-updates\n" if $::machinereadable; - my @rerun_tlmgr_argv; - # only when we are not dry-running we restart the program - if ($other_updates_asked_for && !$opts{"dry-run"}) { - if ($opts{"all"}) { - push @rerun_tlmgr_argv, "update", "--all"; - } else { - push @rerun_tlmgr_argv, "update", @ARGV; + # + # check that if updates to the critical packages are present all of + # them have been successfully updated + my $infra_update_present = 0; + my $infra_update_done = 1; + for my $pkg (@CriticalPackagesList) { + if (defined($updated{$pkg})) { + $infra_update_present = 1; + $infra_update_done &&= $pdated{$pkg}; } } + + my $restart_tlmgr = 0; + # only when we are not dry-running we restart the program + if ($infra_update_present && $infra_update_done && + $other_updates_asked_for && !$opts{"dry-run"}) { + # weed out the --self argument from the saved arguments + @::SAVEDARGV = grep {!m;^--self$;} @::SAVEDARGV;; + @::SAVEDARGV = grep {!m;^-self$;} @::SAVEDARGV;; + $restart_tlmgr = 1; + } + if (win32() && !$opts{"list"} && @w32_updated) { info("Preparing TeX Live infrastructure update...\n"); - my $ret = write_w32_updater("@rerun_tlmgr_argv", @w32_updated); + my $ret = write_w32_updater($restart_tlmgr, @w32_updated); tlwarn ("Aborting infrastructure update.\n") if ($ret); } # temporarily disable tlmgr restart after infra update (needs more work) - if (0 && !win32() && @rerun_tlmgr_argv) { + if (!win32() && $restart_tlmgr) { info ("Restarting tlmgr to complete update ...\n"); - exec("tlmgr", @rerun_tlmgr_argv); + debug("restarting tlmgr @::SAVEDARGV\n"); + exec("tlmgr", @::SAVEDARGV); die "Cannot restart tlmgr, please retry updating."; } |