diff options
author | Karl Berry <karl@freefriends.org> | 2019-09-08 21:54:05 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-09-08 21:54:05 +0000 |
commit | 093262994f4504b8f4bcd637076ef4645e615365 (patch) | |
tree | b3180da00653202b562d58a09542eb8630f9c523 /Build/source | |
parent | 32ec07a1d859471f7e29078f238581767a162ccc (diff) |
bundledoc (8sep19)
git-svn-id: svn://tug.org/texlive/trunk@52059 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rwxr-xr-x | Build/source/texk/texlive/linked_scripts/bundledoc/bundledoc | 100 | ||||
-rwxr-xr-x | Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl | 55 |
2 files changed, 131 insertions, 24 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/bundledoc/bundledoc b/Build/source/texk/texlive/linked_scripts/bundledoc/bundledoc index 142f1aaac0d..02c7d8e5d93 100755 --- a/Build/source/texk/texlive/linked_scripts/bundledoc/bundledoc +++ b/Build/source/texk/texlive/linked_scripts/bundledoc/bundledoc @@ -7,7 +7,7 @@ ######################################################################## # bundledoc # -# Copyright (C) 2018 Scott Pakin # +# Copyright (C) 2018-2019 Scott Pakin # # # # This program may be distributed and/or modified under the conditions # # of the LaTeX Project Public License, either version 1.3c of this # @@ -24,8 +24,8 @@ # in the Files section of the associated README file. # ######################################################################## -use 5.006; # Fail gracefully if we're not using Perl v5.6.0. -our $VERSION = "3.3"; # Specify the version of bundledoc. +use 5.006; # Fail gracefully if we're not using Perl v5.6.0+. +our $VERSION = "3.4"; # Specify the version of bundledoc. use File::Basename; use File::Copy; use File::Spec::Functions qw(abs2rel catfile devnull rel2abs rootdir updir); @@ -87,8 +87,7 @@ sub executecmd ($) my $retval; if ($verbose) { - print "EXECUTING: $command\n"; - print " (BDINPUTS = $ENV{BDINPUTS})\n"; + print "EXECUTING $command WITH BDINPUTS = $ENV{BDINPUTS}\n"; } if ($pathsep eq "\\") { # Dirty trick to work around idiotic "\" --> "/" conversion @@ -100,12 +99,65 @@ sub executecmd ($) die "${progname}: $!. Failing command was:\n\t$command\n" if $retval; } +# Append ".dep" to the dependency file if necessary. +sub find_dependency_file ($) +{ + my $depfile = $_[0]; + + # Return the file as is if it exists. + return $depfile if -e $depfile || $depfile =~ /\.dep$/; + + # Return the file with ".dep" appended if that exists. + return "${depfile}.dep" if -e "${depfile}.dep"; + + # Give up and return the file as specified. + return $depfile; +} + +# Try hard to find a configuration file. Return the name of the actual file we +# located. +sub find_config_file ($) +{ + my $configfile = $_[0]; + no warnings; # Don't complain if kpsewhich isn't found. + + # Attempt 1: See if the file exists as named. + return $configfile if -e $configfile; + + # Attempt 2: Append ".cfg" if it's not already there. + my $config_cfg = $configfile; + if ($config_cfg !~ /\.cfg$/) { + $config_cfg = "${configfile}.cfg"; + return $config_cfg if -e $config_cfg; + } + + # Attempt 3: Use kpsewhich to find the file with ".cfg" appended. (We + # don't search for it without ".cfg" because kpsewhich may find a version + # with ".tex" appended.) + my $kpfound = `kpsewhich $config_cfg`; + if (defined $kpfound) { + chomp $kpfound; + return $kpfound if -e $kpfound; + } + + # Give up. Return the file name as specified. + return $configfile; +} + # Read a configuration file, and set %uservariable accordingly. sub process_config_file ($) { - my $configfile = $_[0]; + my $configfile = find_config_file $_[0]; + printf("CONFIGURATION FILE: %s\n", rel2abs($configfile)) if $verbose; my $prevline = ""; - open (CONFIGFILE, "<$configfile") || die "${progname}: $! ($configfile)\n"; + open (CONFIGFILE, "<", $configfile) || do { + my $configlist = $configfile; + if (! -e $configfile) { + # Error is "file not found". List the files we considered. + $configlist .= "; also considered ${configfile}.cfg" if $configfile !~ /\.cfg$/; + } + die "${progname}: $! ($configlist)\n"; + }; while (my $oneline=<CONFIGFILE>) { # Read a line and trim it. chomp $oneline; @@ -222,7 +274,7 @@ sub find_dependencies () my $numextras = 0; foreach my $include_glob (@include_files) { foreach my $include_file (glob $include_glob) { - push @dependencies, $include_file; + push @dependencies, qualifyname $include_file; $numextras++; } } @@ -255,6 +307,7 @@ my $showhelp = ""; $keepdirs = 0; $verbose = 0; $localonly = 0; +my $configfile; Getopt::Long::Configure("bundling"); GetOptions ('texfile=s' => \$texfile, 'directory=s' => \$docdirname, @@ -263,7 +316,7 @@ GetOptions ('texfile=s' => \$texfile, 'localonly!' => \$localonly, 'exclude=s' => \@exclude_files, 'include=s' => \@include_files, - 'config=s' => sub { process_config_file($_[1]) }, + 'config=s' => \$configfile, 'v|verbose!' => \$verbose, 'listdeps=s' => \@listdeps, 'V|version' => sub { print "bundledoc $VERSION\n"; exit -1 }, @@ -276,7 +329,8 @@ pod2usage (-message => "(For more detailed help, enter \"$0 --help --verbose\".) pod2usage (-message => "${progname}: Too few arguments", -exitval => 1, -verbose => 0) if $#ARGV==-1; -$depfile = shift; # Dependencies from snapshot.sty +$depfile = find_dependency_file shift; # Dependencies from snapshot.sty +process_config_file $configfile if defined $configfile; ($texfile = $depfile) =~ s/\.[^.]*$/.tex/ if !$texfile; # Main LaTeX source file ($docdirname = basename($depfile)) =~ s/\.[^.]*$// if !$docdirname; # Name to use for the document directory ($ENV{"BDBASE"} = rel2abs($depfile)) =~ s/\.[^.]*$//; # May be needed by user-defined variables @@ -370,7 +424,7 @@ bundledoc [B<--version>] [B<--help>] [B<-->[B<no>]B<verbose>] -[B<--texfile>=I<file>] +[B<--texfile>=I<file.tex>] [B<--directory>=I<directory>] [B<-->[B<no>]B<localonly>] [B<--exclude>=I<string>] @@ -378,8 +432,8 @@ bundledoc [B<--manifest>=I<file>] [B<-->B<listdeps>=[yes|no|only|rel]...] [B<-->[B<no>]B<keepdirs>] -[B<--config>=I<file>] -I<.dep file> +[B<--config>=I<file.cfg>] +I<file.dep> =head1 DESCRIPTION @@ -414,8 +468,9 @@ In the following descriptions, I<somefile> refers to the name of your main LaTeX document (no extension). B<bundledoc> requires the name of the dependency file produced by -B<snapshot> (normally I<somefile>F<.dep>). The following options may -also be given: +B<snapshot>, normally I<somefile>F<.dep>). (For convenience, the file +can be specified without its F<.dep> extension.) The following +options may also be given: =over 4 @@ -561,7 +616,8 @@ The C<--config> option is used to point B<bundledoc> to the appropriate configuration (F<.cfg>) file for your TeX distribution and operating system. B<bundledoc> comes with a few configuration files and it's easy to write more. See L<"CONFIGURATION FILES"> (below) for -a description of the configuration file format. +a description of the configuration file format. For convenience, the +file can be specified without its F<.cfg> extension. =back @@ -654,8 +710,9 @@ distribution running on Microsoft Windows: bundledoc --config=miktex.cfg myfile.dep -(In practice, it's probably necessary to specify to C<--config> the -complete path to B<bundledoc>'s F<miktex.cfg> configuration file.) +This can be abbreviated to + + bundledoc --config=miktex myfile The following builds a F<.tar.gz> archive with the TeX Live distribution running on a Unix-like operating system. B<bundledoc> @@ -830,8 +887,11 @@ other common font formats, as well. Thanks to Fabien Vignes-Tourneret for suggesting what became the C<--localonly> option and for a discussion that led to the -C<--exclude> and C<--include> options; and to Marius Kleiner for -updating B<bundledoc> to properly handle document subdirectories. +C<--exclude> and C<--include> options; to Marius Kleiner for updating +B<bundledoc> to properly handle document subdirectories; and to Frank +Mittelbach for suggesting using Kpathsea to help find F<.cfg> files +and to automatically append F<.cfg> and F<.dep> extensions if +necessary. =head1 SEE ALSO diff --git a/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl b/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl index 79777051896..f168064c175 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 51800 2019-08-01 22:51:44Z karl $ +# $Id: tlmgr.pl 52045 2019-09-07 05:32:39Z preining $ # # Copyright 2008-2019 Norbert Preining # This file is licensed under the GNU General Public License version 2 # or any later version. -my $svnrev = '$Revision: 51800 $'; -my $datrev = '$Date: 2019-08-02 00:51:44 +0200 (Fri, 02 Aug 2019) $'; +my $svnrev = '$Revision: 52045 $'; +my $datrev = '$Date: 2019-09-07 07:32:39 +0200 (Sat, 07 Sep 2019) $'; my $tlmgrrevision; my $tlmgrversion; my $prg; @@ -5340,6 +5340,8 @@ sub action_check { $ret |= check_executes(); print "Running check runfiles:\n"; $ret |= check_runfiles(); + print "Running check texmfdb paths\n"; + $ret |= check_texmfdbs(); } elsif ($what =~ m/^files/i) { my $tltree = init_tltree($svn); $ret |= check_files($tltree); @@ -5352,6 +5354,8 @@ sub action_check { $ret |= check_runfiles(); } elsif ($what =~ m/^executes/i) { $ret |= check_executes(); + } elsif ($what =~ m/^texmfdbs/i) { + $ret |= check_texmfdbs(); } else { print "No idea how to check that: $what\n"; } @@ -5842,6 +5846,49 @@ sub check_depends { return $ret; } +sub check_texmfdbs { + +#!/usr/bin/perl + my $texmfdbs = `kpsewhich -var-value TEXMFDBS`; + my @tfmdbs = glob $texmfdbs; + my $tfms = `kpsewhich -var-value TEXMF`; + my @tfms = glob $tfms; + my %tfmdbs; + my $ret = 0; + + print "Checking TEXMFDBS\n"; + for my $p (@tfmdbs) { + print "-> $p\n"; + if ($p !~ m/^!!/) { + printf "Warn: entry $p in TEXMFDBS does not have leading !!\n"; + $ret++; + } + $p =~ s/^!!//; + $tfmdbs{$p} = 1; + if (! -r "$p/ls-R") { + printf "Warn: entry $p does not have an associated ls-R\n"; + $ret++; + } + } + + print "Checking TEXMF\n"; + for my $p (@tfms) { + print "-> $p\n"; + my $pnobang = $p; + $pnobang =~ s/^!!//; + if (! $tfmdbs{$pnobang}) { + if ($p =~ m/^!!/) { + printf "Warn: tree $p in TEXMF is not in TEXMFDBS but has !!\n"; + $ret++; + } + if (-r "$pnobang/ls-R") { + printf "Warn: tree $p in TEXMF is not in TEXMFDBS but has ls-R file\n"; + $ret++; + } + } + } + return($ret); +} # POSTACTION # @@ -9861,7 +9908,7 @@ This script and its documentation were written for the TeX Live distribution (L<https://tug.org/texlive>) and both are licensed under the GNU General Public License Version 2 or later. -$Id: tlmgr.pl 51800 2019-08-01 22:51:44Z karl $ +$Id: tlmgr.pl 52045 2019-09-07 05:32:39Z preining $ =cut # test HTML version: pod2html --cachedir=/tmp tlmgr.pl >/tmp/tlmgr.html |