From b829377072939c2fb2c94cf201eb663ca123b898 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 24 Dec 2019 00:15:50 +0000 Subject: tl-check-fmttriggers: new option --analyze to report common dependencies. (analyze_triggers): new function. TLUtils.pm: pod syntax. git-svn-id: svn://tug.org/texlive/trunk@53221 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/TeXLive/TLUtils.pm | 2 ++ Master/tlpkg/bin/tl-check-fmttriggers | 55 ++++++++++++++++++++++++++++++----- 2 files changed, 49 insertions(+), 8 deletions(-) (limited to 'Master') diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index 1e250cac034..61dcff6afef 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -3294,6 +3294,8 @@ sub parse_AddFormat_line { Logging and debugging messages. +=over 4 + =item C Internal routine to write message to both C<$out> (references to diff --git a/Master/tlpkg/bin/tl-check-fmttriggers b/Master/tlpkg/bin/tl-check-fmttriggers index 16dcce72a7d..7ca90ba9f7a 100755 --- a/Master/tlpkg/bin/tl-check-fmttriggers +++ b/Master/tlpkg/bin/tl-check-fmttriggers @@ -29,6 +29,7 @@ use TeXLive::TLUtils qw(info debug ddebug debug_hash tlwarn tldie); 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 @@ my $opt_version = 0; TeXLive::TLUtils::process_logging_options (); GetOptions ( + "analyze" => \$opt_analyze, "fmtargs=s" => \$opt_fmtargs, "fmtdir" => \$opt_fmtdir, "rerecord!" => \$opt_rerecord, @@ -46,9 +48,6 @@ GetOptions ( 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,25 +55,34 @@ exit (&main()); 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"; $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 @@ sub files_per_format { # 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 @@ sub compare_pkgs_and_triggers { 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 @@ check-fmttriggers [I