summaryrefslogtreecommitdiff
path: root/Master/texmf
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2008-12-06 11:46:06 +0000
committerNorbert Preining <preining@logic.at>2008-12-06 11:46:06 +0000
commit9195c8cd265f0664b6b23fa27a6d5a6470c014ed (patch)
tree199158dda2e673006a6c9b4ce02e49f975710f1d /Master/texmf
parent2b6f9a087734d43075dad5dc88f5876b7e03c394 (diff)
add warning messages when updates to tlmgr are present to both
tlmgr and tlmgr2. For tlmgr2 we do NOT force to restart tlmgr itself by now ... should be fixed git-svn-id: svn://tug.org/texlive/trunk@11536 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf')
-rwxr-xr-xMaster/texmf/scripts/texlive/tlmgr.pl103
-rwxr-xr-xMaster/texmf/scripts/texlive/tlmgr2.pl129
2 files changed, 225 insertions, 7 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl
index ec9ee674c93..b4fd1bd7c66 100755
--- a/Master/texmf/scripts/texlive/tlmgr.pl
+++ b/Master/texmf/scripts/texlive/tlmgr.pl
@@ -1095,12 +1095,14 @@ sub action_update {
my $opt_noremove = 0;
my $opt_backupdir;
my $opt_backup = 0;
+ my $opt_force = 0;
Getopt::Long::Configure(@getopt_configure_subopts);
GetOptions("no-depends" => \$opt_nodepends,
"no-depends-at-all" => \$opt_reallynodepends,
"all" => \$opt_all,
"list" => \$opt_list,
"no-remove" => \$opt_noremove,
+ "force" => \$opt_force,
"backupdir=s" => \$opt_backupdir,
"backup" => \$opt_backup,
"n|dry-run" => \$opt_dry) or pod2usage(2);
@@ -1112,6 +1114,40 @@ sub action_update {
my $mediatlpdb = $tlmediasrc->tlpdb;
info("update: dry run, no changes will be made\n") if $opt_dry;
+ # 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
+ # is given
+ my $other_updates_asked_for = 0;
+ if ($opt_all) {
+ $other_updates_asked_for = 1;
+ } else {
+ for my $p (@ARGV) {
+ my $matched = 0;
+ for my $cp (@CriticalPackagesList) {
+ # we match for initial package name, that shold be fine
+ if ($p =~ m/^$cp/) {
+ $matched = 1;
+ last;
+ }
+ }
+ if (!$matched) {
+ $other_updates_asked_for = 1;
+ last;
+ }
+ }
+ }
+ if ($other_updates_asked_for) {
+ if (check_for_critical_updates($localtlpdb, $mediatlpdb)) {
+ if ($opt_force) {
+ tlwarn("Continuing due to --force\n");
+ } elsif ($opt_list) {
+ # do not warn here
+ } else {
+ die "not continuing, please see warning above!";
+ }
+ }
+ }
+
# do backup dir checking now so that we don't run into troubles
# later, and exit if that doesn't work
if ($opt_backupdir) {
@@ -1478,14 +1514,22 @@ sub action_install {
my $opt_reallynodepends = 0;
my $opt_dry = 0;
my $opt_reinstall = 0;
+ my $opt_force = 0;
Getopt::Long::Configure(@getopt_configure_subopts);
GetOptions("no-depends" => \$opt_nodepends,
"no-depends-at-all" => \$opt_reallynodepends,
"reinstall" => \$opt_reinstall,
+ "force" => \$opt_force,
"n|dry-run" => \$opt_dry) or pod2usage(2);
my %ret;
init_tlmedia();
my $tlmediatlpdb = $tlmediasrc->tlpdb;
+
+ # check for updates to tlmgr itself, and die unless --force is given
+ if(check_for_critical_updates( $localtlpdb, $tlmediatlpdb, !$opt_force)) {
+ die "not continuing, please see warning above!";
+ }
+
$opt_nodepends = 1 if $opt_reallynodepends;
info("install: dry run, no changes will be made\n") if $opt_dry;
@@ -2220,6 +2264,53 @@ sub clear_old_backups
}
}
+#
+# check for updates to tlcritical packages
+#
+sub check_for_critical_updates
+{
+ my ($localtlpdb, $mediatlpdb) = @_;
+
+ my $criticalupdate = 0;
+ my @critical = $localtlpdb->expand_dependencies("-no-collections",
+ $localtlpdb, @CriticalPackagesList);
+ for my $pkg (sort @critical) {
+ my $tlp = $localtlpdb->get_package($pkg);
+ if (!defined($tlp)) {
+ # that should not happen, we expanded in the localtlpdb so why
+ # should it not be present, any anyway, those are so fundamental
+ # so they have to be there
+ tlwarn("Fundamental package $pkg not present, that is sooo bad.\n");
+ die "Serious error, $pkg not found";
+ }
+ my $localrev = $tlp->revision;
+ my $mtlp = $mediatlpdb->get_package($pkg);
+ if (!defined($mtlp)) {
+ tlwarn("Very suprising, $pkg is not present in the remote tlpdb.\n");
+ next;
+ }
+ my $remoterev = $mtlp->revision;
+ if ($remoterev > $localrev) {
+ $criticalupdate = 1;
+ last;
+ }
+ }
+ if ($criticalupdate) {
+ tlwarn("==========================================================\n");
+ tlwarn("Updates for the tlmgr itself are present.\n");
+ tlwarn("Please update the package bin-texlive and texlive.infra first, ");
+ tlwarn("e.g., by calling\n");
+ tlwarn(" tlmgr update bin-texlive texlive.infra\n");
+ tlwarn("Or get the latest updater from\nfor Unix-ish systems:\n");
+ tlwarn(" $TeXLiveURL/update-tlmgr-latest.sh\n");
+ tlwarn("for Windows systems:\n");
+ tlwarn(" $TeXLiveURL/update-tlmgr-latest.exe\n");
+ tlwarn("Then continue with other updates.\n");
+ tlwarn("==========================================================\n");
+ }
+ return($criticalupdate);
+}
+
#
# return all the directories from which all content will be removed
@@ -2415,6 +2506,12 @@ Don't use it unless you are sure of what you are doing.
Nothing is actually installed; instead, the actions to be performed are
written to the terminal.
+=item B<--force>
+
+If updates to the tlmgr itself (and the underlying infrastructure) are
+present tlmgr will bail out and not perform the installation unless this option
+is given.
+
=back
@@ -2449,6 +2546,12 @@ removed, without actually changing anything.
Nothing is actually installed; instead, the actions to be performed are
written to the terminal. This is a more detailed report than C<--list>.
+=item B<--force>
+
+If updates to the tlmgr itself (and the underlying infrastructure) are
+present tlmgr will bail out and not perform the update unless this option
+is given (or B<--list> is given).
+
=item B<--no-remove>
Under normal circumstances tlmgr tries to remove packages which have
diff --git a/Master/texmf/scripts/texlive/tlmgr2.pl b/Master/texmf/scripts/texlive/tlmgr2.pl
index 9aaf02e58b3..25e4e878b60 100755
--- a/Master/texmf/scripts/texlive/tlmgr2.pl
+++ b/Master/texmf/scripts/texlive/tlmgr2.pl
@@ -6,6 +6,9 @@
# or any later version.
#
# TODO:
+# - in GUI mode updating bin-texlive/texlive.infra DOES work without
+# the warning, but it does NOT force to restart the GUI. THAT IS BAD!!!
+#
#
# MAYBE TODO (needs discussion)
# - save the remote texlive.tlpdb and its md5-hash, and before downloading
@@ -76,7 +79,7 @@ binmode(STDERR, ":utf8");
#
# global variable that specifies if a call to finish() should actually
# finish the program or immediately return
-$::do_finish = 1;
+$::gui_mode = 0;
# used variables
# the TLMedia from which we install/update
@@ -92,6 +95,7 @@ our $location;
# each action uses this.
my @getopt_configure_subopts = qw(no_pass_through permute);
+
# option variables
my $opt_location;
my $opt_help = 0;
@@ -278,7 +282,7 @@ sub execute_action {
die "$0: unknown action: $action\n";
}
# close the special log file
- if ($packagelogfile && $::do_finish) {
+ if ($packagelogfile && !$::gui_mode) {
info("tlmgr: package log updated at $packagelogfile\n") if $packagelogged;
close(PACKAGELOG);
}
@@ -1116,12 +1120,14 @@ sub action_update {
my $opt_noremove = 0;
my $opt_backupdir;
my $opt_backup = 0;
+ my $opt_force = 0;
Getopt::Long::Configure(@getopt_configure_subopts);
GetOptions("no-depends" => \$opt_nodepends,
"no-depends-at-all" => \$opt_reallynodepends,
"all" => \$opt_all,
"list" => \$opt_list,
"no-remove" => \$opt_noremove,
+ "force" => \$opt_force,
"backupdir=s" => \$opt_backupdir,
"backup" => \$opt_backup,
"n|dry-run" => \$opt_dry) or pod2usage(2);
@@ -1133,6 +1139,45 @@ sub action_update {
my $mediatlpdb = $tlmediasrc->tlpdb;
info("update: dry run, no changes will be made\n") if $opt_dry;
+ # 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
+ # is given
+ my $other_updates_asked_for = 0;
+ if ($opt_all) {
+ $other_updates_asked_for = 1;
+ } else {
+ for my $p (@ARGV) {
+ my $matched = 0;
+ for my $cp (@CriticalPackagesList) {
+ # we match for initial package name, that shold be fine
+ if ($p =~ m/^$cp/) {
+ $matched = 1;
+ last;
+ }
+ }
+ if (!$matched) {
+ $other_updates_asked_for = 1;
+ last;
+ }
+ }
+ }
+ if ($other_updates_asked_for) {
+ if (check_for_critical_updates($localtlpdb, $mediatlpdb)) {
+ if ($opt_force) {
+ tlwarn("Continuing due to --force\n");
+ } elsif ($opt_list) {
+ # do not warn here
+ } else {
+ if ($::gui_mode) {
+ # return here and don't do any updates
+ return;
+ } else {
+ die "not continuing, please see warning above!";
+ }
+ }
+ }
+ }
+
# do backup dir checking now so that we don't run into troubles
# later, and exit if that doesn't work
if ($opt_backupdir) {
@@ -1499,14 +1544,23 @@ sub action_install {
my $opt_reallynodepends = 0;
my $opt_dry = 0;
my $opt_reinstall = 0;
+ my $opt_force = 0;
Getopt::Long::Configure(@getopt_configure_subopts);
GetOptions("no-depends" => \$opt_nodepends,
"no-depends-at-all" => \$opt_reallynodepends,
"reinstall" => \$opt_reinstall,
+ "force" => \$opt_force,
"n|dry-run" => \$opt_dry) or pod2usage(2);
my %ret;
init_tlmedia();
my $tlmediatlpdb = $tlmediasrc->tlpdb;
+
+ # check for updates to tlmgr itself, and die unless --force is given
+ if(check_for_critical_updates( $localtlpdb, $tlmediatlpdb, !$opt_force)) {
+ die "not continuing, please see warning above!"
+ unless $::gui_mode;
+ }
+
$opt_nodepends = 1 if $opt_reallynodepends;
info("install: dry run, no changes will be made\n") if $opt_dry;
@@ -1848,6 +1902,7 @@ sub init_local_db {
sub action_gui {
my ($guiscreen) = @_;
+ # yes, two times to make perl warnings shut up ...
$::guiscreen = $guiscreen;
$::guiscreen = $guiscreen;
unshift (@INC, "$Master/texmf/scripts/texlive/tlmgrgui");
@@ -1893,7 +1948,8 @@ Error message from creating MainWindow:
}
# be sure that sub actions do *not* finish
- $::do_finish = 0;
+ $::gui_mode = 1;
+
require("tlmgrgui2.pl");
# should not be reached
exit(1);
@@ -2220,7 +2276,7 @@ sub logpackage {
#
# finish # evaluates only the -pause option, and then exits
-# if the global $::do_finish is set to 0 then the not exit, but return is called
+# if the global $::gui_mode is set to 1 then the not exit, but return is called
sub finish {
my ($ret) = @_;
@@ -2233,10 +2289,10 @@ sub finish {
<STDIN>;
}
- if ($::do_finish) {
- exit($ret);
- } else {
+ if ($::gui_mode) {
return($ret);
+ } else {
+ exit($ret);
}
}
@@ -2271,6 +2327,53 @@ sub clear_old_backups
}
}
+#
+# check for updates to tlcritical packages
+#
+sub check_for_critical_updates
+{
+ my ($localtlpdb, $mediatlpdb) = @_;
+
+ my $criticalupdate = 0;
+ my @critical = $localtlpdb->expand_dependencies("-no-collections",
+ $localtlpdb, @CriticalPackagesList);
+ for my $pkg (sort @critical) {
+ my $tlp = $localtlpdb->get_package($pkg);
+ if (!defined($tlp)) {
+ # that should not happen, we expanded in the localtlpdb so why
+ # should it not be present, any anyway, those are so fundamental
+ # so they have to be there
+ tlwarn("Fundamental package $pkg not present, that is sooo bad.\n");
+ die "Serious error, $pkg not found";
+ }
+ my $localrev = $tlp->revision;
+ my $mtlp = $mediatlpdb->get_package($pkg);
+ if (!defined($mtlp)) {
+ tlwarn("Very suprising, $pkg is not present in the remote tlpdb.\n");
+ next;
+ }
+ my $remoterev = $mtlp->revision;
+ if ($remoterev > $localrev) {
+ $criticalupdate = 1;
+ last;
+ }
+ }
+ if ($criticalupdate) {
+ tlwarn("==========================================================\n");
+ tlwarn("Updates for the tlmgr itself are present.\n");
+ tlwarn("Please update the package bin-texlive and texlive.infra first, ");
+ tlwarn("e.g., by calling\n");
+ tlwarn(" tlmgr update bin-texlive texlive.infra\n");
+ tlwarn("Or get the latest updater from\nfor Unix-ish systems:\n");
+ tlwarn(" $TeXLiveURL/update-tlmgr-latest.sh\n");
+ tlwarn("for Windows systems:\n");
+ tlwarn(" $TeXLiveURL/update-tlmgr-latest.exe\n");
+ tlwarn("Then continue with other updates.\n");
+ tlwarn("==========================================================\n");
+ }
+ return($criticalupdate);
+}
+
#
# return all the directories from which all content will be removed
@@ -2466,6 +2569,12 @@ Don't use it unless you are sure of what you are doing.
Nothing is actually installed; instead, the actions to be performed are
written to the terminal.
+=item B<--force>
+
+If updates to the tlmgr itself (and the underlying infrastructure) are
+present tlmgr will bail out and not perform the installation unless this option
+is given.
+
=back
@@ -2500,6 +2609,12 @@ removed, without actually changing anything.
Nothing is actually installed; instead, the actions to be performed are
written to the terminal. This is a more detailed report than C<--list>.
+=item B<--force>
+
+If updates to the tlmgr itself (and the underlying infrastructure) are
+present tlmgr will bail out and not perform the update unless this option
+is given (or B<--list> is given).
+
=item B<--no-remove>
Under normal circumstances tlmgr tries to remove packages which have