summaryrefslogtreecommitdiff
path: root/Build/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-04-02 21:21:55 +0000
committerKarl Berry <karl@freefriends.org>2018-04-02 21:21:55 +0000
commit36c3a7f80fb543246ba005efd3dc2e4046861e1a (patch)
treef2eb377d700406021e9c244a1e2d58095ff3a536 /Build/source
parent1610548529befd1cb7d72da00a3a889261436642 (diff)
lwarp (2apr18)
git-svn-id: svn://tug.org/texlive/trunk@47250 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/lwarp/lwarpmk.lua27
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/texlive/tlmgr.pl167
2 files changed, 147 insertions, 47 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/lwarp/lwarpmk.lua b/Build/source/texk/texlive/linked_scripts/lwarp/lwarpmk.lua
index 99b5f4949fe..c372f67f629 100755
--- a/Build/source/texk/texlive/linked_scripts/lwarp/lwarpmk.lua
+++ b/Build/source/texk/texlive/linked_scripts/lwarp/lwarpmk.lua
@@ -4,7 +4,7 @@
-- Print the usage of the lwarpmk command:
-printversion = "v0.52"
+printversion = "v0.53"
function printhelp ()
print ("lwarpmk: Use lwarpmk -h or lwarpmk --help for help.") ;
@@ -25,10 +25,11 @@ lwarpmk again [project]: Touch the source code to trigger recompiles.
lwarpmk limages [project]: Process the "lateximages" created by lwarp.sty.
lwarpmk pdftohtml [project]:
For use with latexmk or a Makefile:
- Convert project_html.pdf to project_html.html and
- individual HTML files.
+ Converts project_html.pdf to project_html.html and individual HTML files.
+ Finishes the HTML conversion even if there was a compile error.
lwarpmk clean [project]: Remove .aux, .toc, .lof/t, .idx, .ind, .log, *_html_inc.*, .gl*
lwarpmk cleanall [project]: Remove auxiliary files and also project.pdf, *.html
+lwarpmk cleanlimages: Removes all images from the "lateximages" directory.
lwarpmk -h: Print this help message.
lwarpmk --help: Print this help message.
@@ -335,6 +336,8 @@ if opsystem=="Windows" then
end -- create lwarp_one_limage.cmd
-- Track the number of parallel processes
numimageprocesses = 0
+-- Track warning to recompile if find a page 0
+pagezerowarning = false
-- Scan lateximages.txt
for line in limagesfile:lines() do
-- lwimgpage is the page number in the PDF which has the image
@@ -344,7 +347,9 @@ i,j,lwimgpage,lwimghash,lwimgname = string.find (line,"|(.*)|(.*)|(.*)|")
-- For each entry:
if ( (i~=nil) ) then
-- Skip if the page number is 0:
-if ( lwimgpage ~= "0" ) then
+if ( lwimgpage == "0" ) then
+ pagezerowarning = true
+else
-- Skip is this image is hashed and already exists:
local lwimgfullname = "lateximages" .. dirslash .. lwimgname .. ".svg"
if (
@@ -425,6 +430,12 @@ end -- not nil
end -- do
io.close(limagesfile)
print ( "lwarpmk limages: done" )
+if ( pagezerowarning == true ) then
+ print ( "lwarpmk limages: WARNING: Images will be incorrect." )
+ print ( "lwarpmk limages: Enter \"lwarpmk cleanlimages\", then" )
+ print ( "lwarpmk limages: recompile the document one more time, then" )
+ print ( "lwarpmk limages: repeat \"lwarpmk images\" again." )
+end -- pagezerowarning
end -- function
-- Use latexmk to compile source and index:
@@ -638,6 +649,14 @@ os.execute ( rmname .. " " ..
)
print ("lwarpmk: Done.")
+-- lwarpmk cleanlimages
+-- Remove images from the lateximages directory.
+
+elseif arg[1] == "cleanlimages" then
+loadconf ()
+os.execute ( rmname .. " lateximages/*" )
+print ("lwarpmk: Done.")
+
-- lwarpmk with no argument :
elseif (arg[1] == nil) then
diff --git a/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl b/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl
index 585ca0b7c2c..2391d944319 100755
--- a/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl
+++ b/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl
@@ -1,12 +1,12 @@
#!/usr/bin/env perl
-# $Id: tlmgr.pl 47132 2018-03-26 17:19:25Z karl $
+# $Id: tlmgr.pl 47220 2018-04-01 03:20:33Z preining $
#
# Copyright 2008-2018 Norbert Preining
# This file is licensed under the GNU General Public License version 2
# or any later version.
-my $svnrev = '$Revision: 47132 $';
-my $datrev = '$Date: 2018-03-26 19:19:25 +0200 (Mon, 26 Mar 2018) $';
+my $svnrev = '$Revision: 47220 $';
+my $datrev = '$Date: 2018-04-01 05:20:33 +0200 (Sun, 01 Apr 2018) $';
my $tlmgrrevision;
my $tlmgrversion;
my $prg;
@@ -28,6 +28,7 @@ our $tlmgr_config_file;
our $pinfile;
our $action; # for the pod2usage -sections call
our %opts;
+our $allowed_verify_args_regex = qr/^(none|main|all)$/i;
END {
if ($opts{"pause"}) {
@@ -362,6 +363,7 @@ my %globaloptions = (
"print-platform-info" => 1,
"usermode|user-mode" => 1,
"usertree|user-tree" => "=s",
+ "verify-repo" => "=s",
"verify-downloads" => "!",
"require-verification" => "!",
"version" => 1,
@@ -479,6 +481,22 @@ sub main {
$action = "remove";
}
+ #
+ # check for correctness of verify-repo argument
+ if (defined($opts{"verify-repo"}) &&
+ ($opts{"verify-repo"} !~ m/$allowed_verify_args_regex/)) {
+ tldie("$prg: unknown value for --verify-repo: $opts{'verify-repo'}\n");
+ }
+ # convert command line crypto options
+ $opts{"verify-repo"} = convert_crypto_options($opts{"verify-downloads"}, $opts{"require-verification"}, $opts{"verify-repo"});
+ if (defined($opts{"verify-downloads"}) || defined($opts{"require-verification"})) {
+ tlwarn("$prg: please use -verify-repo options instead of verify-downloads/require-verification\n" .
+ "$prg: adjusting --verify-repo=$opts{'verify-repo'}\n");
+ }
+ delete $opts{"require-verification"};
+ delete $opts{"verify-downloads"};
+
+
# now $action should be part of %actionoptions, otherwise this is
# an error
if (defined($action) && $action && !exists $action_specification{$action}) {
@@ -1781,7 +1799,8 @@ sub restore_one_package {
return ($F_ERROR);
}
$localtlpdb->remove_package($pkg);
- TeXLive::TLPDB->_install_data($restore_file , 0, [] ,$localtlpdb);
+ # the -1 force the TLUtils::unpack to NOT warn about missing checksum/sizes
+ TeXLive::TLPDB->_install_data($restore_file , 0, [], $localtlpdb, "-1", "-1");
logpackage("restore: $pkg ($rev)");
# now we have to read the .tlpobj file and add it to the DB
my $tlpobj = TeXLive::TLPOBJ->new;
@@ -1978,7 +1997,11 @@ sub action_restore {
}
}
} else {
- print "No backups available in $opts{'backupdir'}\n";
+ if ($opts{'json'}) {
+ print "[]\n";
+ } else {
+ print "No backups available in $opts{'backupdir'}\n";
+ }
}
return ($F_OK | $F_NOPOSTACTION);
}
@@ -3247,8 +3270,9 @@ sub action_update {
$unwind_package = $newname;
}
+ # the -1 force the TLUtils::unpack to NOT warn about missing checksum/sizes
my ($instret, $msg) = TeXLive::TLUtils::unpack("$unwind_package",
- $localtlpdb->root);
+ $localtlpdb->root, checksum => "-1", checksize => "-1");
if ($instret) {
# now we have to include the tlpobj
my $tlpobj = TeXLive::TLPOBJ->new;
@@ -6199,7 +6223,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
- require-verification verify-downloads 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
@@ -6518,26 +6542,26 @@ sub handle_gpg_config_settings {
# setup gpg if available
# by default we setup gpg
# default value
- my $do_setup_gpg = 1;
+ my $do_setup_gpg = "main";
# the value is set in the config file
- if (defined($config{'verify-downloads'})) {
- $do_setup_gpg = $config{'verify-downloads'};
+ if (defined($config{'verify-repo'})) {
+ $do_setup_gpg = $config{'verify-repo'};
}
# command line
- if (defined($opts{'verify-downloads'})) {
- $do_setup_gpg = $opts{'verify-downloads'};
+ if (defined($opts{'verify-repo'})) {
+ $do_setup_gpg = $opts{'verify-repo'};
}
# now we know whether we setup gpg or not
- if ($do_setup_gpg) {
+ if ($do_setup_gpg ne "none") {
if (TeXLive::TLCrypto::setup_gpg($Master)) {
debug("will verify cryptographic signatures\n")
} else {
my $prefix = "$prg: No gpg found"; # just to shorten the strings
- if ($opts{'verify-downloads'}) {
+ 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-downloads'}) {
+ 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");
}
@@ -6549,12 +6573,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-downloads'})) {
+ 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-downloads'})) {
+ } elsif (defined($config{'verify-repo'})) {
debug("$prefix, requested in config file\n");
} else {
tldie("$prg: how could this happen? gpg setup.\n");
@@ -6976,8 +7000,8 @@ sub load_config_file {
# first set default values
$config{"gui-expertmode"} = 1;
$config{"auto-remove"} = 1;
- $config{"require-verification"} = 0;
$config{"persistent-downloads"} = 1;
+ $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;
@@ -6994,6 +7018,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"};
@@ -7063,6 +7096,13 @@ sub load_options_from_config {
tlwarn("$prg: $fn: Unknown value for verify-downloads: $val\n");
}
+ } elsif ($key eq "verify-repo") {
+ if ($val =~ m/$allowed_verify_args_regex/) {
+ $config{"verify-repo"} = $val;
+ } else {
+ tlwarn("$prg: $fn: Unknown value for verify-repo: $val\n");
+ }
+
} elsif ($key eq "no-checksums") {
if ($val eq "1") {
$config{"no-checksums"} = 1;
@@ -7110,6 +7150,54 @@ 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("$prg: The options verify-downloads and require-verification have been\n" .
+ "$prg: superseeded by verify-repo, please use only the later on!\n");
+ }
+ # return immediately if verify_repo is already set
+ return($verify_repo) if (defined($verify_repo));
+
+ 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 {
@@ -7432,16 +7520,6 @@ Change the pinning file location from C<TEXMFLOCAL/tlpkg/pinning.txt>
(see L</Pinning> below). Documented only for completeness, as this is
only useful in debugging.
-=item B<--require-verification>
-
-=item B<--no-require-verification>
-
-Verify that all remote repositories to be correctly signed, or quit.
-With C<--no-require-verification>, all verification is omitted. By
-default, verification is performed (but not required) if GnuPG and the
-relevant keys are available. See L<CRYPTOGRAPHIC VERIFICATION> below for
-details.
-
=item B<--usermode>
Activates user mode for this run of C<tlmgr>; see L<USER MODE> below.
@@ -7450,14 +7528,13 @@ 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-downloads>
+=item B<--verify-repo=[none|main|all]>
-=item B<--no-verify-downloads>
-
-Enables or disables cryptographic verification of all downloaded
-database files. A working GnuPG (C<gpg>) binary needs to be present in
-the path, otherwise this option has no effect. By default, the main
-repository is verified, while any other repositories are not verified.
+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>)
+binary is available, all repositories are checked, but only the main
+repository is required to be signed. If C<all> then all repositories
+need to be signed.
See L<CRYPTOGRAPHIC VERIFICATION> below for details.
=back
@@ -9027,13 +9104,17 @@ main repository be signed, but not any additional repositories. If
C<gpg> is not available, signatures are not checked and no verification
is carried out, but C<tlmgr> proceeds normally.
-The attempted verification can be suppressed entirely by specifying
-C<--no-verify-downloads> on the command line, or a line
-C<verify-downloads=0> in a C<tlmgr> config file (see L<CONFIGURATION
-FILE FOR TLMGR>). On the other hand, you can I<require> successful
-verification by specifying C<--require-verification> on the command
-line, or C<require-verification=1> in a C<tlmgr> config file; in this
-case, if verification is not possible, or fails, the program quits.
+The behaviour of the verification can be controlled by the command line
+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
+the main repository, but attempted for all. Missing signatures of
+subsidiary repositories will not result in an error.
+Finally, in the case of C<all>, all repositories need to be signed.
+
+In all cases when a signature is checked and fails to verify, an error
+is raised.
Cryptographic verification requires checksum checking (described just
above) to succeed, and a working GnuPG (C<gpg>) program (see below for
@@ -9620,7 +9701,7 @@ This script and its documentation were written for the TeX Live
distribution (L<http://tug.org/texlive>) and both are licensed under the
GNU General Public License Version 2 or later.
-$Id: tlmgr.pl 47132 2018-03-26 17:19:25Z karl $
+$Id: tlmgr.pl 47220 2018-04-01 03:20:33Z preining $
=cut
# to remake HTML version: pod2html --cachedir=/tmp tlmgr.pl >/tmp/tlmgr.html