diff options
author | Karl Berry <karl@freefriends.org> | 2019-12-24 00:15:50 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-12-24 00:15:50 +0000 |
commit | b829377072939c2fb2c94cf201eb663ca123b898 (patch) | |
tree | e5871a5a0c417ff31952eb0929101b6f12a5ba71 /Master/tlpkg | |
parent | 58cf54d56b288c227c9275421f2e6ab8d3468697 (diff) |
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
Diffstat (limited to 'Master/tlpkg')
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 2 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tl-check-fmttriggers | 55 |
2 files changed, 49 insertions, 8 deletions
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<logit($out,$level,@rest)> 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<option>]... =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 |