summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
Diffstat (limited to 'Master')
-rwxr-xr-xMaster/texmf/scripts/texlive/tlmgr.pl68
1 files changed, 54 insertions, 14 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl
index a441a542f5d..d91756dc3d7 100755
--- a/Master/texmf/scripts/texlive/tlmgr.pl
+++ b/Master/texmf/scripts/texlive/tlmgr.pl
@@ -146,6 +146,7 @@ sub main {
"update" => { "no-depends" => 1,
"no-depends-at-all" => 1,
"all" => 1,
+ "self" => 1,
"list" => 1,
"no-remove" => 1,
"force" => 1,
@@ -1211,7 +1212,7 @@ sub action_backup {
#
sub write_w32_updater {
- my @w32_updated = @_;
+ my ($rerun_tlmgr_argv, @w32_updated) = @_;
my $media = $tlmediasrc->media;
my $mediatlpdb = $tlmediasrc->tlpdb;
# we have to download/copy also the src/doc files if necessary!
@@ -1281,6 +1282,7 @@ sub write_w32_updater {
return 0 if ($opts{"dry-run"}); # nothing else to do
# write the updater script file
open UPDATER, ">$root/temp/run-updater-w32" or die "Cannot create updater: $!";
+ # TODO: respawn tlmgr if $rerun_tlmgr_argv is not empty
print UPDATER '
@echo off
setlocal enableextensions
@@ -1344,13 +1346,15 @@ sub action_update {
info("update: dry run, no changes will be made\n") if $opts{"dry-run"};
# if the update is not for one of the critical packages then do
- # check for updates to tlmgr and die unless either --force or --list
+ # check for updates to tlmgr and die unless either --force or --list or --self
# is given
+ my @pretodo = @ARGV;
+ push (@pretodo, @CriticalPackagesList) if $opts{"self"};
my $other_updates_asked_for = 0;
if ($opts{"all"}) {
$other_updates_asked_for = 1;
} else {
- for my $p (@ARGV) {
+ for my $p (@pretodo) {
my $matched = 0;
for my $cp (@CriticalPackagesList) {
# we match for initial package name, that shold be fine
@@ -1365,11 +1369,11 @@ sub action_update {
}
}
}
- if ($other_updates_asked_for) {
+ if ($other_updates_asked_for && !$opts{"self"}) {
if (check_for_critical_updates($localtlpdb, $tlmediatlpdb)) {
if ($opts{"force"}) {
tlwarn("$0: Continuing due to --force.\n");
- } elsif ($opts{"list"}) {
+ } elsif ($opts{"list"} || $opts{"self"}) {
# do not warn here
} else {
if ($::gui_mode) {
@@ -1456,7 +1460,6 @@ sub action_update {
unlink($f) unless $opts{"dry-run"};
}
- my @todo;
my %removals;
my %forcermpkgs;
my %newpkgs;
@@ -1504,10 +1507,19 @@ sub action_update {
debug ("tlmgr: deleted : " . join("\n\t",keys %removals) . "\n");
debug ("tlmgr: forced : " . join("\n\t",keys %forcermpkgs) . "\n");
- if ($opts{"all"} || $opts{"list"}) {
+ my @todo;
+ if ($opts{"list"}) {
+ # for --list we treat all packages the same
@todo = $localtlpdb->list_packages;
+ } elsif ($opts{"self"}) {
+ # do only critical packages, if others are asked for, do them after tlmgr restart
+ @todo = @CriticalPackagesList;
} else {
- @todo = @ARGV;
+ @pretodo = $localtlpdb->list_packages if ($opts{"all"});
+ # filter out win32 special packages
+ for my $p (@pretodo) {
+ push(@todo, $p) if ($p !~ m/$WinSpecialUpdatePackagesRegexp/);
+ }
}
# don't do anything if we have been invoced in a strange way
if (!@todo) {
@@ -1580,8 +1592,8 @@ 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/)) {
- # w32 specials are treated as other packages for --list
push @w32_updated, $pkg;
} else {
push @updated, $pkg;
@@ -1854,12 +1866,28 @@ sub action_update {
info("done\n") unless $::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;
+ }
+ }
if (win32() && !$opts{"list"} && @w32_updated) {
info("Preparing TeX Live infrastructure update...\n");
- my $ret = write_w32_updater(@w32_updated);
+ my $ret = write_w32_updater("@rerun_tlmgr_argv", @w32_updated);
tlwarn ("Aborting infrastructure update.\n") if ($ret);
}
+ # TODO: respawn tlmgr exec stuff for unix
+ if (!win32() && @rerun_tlmgr_argv) {
+ info ("Restarting tlmgr to complete update ...\n");
+ exec("tlmgr", @rerun_tlmgr_argv);
+ die "Cannot restart tlmgr, please retry updating.";
+ }
+
if (!(@new || @updated || @w32_updated) && ($tlmediasrc->media ne "NET") && $opts{"all"}) {
# for all but net updates we warn if nothing is updated
tlwarn("\nNothing to update.\n");
@@ -3311,9 +3339,8 @@ sub check_for_critical_updates
if ($criticalupdate) {
tlwarn("Updates for tlmgr itself are present.\n");
tlwarn("=" x 79, "\n");
- tlwarn("Please update the package texlive.infra first, ");
- tlwarn("via either\n");
- tlwarn(" tlmgr update texlive.infra\n");
+ tlwarn("Please update the package manager first, via either\n");
+ tlwarn(" tlmgr update --self\n");
tlwarn("or by getting the latest updater for Unix-ish systems:\n");
tlwarn(" $TeXLiveURL/update-tlmgr-latest.sh\n");
tlwarn("and/or Windows systems:\n");
@@ -3476,7 +3503,8 @@ must be specified. Options:
=item B<--all>
-Update all installed packages. For packages contained in an installed
+Update all installed packages but the tlmgr itself.
+For packages contained in an installed
collection, also install new packages and remove deleted packages in
those collections. Packages not contained in an installed collection
are not considered for addition or removal.
@@ -3487,6 +3515,18 @@ present locally, A will be added. Conversely, if the local collection C
contains a package B, but B is no longer in the server's C, then B will
be deleted.
+In case that updates to tlmgr itself are present this will not work
+unless also the option B<--self> is given.
+
+=item B<--self>
+
+Updates tlmgr itself if updates are present. On Windows this includes
+updates to the perl interpreter shipped by TeX Live.
+
+If this option is given together with B<--all> then first tlmgr will
+be updated, and after that tlmgr restarted to complete with the rest
+of the updates.
+
=item B<--list>
Concisely list the packages which would be updated, newly installed, or