diff options
author | Karl Berry <karl@freefriends.org> | 2009-02-26 00:59:40 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-02-26 00:59:40 +0000 |
commit | d28e1b8714ceabf8a3a18538917f03c4230a93f9 (patch) | |
tree | 382fd8aa8099f6fae70895fd56c0763269a9777b | |
parent | b3fd7332ea18e6172db25318716832397b625ddd (diff) |
new script texloganalyser (23feb09)
git-svn-id: svn://tug.org/texlive/trunk@12237 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/texk/texlive/ChangeLog | 4 | ||||
-rw-r--r-- | Build/source/texk/texlive/Makefile.in | 3 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/texloganalyser/README | 8 | ||||
-rwxr-xr-x | Master/texmf-dist/scripts/texloganalyser/texloganalyser | 342 | ||||
-rwxr-xr-x | Master/tlpkg/libexec/ctan2tds | 30 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/collection-binextra.tlpsrc | 1 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/texloganalyser.tlpsrc | 2 |
7 files changed, 376 insertions, 14 deletions
diff --git a/Build/source/texk/texlive/ChangeLog b/Build/source/texk/texlive/ChangeLog index 759e9ebbe08..7ce5a3ea3a2 100644 --- a/Build/source/texk/texlive/ChangeLog +++ b/Build/source/texk/texlive/ChangeLog @@ -1,3 +1,7 @@ +2009-02-26 Karl Berry <karl@tug.org> + + * Makefile.in (LINKED_SCRIPTS): add texloganalyser. + 2008-11-13 Karl Berry <karl@tug.org> * Makefile.in (LINKED_SCRIPTS): add latex2man. diff --git a/Build/source/texk/texlive/Makefile.in b/Build/source/texk/texlive/Makefile.in index 748d77ecd76..cefe359b15c 100644 --- a/Build/source/texk/texlive/Makefile.in +++ b/Build/source/texk/texlive/Makefile.in @@ -39,7 +39,8 @@ LINKED_SCRIPTS = \ texmf-dist/scripts/ppower4/ppower4.texlua \ texmf-dist/scripts/pst-pdf/ps4pdf \ texmf-dist/scripts/pst2pdf/pst2pdf.pl \ - texmf-dist/scripts/texcount/TeXcount.pl \ + texmf-dist/scripts/texcount/TeXcount.pl \ + texmf-dist/scripts/texloganalyser/texloganalyser \ texmf-dist/scripts/thumbpdf/thumbpdf.pl \ texmf-dist/scripts/vpe/vpe.pl \ texmf-dist/scripts/context/ruby/texmfstart.rb \ diff --git a/Master/texmf-dist/doc/support/texloganalyser/README b/Master/texmf-dist/doc/support/texloganalyser/README new file mode 100644 index 00000000000..aaa68cc4664 --- /dev/null +++ b/Master/texmf-dist/doc/support/texloganalyser/README @@ -0,0 +1,8 @@ +This is texloganalyser (Perl script), version 0.6 + Copyright 2006-2009 Thomas van Oudenhove + License: BSD + +Usage: texloganalyser [--help|--version|-efhioprstuvw] <TeX log> + Displays selective infos of LaTeX logs + +More documentation is available with `perldoc texloganalyser`. diff --git a/Master/texmf-dist/scripts/texloganalyser/texloganalyser b/Master/texmf-dist/scripts/texloganalyser/texloganalyser new file mode 100755 index 00000000000..bcd0ef992cc --- /dev/null +++ b/Master/texmf-dist/scripts/texloganalyser/texloganalyser @@ -0,0 +1,342 @@ +#!/usr/bin/env perl +# This is texloganalyser, for parsing of TeX logs +# Copyright (c) 2006-2009 Thomas van Oudenhove +# All rights reserved + +# README - important notice: +# you should feed the first line with the path of your Perl executable +# (on *nix systems, the output of 'which perl') +# +# (this program works at least with perl 5.8.8) +# Getopt::Long MUST be installed on your system for this program to work + +# License: +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +use warnings; +use strict; +use Getopt::Long; +Getopt::Long::Configure ("bundling"); + +my $version = "0.6"; +my $copyright = "2006-2009"; +my $opt = { + help => '', + version => '', + h => '', + o => '', + u => '', + v => '', + p => '', + f => '', + w => '', + e => '', + i => '', + s => '', + r => '', + t => '', + }; + +GetOptions( + 'help' => \$opt->{help}, + 'version' => \$opt->{version}, + 'h' => \$opt->{h}, + 'o' => \$opt->{o}, + 'u' => \$opt->{u}, + 'v' => \$opt->{v}, + 'p' => \$opt->{p}, + 'f' => \$opt->{f}, + 'w' => \$opt->{w}, + 'e' => \$opt->{e}, + 'i' => \$opt->{i}, + 't' => \$opt->{t}, + 's' => \$opt->{s}, + 'r' => \$opt->{r}, + ); + +my $abstract = { + warnings => 0, + }; + +my $texlog = $ARGV[-1]; + +die "Usage: $0 ".options()." <TeX log>\n" + if (not defined $texlog and (not $opt->{help} and + not $opt->{version})); + +if ($opt->{help}) { + printhelp(); + exit(); +} + +if ($opt->{version}) { + printversion(); + exit(); +} + +analyze(); + +sub analyze { + my $line; + my $output; + my $test = 0; + + open my $source, "<", $texlog; + while (defined ($line = <$source>)) { + undef $output; + # display summary and page numbers (default) + summary($line); + pagenumber($line); + + if ($opt->{e}) { + if ($line =~ m/Here is how much/) { + $test = 1; + $output = "\n"; + } + $output .= $line if $test; + } + # look for boxes warnings + if ($opt->{o} and $opt->{h}) { + $output = $line if ($line =~ m/\\hbox/ and + $line =~ m/Overfull/); + } elsif ($opt->{u} and $opt->{h}) { + $output = $line if ($line =~ m/\\hbox/ and + $line =~ m/Underfull/); + } elsif ($opt->{o} and $opt->{v}) { + $output = $line if ($line =~ m/\\vbox/ and + $line =~ m/Overfull/); + } elsif ($opt->{u} and $opt->{v}) { + $output = $line if ($line =~ m/\\vbox/ and + $line =~ m/Underfull/); + } elsif ($opt->{h} and $opt->{v}) { + $output = $line if ($line =~ m/\\vbox/ or + $line =~ m/\\hbox/); + } elsif ($opt->{o} and $opt->{u}) { + $output = $line if ($line =~ m/Underfull/ or + $line =~ m/Overfull/); + } elsif ($opt->{h}) { + $output = $line if ($line =~ m/\\hbox/); + } elsif ($opt->{v}) { + $output = $line if ($line =~ m/\\vbox/); + } elsif ($opt->{o}) { + $output = $line if ($line =~ m/Overfull/); + } elsif ($opt->{u}) { + $output = $line if ($line =~ m/Underfull/); + } + # look for LaTeX Font Info + if ($opt->{f}) { + $output = $line if ($line =~ m/Font Info/); + } + # packages infos + if ($opt->{p}) { + $output = $line if ($line =~ m/Package/); + } + # references warnings + if ($opt->{r}) { + $output = $line if ($line =~ m/Reference/ or + $line =~ m/Label(.*)/ and $1 =~ m/multiply defined/); + } + # TeX files used + if ($opt->{t}) { + scannedfiles($line, "tex"); + } + # sty and cls files used + if ($opt->{s}) { + scannedfiles($line, "sty"); + scannedfiles($line, "cls"); + } + # images (pdf, ps, jpg, png) + if ($opt->{i}) { + foreach my $t ('pdf', 'eps', 'ps', 'png', 'jpg') { + scannedfiles($line, $t); + } + } + # display all warnings + if ($opt->{w}) { + $output = $line if ($line =~ m/Warning/); + } + print "$output" if defined $output; + } + print "\n"; + print_abstract(); + close $source; +} + +sub pagenumber { + my $logline = shift; + if ($logline =~ m/.*(\[[0-9]+)/) { + print $1."]"; + } +} + +sub scannedfiles { + my ($logline, $filetype) = @_; + if ($logline =~ m/^\((.*\.$filetype)/i) { + print "(".$1.")"; + } +} + +sub summary { + my $line = shift; + # prints log summary () + $abstract->{warnings} += 1 if ($line =~ m/Warning/); +} + +sub options { + my $stropts = "["; + my $multopt = ''; + foreach my $k (sort keys %{$opt}) { + if ($k eq 'version') { + $stropts .= "--version|"; + } elsif ($k eq 'help') { + $stropts .= "--help|"; + } else { + $multopt .= $k; + } + } + $stropts .= '-'.$multopt.']'; + return $stropts; +} + +sub print_abstract { + print "The log contained ".$abstract->{warnings}." warnings.\n"; +} + +sub printversion { + print "This is texloganalyser, version $version\n"; + print "\t Copyright $copyright Thomas van Oudenhove\n"; +} + +sub printhelp { + printversion(); + print "Usage: texloganalyser ".options()." <TeX log>\n"; + print "\t Displays selective infos of LaTeX logs\n"; + print "These flags may be used:\n"; + print "\t e: displays the end of the log\n"; + print "\t f: outputs the LaTeX Font Infos\n"; + print "\t h: outputs only warnings about horizontal boxes\n"; + print "\t i: displays 'images' (pdf, [e]ps, png, jpg) used\n"; + print "\t o: outputs only warnings about overfull boxes\n"; + print "\t p: outputs the LaTeX Packages infos\n"; + print "\t r: displays warnings about references\n"; + print "\t s: displays .sty and .cls files used\n"; + print "\t t: displays .tex files used\n"; + print "\t u: outputs only warnings about underfull boxes\n"; + print "\t v: outputs only warnings about vertical boxes\n"; + print "\t w: displays all Warnings\n"; + print "You may want to have a look at `perldoc texloganalyser`.\n"; +} + +__END__ + + +=pod + +=head1 texloganalyser Documentation + +=head2 NAME + +texloganalyser -- displays selective infos from TeX log files + +=head2 SYNOPSIS + +texloganalyser [-efhioprstuvw] tex_log_file + +texloganalyser [--version] + +texloganalyser [--help] + +=head2 DESCRIPTION + +Various options may be used to select which information from the TeX log you want to see/analyze (see next section). The default is to display only page numbers (page numbers are B<always> displayed). + +=head2 OPTIONS + +=over 1 + +=item B<--version>: displays version information. + +=item B<--help>: displays help as a summary of options. + +=item B<-e>: displays the end of the log, about the TeX's memory. + +=item B<-f>: outputs the LaTeX Font Infos warnings and calculations. + +=item B<-h>: outputs only warnings about horizontal boxes. + +=item B<-i>: displays 'images' (pdf, [e]ps, png, jpg) used. + +=item B<-o>: outputs only warnings about overfull boxes. + +=item B<-p>: outputs the LaTeX Packages infos and warnings. + +=item B<-r>: displays warnings about references (missing or multiply-defined). + +=item B<-s>: displays .sty and .cls files used. + +=item B<-t>: displays .tex files used. This option is B<very> useful when you parse logs of master files, to know in which file to look to correct errors/warnings. + +=item B<-u>: outputs only warnings about underfull boxes. + +=item B<-v>: outputs only warnings about vertical boxes. + +=item B<-w>: displays all TeX, LaTeX and font Warnings. + +=back + +=head2 BUGS + +None yet identified. However, the display should be improved... + +=head2 HISTORY + +This program was first released in 2006. Its purpose was to display selective information of my PhD's TeX log. + +=head3 Changelog + +=over + +=item v0.6: default displays number of warnings (and page numbers). + + added option: references and label warnings + +=item v0.5: use of GetOpt::Long and code cleaning + + added options: display of files used + improved documentation + +=item v0.4: added features and bugs corrections (options h, v, o and u) + +=item v0.3: display of Warnings and last lines of the log + +=item v0.2: display of "Font Info" and "Packages" added + +=item v0.1: first version, displays only warnings about boxes + +=back + +=head2 AUTHORS + +I<texloganalyser> is a program by Thomas van Oudenhove (L<vanouden@enstimac.fr>). Feel free to contact him for features requests or bugs. + +=cut diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index 4485c5a3956..1aa7d6d3e60 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -1034,7 +1034,8 @@ $standardtex='\.(cfg|sty|clo|ldf|cls|def|fd|cmap|4ht)$'; 'tamil-omega', 'omega', 'templates-fenn', 'german', 'templates-sommer', 'german', - 'texcount', 'support', + 'texcount', 'support', + 'texloganalyser', 'support', 'texsis', 'texsis', 'textpath', 'metapost', 'trajan', 'fonts', @@ -1379,19 +1380,22 @@ $standardocp='\.ocp'; ); $standardxmt='\.xmt'; -# packages which have executable scripts +# executable scripts to install under texmf*/.../scripts. +# if they should end up in $bindir too, +# add to Build/source/texk/texlive/Makefile.in (and ChangeLog). %specialscripts = ( - 'a2ping' => '\.pl$', - 'dviasm' => '\.py$', - 'epstopdf' => 'epstopdf', - 'latex2man' => 'latex2man$', - 'latexmk' => '\.pl$', - 'mkjobtexmf' => '\.pl$', - 'pdfcrop' => '\.pl$', - 'perltex' => '\.pl$', - 'pst2pdf' => '\.pl$', - 'texcount' => '\.pl$', - 'vpe' => '\.pl$', + 'a2ping' => '\.pl$', + 'dviasm' => '\.py$', + 'epstopdf' => 'epstopdf', + 'latex2man' => 'latex2man$', + 'latexmk' => '\.pl$', + 'mkjobtexmf' => '\.pl$', + 'pdfcrop' => '\.pl$', + 'perltex' => '\.pl$', + 'pst2pdf' => '\.pl$', + 'texcount' => '\.pl$', + 'texloganalyser' => 'texloganalyser', + 'vpe' => '\.pl$', ); # too painful to install in multiple trees just now. diff --git a/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc index 2e6b52f0aca..4e7d47b69b5 100644 --- a/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc @@ -35,4 +35,5 @@ depend mkjobtexmf depend pdfcrop depend synctex depend texcount +depend texloganalyser depend xindy diff --git a/Master/tlpkg/tlpsrc/texloganalyser.tlpsrc b/Master/tlpkg/tlpsrc/texloganalyser.tlpsrc new file mode 100644 index 00000000000..bbcfb232d1b --- /dev/null +++ b/Master/tlpkg/tlpsrc/texloganalyser.tlpsrc @@ -0,0 +1,2 @@ +name texloganalyser +category Package |