diff options
author | Norbert Preining <preining@logic.at> | 2009-07-30 15:05:06 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2009-07-30 15:05:06 +0000 |
commit | 7ad978e5d751cb76a4609be01636df98ed25917f (patch) | |
tree | 12c2ffbf50fe3a2a7ee9e329d18e7865ff7f9dee /Master | |
parent | 7224071580baaad0937388994f5ba1f7ad89d089 (diff) |
implement tlmgr update --no-auto-install
git-svn-id: svn://tug.org/texlive/trunk@14492 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rwxr-xr-x | Master/texmf/scripts/texlive/tlmgr.pl | 96 |
1 files changed, 59 insertions, 37 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl index 8442b8fa1c6..a1348be659a 100755 --- a/Master/texmf/scripts/texlive/tlmgr.pl +++ b/Master/texmf/scripts/texlive/tlmgr.pl @@ -149,6 +149,7 @@ sub main { "self" => 1, "list" => 1, "no-remove" => 1, + "no-auto-install" => 1, "force" => 1, "backupdir" => "=s", "backup" => 1, @@ -1526,7 +1527,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/$CriticalPackagesRegexp/); + push(@todo, $p) if ($p !~ m/$CriticalPackagesRegexp/); } } # don't do anything if we have been invoced in a strange way @@ -1626,20 +1627,37 @@ sub action_update { } # number calculation - # without w32 special packages, those are dealt with in the updater batch script - my $totalnr = $#new + $#updated + 2; + # without w32 special packages, those are dealt with in the updater batch + # script + my $totalnr = $#updated + 1; + my @alltodo = @updated; + # for size calculation we also want w32 special packages + push @alltodo, @w32_updated; my $nrupdated = 0; my $currnr = 1; + + # we have to remove all the stuff before we install other packages + # to support moving of files from one package to another. + # remove the packages that have disappeared: + # we add that only to the list of total packages do be worked on + # when --all is given, because we remove packages only on --all + if (!$opts{"no-remove"} && $opts{"all"}) { + my @foo = keys %removals; + $totalnr += $#foo + 1; + } + if (!$opts{"no-auto-install"} && $opts{"all"}) { + $totalnr += $#new + 1; + push @alltodo, @new; + } + # sizes_of_packages returns the sizes of *all* packages if nothing # is passed over, so if @new and @updated both are empty we will # get something wrong back, namely the total size of all packages my %sizes; - # for size calculation we also want w32 special packages - if (@new || @updated || @w32_updated) { + if (@alltodo) { %sizes = %{$tlmediatlpdb->sizes_of_packages( $localtlpdb->option("install_srcfiles"), - $localtlpdb->option("install_docfiles"), - @new, @updated, @w32_updated)}; + $localtlpdb->option("install_docfiles"), @alltodo)}; } else { $sizes{'__TOTAL__'} = 0; } @@ -1650,15 +1668,6 @@ sub action_update { # print deferred machine-readable lines after the header for (@addlines) { print; } - # we have to remove all the stuff before we install other packages - # to support moving of files from one package to another. - # remove the packages that have disappeared: - # we add that only to the list of total packages do be worked on - # when --all is given, because we remove packages only on --all - if (!$opts{"no-remove"} && $opts{"all"}) { - my @foo = keys %removals; - $totalnr += $#foo + 1; - } for my $p (keys %removals) { if ($opts{"no-remove"}) { info("not removing $p due to -no-remove (removed on server)\n"); @@ -1715,30 +1724,35 @@ sub action_update { } } for my $pkg (@new_packs, @new_colls, @new_schemes) { - # install new packages - my $mediatlp = $tlmediatlpdb->get_package($pkg); - if (!defined($mediatlp)) { - tlwarn("\nShould not happen: $pkg not found in $location\n"); - next; - } - my $mediarev = $mediatlp->revision; - if ($::machinereadable) { - machine_line($pkg, $FLAG_AUTOINSTALL, "-", $mediatlp->revision, $sizes{$pkg}); + if ($opts{"no-auto-install"}) { + info("not auto-installing $pkg due to -no-auto-install (new on server)\n") + unless $::machinereadable; } else { - if ($opts{"list"}) { - info("$pkg: local: <absent>, source: " . $mediatlp->revision . " (auto-install)\n"); + # install new packages + my $mediatlp = $tlmediatlpdb->get_package($pkg); + if (!defined($mediatlp)) { + tlwarn("\nShould not happen: $pkg not found in $location\n"); + next; + } + my $mediarev = $mediatlp->revision; + if ($::machinereadable) { + machine_line($pkg, $FLAG_AUTOINSTALL, "-", $mediatlp->revision, $sizes{$pkg}); } else { - info("[$currnr/$totalnr] auto-install: $pkg\n"); + if ($opts{"list"}) { + info("$pkg: local: <absent>, source: " . $mediatlp->revision . " (auto-install)\n"); + } else { + info("[$currnr/$totalnr] auto-install: $pkg\n"); + } + } + $currnr++; + next if ($opts{"dry-run"} || $opts{"list"}); + if ($tlmediasrc->install_package($pkg, $localtlpdb)) { + # installation succeeded because we got a reference + logpackage("auto-install new: $pkg ($mediarev)"); + $nrupdated++; + } else { + tlwarn("$0: couldn't install new package $pkg\n"); } - } - $currnr++; - next if ($opts{"dry-run"} || $opts{"list"}); - if ($tlmediasrc->install_package($pkg, $localtlpdb)) { - # installation succeeded because we got a reference - logpackage("auto-install new: $pkg ($mediarev)"); - $nrupdated++; - } else { - tlwarn("$0: couldn't install new package $pkg\n"); } } @@ -3629,6 +3643,14 @@ Under normal circumstances tlmgr tries to remove packages which have disappeared on the server when called with C<--all>, as described above. This prevents any such removals. +=item B<--no-auto-install> + +Under normal circumstances tlmgr will install packages which are +new on the server when called with C<--all>. This prevents any such +automatic installation. Note that after this the packages that +would have been auto-installed will be considered as +forcibly removed. + =item B<--backup> and B<--backupdir> I<directory> These two options control the creation of backups of packages before an |