texlive[47212] Master/texmf-dist/scripts/texlive/tlmgr.pl: more
commits+preining at tug.org
commits+preining at tug.org
Sun Apr 1 02:49:21 CEST 2018
Revision: 47212
http://tug.org/svn/texlive?view=revision&revision=47212
Author: preining
Date: 2018-04-01 02:49:21 +0200 (Sun, 01 Apr 2018)
Log Message:
-----------
more crypto options rework
Modified Paths:
--------------
trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl
Modified: trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl
===================================================================
--- trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl 2018-04-01 00:49:11 UTC (rev 47211)
+++ trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl 2018-04-01 00:49:21 UTC (rev 47212)
@@ -362,7 +362,7 @@
"print-platform-info" => 1,
"usermode|user-mode" => 1,
"usertree|user-tree" => "=s",
- "verify-repos" => "=s",
+ "verify-repo" => "=s",
"verify-downloads" => "!",
"require-verification" => "!",
"version" => 1,
@@ -480,45 +480,11 @@
$action = "remove";
}
- # crypto options rewriting
- if ((defined($opts{"verify-downloads"}) ||
- defined($opts{"require-verification")) &&
- defined($opts{"verify-repos"})) {
- # we cannot have all three, warn and bail out
- tldie("The options verify-downloads and require-verification have been\n" .
- "superseeded by verify-repos, please use only the later on!\n");
- }
- if (defined($opts{"verify-downloads"})) {
- if ($opts{"verify-downloads"}) {
- # explicit --verify-downloads was given
- if ($opts{"require-verification") {
- # --require-verification was given
- $opts{"verify-repos"} = "all";
- } else {
- # either nothing passed or --no-require-verification (default)
- # use explit setting to main
- $opts{"verify-repos"} = "main";
- }
- } else {
- # explicit --no-verify-downloads was given
- if ($opts"require-verification") {
- # --require-verification was given
- tldie("You cannot ask for no verification and require it at the same time!\n");
- } else {
- $opts{"verify-repos"} = "none";
- }
- }
- } else {
- # nothing related to verify-download was given, so it is by default
- # set to true
- if ($opts{"require-verification") {
- $opts{"verify-repos"} = "all";
- } else {
- # dont set anything, as nothing has been passed in
- }
- }
+ # convert command line crypto options
+ $opts{"verify-repo"} = convert_crypto_options($opts{"verify-downloads"}, $opts{"require-verification"}, $opts{"verify-repo"});
delete $opts{"require-verification"};
delete $opts{"verify-downloads"};
+
#
# check for correctness of verify-repo argument
if (defined($opts{"verify-repo"}) &&
@@ -6246,7 +6212,7 @@
# keys which can be set/get and are also settable via global cmdline opts
my @valid_bool_keys
= qw/debug-translation machine-readable no-execute-actions
- verify-repos json/;
+ verify-repo json/;
my @valid_string_keys = qw/repository prompt/;
my @valid_keys = (@valid_bool_keys, @valid_string_keys);
# set auto flush unconditionally in action shell
@@ -6567,12 +6533,12 @@
# default value
my $do_setup_gpg = "main";
# the value is set in the config file
- if (defined($config{'verify-repos'})) {
- $do_setup_gpg = $config{'verify-repos'};
+ if (defined($config{'verify-repo'})) {
+ $do_setup_gpg = $config{'verify-repo'};
}
# command line
- if (defined($opts{'verify-repos'})) {
- $do_setup_gpg = $opts{'verify-repos'};
+ if (defined($opts{'verify-repo'})) {
+ $do_setup_gpg = $opts{'verify-repo'};
}
# now we know whether we setup gpg or not
if ($do_setup_gpg ne "none") {
@@ -6580,11 +6546,11 @@
debug("will verify cryptographic signatures\n")
} else {
my $prefix = "$prg: No gpg found"; # just to shorten the strings
- if ($opts{'verify-repos'} eq "all") {
+ if ($opts{'verify-repo'} eq "all") {
# verification was requested on the command line, but did not succeed, die
tldie("$prefix, verification explicitly requested on command line, quitting.\n");
}
- if ($config{'verify-repos'} eq "all") {
+ if ($config{'verify-repo'} eq "all") {
# verification explicitly requested in config file, but not gpg, die
tldie("$prefix, verification explicitly requested in config file, quitting.\n");
}
@@ -6596,12 +6562,12 @@
} else {
# we do not setup gpg: when explicitly requested, be silent, otherwise info
my $prefix = "$prg: not setting up gpg";
- if (defined($opts{'verify-repos'})) {
+ if (defined($opts{'verify-repo'})) {
# log normally is *NOT* logged to a file
# tlmgr does by default *NOT* set up a log file (cmd line option)
# user requested it, so don't bother with output
debug("$prefix, requested on command line\n");
- } elsif (defined($config{'verify-repos'})) {
+ } elsif (defined($config{'verify-repo'})) {
debug("$prefix, requested in config file\n");
} else {
tldie("$prg: how could this happen? gpg setup.\n");
@@ -7025,7 +6991,7 @@
$config{"auto-remove"} = 1;
$config{"require-verification"} = 0;
$config{"persistent-downloads"} = 1;
- $config{"verify-repo"} = "auto";
+ $config{"verify-repo"} = "main";
# do NOT set this here, we distinguish between explicitly set in the config file
# or implicitly true
# $config{"verify-downloads"} = 1;
@@ -7042,6 +7008,15 @@
$tlmgr_config_file = TeXLive::TLConfFile->new($fn, "#", "=");
load_options_from_config($tlmgr_config_file) if $tlmgr_config_file;
+ $config{"verify-repo"} = convert_crypto_options($config{"verify-downloads"}, $config{"require-verification"}, $config{"verify-repo"});
+ delete $config{"require-verification"};
+ delete $config{"verify-downloads"};
+
+ # TODO TODO
+ # rename old crypto options
+ #
+ # TODO TODO
+ # what should we do with this?
# set $opts{"key"} from $config{"key"} if not passed in on cmd line
if (!defined($opts{"require-verification"})) {
$opts{"require-verification"} = $config{"require-verification"};
@@ -7094,26 +7069,22 @@
}
} elsif ($key eq "require-verification") {
- tlwarn("Configuration file setting \"require-verification\" is being ignored!\n");
- tlwarn("Please update the config file using \"verify-repo\"!\n");
- #if ($val eq "0") {
- # $config{"require-verification"} = 0;
- #} elsif ($val eq "1") {
- # $config{"require-verification"} = 1;
- #} else {
- # tlwarn("$prg: $fn: Unknown value for require-verification: $val\n");
- #}
+ if ($val eq "0") {
+ $config{"require-verification"} = 0;
+ } elsif ($val eq "1") {
+ $config{"require-verification"} = 1;
+ } else {
+ tlwarn("$prg: $fn: Unknown value for require-verification: $val\n");
+ }
} elsif ($key eq "verify-downloads") {
- tlwarn("Configuration file setting \"verify-downloads\" is being ignored!\n");
- tlwarn("Please update the config file using \"verify-repo\"!\n");
- #if ($val eq "0") {
- # $config{"verify-downloads"} = 0;
- #} elsif ($val eq "1") {
- # $config{"verify-downloads"} = 1;
- #} else {
- # tlwarn("$prg: $fn: Unknown value for verify-downloads: $val\n");
- #}
+ if ($val eq "0") {
+ $config{"verify-downloads"} = 0;
+ } elsif ($val eq "1") {
+ $config{"verify-downloads"} = 1;
+ } else {
+ tlwarn("$prg: $fn: Unknown value for verify-downloads: $val\n");
+ }
} elsif ($key eq "verify-repo") {
if ($val =~ m/^(none|main|all)$/) {
@@ -7169,6 +7140,51 @@
}
}
+sub convert_crypto_options {
+ my ($verify_downloads, $require_verification, $verify_repo) = @_;
+
+ # leave undefined to deal with case that nothing has been passed in
+ my $ret;
+
+ # crypto options rewriting
+ if ((defined($verify_downloads) || defined($require_verification)) &&
+ defined($verify_repo)) {
+ # we cannot have all three, warn and bail out
+ tldie("The options verify-downloads and require-verification have been\n" .
+ "superseeded by verify-repo, please use only the later on!\n");
+ }
+ if (defined($verify_downloads)) {
+ if ($verify_downloads) {
+ # explicit --verify-downloads was given
+ if ($require_verification) {
+ # --require-verification was given
+ $ret = "all";
+ } else {
+ # either nothing passed or --no-require-verification (default)
+ # use explit setting to main
+ $ret = "main";
+ }
+ } else {
+ # explicit --no-verify-downloads was given
+ if ($require_verification) {
+ # --require-verification was given
+ tldie("You cannot ask for no verification and require it at the same time!\n");
+ } else {
+ $ret = "none";
+ }
+ }
+ } else {
+ # nothing related to verify-download was given, so it is by default
+ # set to true
+ if ($require_verification) {
+ $ret = "all";
+ } else {
+ # dont set anything, as nothing has been passed in
+ }
+ }
+ return($ret);
+}
+
# if the packagelog variable is set then write to PACKAGELOG filehandle
#
sub logpackage {
@@ -7499,7 +7515,7 @@
Uses I<dir> for the tree in user mode; see L<USER MODE> below.
-=item B<--verify-repos=[none|main|all]>
+=item B<--verify-repo=[none|main|all]>
Defines the level of verification done: If C<none> is passed, no
verification whatsoever is done. If C<main> and a working GnuPG (C<gpg>)
@@ -9076,7 +9092,7 @@
is carried out, but C<tlmgr> proceeds normally.
The behaviour of the verification can be controlled by the command line
-and config file option C<verify-repos> which takes one of the following
+and config file option C<verify-repo> which takes one of the following
values: C<none>, C<main>, or C<all>. In case of C<none>, no verification
whatsoever is attempted, similar to the case when not GnuPG can be found.
In case of C<main> (the default) verification is required only for
More information about the tex-live-commits
mailing list