texlive[53221] Master/tlpkg: tl-check-fmttriggers: new option
commits+karl at tug.org
commits+karl at tug.org
Tue Dec 24 01:15:50 CET 2019
Revision: 53221
http://tug.org/svn/texlive?view=revision&revision=53221
Author: karl
Date: 2019-12-24 01:15:50 +0100 (Tue, 24 Dec 2019)
Log Message:
-----------
tl-check-fmttriggers: new option --analyze to report common dependencies.
(analyze_triggers): new function.
TLUtils.pm: pod syntax.
Modified Paths:
--------------
trunk/Master/tlpkg/TeXLive/TLUtils.pm
trunk/Master/tlpkg/bin/tl-check-fmttriggers
Modified: trunk/Master/tlpkg/TeXLive/TLUtils.pm
===================================================================
--- trunk/Master/tlpkg/TeXLive/TLUtils.pm 2019-12-23 22:34:41 UTC (rev 53220)
+++ trunk/Master/tlpkg/TeXLive/TLUtils.pm 2019-12-24 00:15:50 UTC (rev 53221)
@@ -3294,6 +3294,8 @@
Logging and debugging messages.
+=over 4
+
=item C<logit($out,$level, at rest)>
Internal routine to write message to both C<$out> (references to
Modified: trunk/Master/tlpkg/bin/tl-check-fmttriggers
===================================================================
--- trunk/Master/tlpkg/bin/tl-check-fmttriggers 2019-12-23 22:34:41 UTC (rev 53220)
+++ trunk/Master/tlpkg/bin/tl-check-fmttriggers 2019-12-24 00:15:50 UTC (rev 53221)
@@ -29,6 +29,7 @@
my $prg = TeXLive::TLUtils::basename($0);
+my $opt_analyze = 0;
my $opt_fmtargs = "--all";
my $opt_fmtdir = "/tmp/fmttriggers";
my $opt_rerecord = 1;
@@ -37,6 +38,7 @@
TeXLive::TLUtils::process_logging_options ();
GetOptions (
+ "analyze" => \$opt_analyze,
"fmtargs=s" => \$opt_fmtargs,
"fmtdir" => \$opt_fmtdir,
"rerecord!" => \$opt_rerecord,
@@ -46,9 +48,6 @@
pod2usage ("-exitstatus" => 0, "-verbose" => 2) if $help;
if ($opt_version) { print "$vc_id\n"; exit 0; }
-$::installerdir = $Master; # TLUtils.pm should be smarter
-$ENV{'PATH'} = "$Master/bin/" . TeXLive::TLUtils::platform() . ":$ENV{PATH}";
-
# These don't have triggers, and that's ok.
my $no_triggers_ok = '^(mf-nowin\.mf|(pdf|xe)tex\.cont-en)$';
@@ -56,6 +55,9 @@
sub main {
+ $::installerdir = $Master; # TLUtils.pm should be smarter
+ $ENV{'PATH'} = "$Master/bin/" . TeXLive::TLUtils::platform() . ":$ENV{PATH}";
+
# no interference from TEXMFHOME, etc.
$ENV{'TEXMFHOME'} = "/nonesuch-home";
$ENV{'TEXMFVAR'} = "/nonesuch-uvar";
@@ -62,19 +64,25 @@
$ENV{'TEXMFCONFIG'} = "/nonesuch-config";
$ENV{'TEXMFLOCAL'} = "/nonesuch-local";
- if ($opt_rerecord) { # remake recorder files?
+ if ($opt_rerecord && ! $opt_analyze) { # remake recorder files?
my $status = &run_fmtutil ($opt_fmtdir);
return $status if $status;
}
#system ("bytime $opt_fmtdir");
- # read recorder files.
- my %files_per_format = &files_per_format ($opt_fmtdir);
-
# read tlpdb.
my $tlpdb_file = "$Master/tlpkg/texlive.tlpdb";
my ($tlpdb,$fmttriggers,$fmtpkgcontainers) = &tlpdb_by_file ($tlpdb_file);
+ # if reporting on the trigger subsets, just do that and we're done.
+ if ($opt_analyze) {
+ &analyze_triggers ($fmttriggers);
+ return 0;
+ }
+
+ # read recorder files.
+ my %files_per_format = &files_per_format ($opt_fmtdir);
+
# map files used in the format builds to packages.
my %pkgs_per_format = &pkgs_per_format ($tlpdb, %files_per_format);
@@ -181,7 +189,7 @@
# Read TLPDB_FILE and return references to three hashes:
# the first mapping contained files to TL package names,
# the second mapping engine.format names to their specified fmttriggers,
-# and the third mapping engine.format names to the package defining them.
+# the third mapping engine.format names to the package defining them.
#
# Instead of using the general TeXLive::TLPDB functions, read the tlpdb
# file ourselves. We want to build the file->package mapping just once,
@@ -365,6 +373,27 @@
return $bad_p;
}
+
+sub analyze_triggers {
+ my ($fmttriggers) = @_;
+ my %fmttriggers = %$fmttriggers;
+
+ my %by_pkg;
+ for my $ef (sort keys %fmttriggers) {
+ next if $ef =~ /(aleph|lamed|jadetex|mex)$/; # these are taken care of
+ my @pkgs = @{$fmttriggers{$ef}};
+ #print "$ef => @pkgs\n";
+ for my $p (@pkgs) {
+ $by_pkg{$p} .= " $ef";
+ }
+ }
+
+ for my $p (sort { ($by_pkg{$b} =~ tr/ //)
+ <=> ($by_pkg{$a} =~ tr/ //) } keys %by_pkg) {
+ printf "%-14s %2d %s\n", $p, ($by_pkg{$p} =~ tr/ //), $by_pkg{$p};
+ }
+}
+
__END__
=head1 NAME
@@ -379,6 +408,16 @@
=over 4
+=item B<--analyze>
+
+Instead of the usual dependency check described below, merely report the
+list of I<engine>.I<format> which each package is a dependency for,
+sorted by the number of I<engine>.I<format>s. This provides some
+information for creating common dependencies, which can then be defined
+as C<global_> tlpvars in C<00texlive.autopatterns.tlpsrc>, to increase
+maintainability. (It does not actually try to figure out any tlpvars or
+which packages to use them in, just reports counts.)
+
=item B<--fmtargs> I<str>
Pass I<str> to C<fmtutil>, overriding C<--all>; e.g., for debugging you
More information about the tex-live-commits
mailing list