diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/stex/bin/grep-rerun')
-rwxr-xr-x | Master/texmf-dist/source/latex/stex/bin/grep-rerun | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/stex/bin/grep-rerun b/Master/texmf-dist/source/latex/stex/bin/grep-rerun new file mode 100755 index 00000000000..f73ef082fbb --- /dev/null +++ b/Master/texmf-dist/source/latex/stex/bin/grep-rerun @@ -0,0 +1,59 @@ +#!/usr/bin/perl -w +####################################################################################### +# A tool for updating .dtx files with a correspodning checksum counter # +# Copyright (c) 2010, Deyan Ginev, released under the Gnu General Public License (GPL)# +# see http://www.gnu.org/copyleft/gpl.html # +# $URL: https://svn.kwarc.info/repos/stex/trunk/bin/gre-rerun$ # +####################################################################################### + +use strict; + +use Getopt::Long; +use Pod::Usage; +use File::Spec; +use Cwd qw(abs_path); + +####### start of program ####### +my ($errlog,$pattern)=@ARGV; +my %rerun_set = (); +open(IN,"<",$errlog); +my ($errvol,$errdir)=File::Spec->splitpath($errlog); +my $currpath=abs_path($errdir); +while (<IN>) { + #Entering, update path + if (/^Entering (.+)$/) { + $currpath.="/$1"; + } + #Leaving, update path + elsif (/^Leaving (.+)$/) { + $currpath =~ s/(\/$1)$//; + } + #Matching error, note source + elsif (/$pattern/) { + my ($name) = split(/:/,$_); + ($name) = split(/\./,$name); + $rerun_set{$currpath."/".$name.".tex"}=1; + } +} +#Perform rerun of affected sources: +print STDERR scalar(keys %rerun_set)." sources to rerun:\n"; +foreach (sort keys %rerun_set) { + my ($vol,$dir,$file) = File::Spec->splitpath( $_ ); + print STDERR "Trying $_\n"; + $file=~s/\.tex$/.omdoc/; + print STDERR `cd $dir; make $file -B`; +} +close(IN); + + +__END__ + + +=head1 SYNOPSIS + +grep-rerun <errlog filename> <grep pattern> + +Purpose: + Given an error log file, generated via the sTeX Makefiles, and an error pattern, fetches and reconverts all sources that suffered this error. +Example: + grep-rerun latex.errlog "Fatal:" |