summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2018-04-01 00:49:21 +0000
committerNorbert Preining <preining@logic.at>2018-04-01 00:49:21 +0000
commit9608b5e0260973d80366d0aebddd8e625fef9d76 (patch)
treedb562550f4a7a1b70b4b2ebe720c3f4b8c12a45c /Master/texmf-dist
parent41943477ecd818eb82a094bce321ea21f7ed8237 (diff)
more crypto options rework
git-svn-id: svn://tug.org/texlive/trunk@47212 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rwxr-xr-xMaster/texmf-dist/scripts/texlive/tlmgr.pl152
1 files changed, 84 insertions, 68 deletions
diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl
index 657a32f5cbf..9b7878aacb3 100755
--- a/Master/texmf-dist/scripts/texlive/tlmgr.pl
+++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl
@@ -362,7 +362,7 @@ my %globaloptions = (
"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 @@ sub main {
$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 @@ sub action_shell {
# 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 @@ sub handle_gpg_config_settings {
# 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 @@ sub handle_gpg_config_settings {
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 @@ sub handle_gpg_config_settings {
} 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 @@ sub load_config_file {
$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 @@ sub load_config_file {
$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 @@ sub load_options_from_config {
}
} 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 write_config_file {
}
}
+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 @@ Activates user mode for this run of C<tlmgr>; see L<USER MODE> below.
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 @@ C<gpg> is not available, signatures are not checked and no verification
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