diff options
Diffstat (limited to 'Master/tlpkg/bin/check-execute-consistency')
-rwxr-xr-x | Master/tlpkg/bin/check-execute-consistency | 245 |
1 files changed, 0 insertions, 245 deletions
diff --git a/Master/tlpkg/bin/check-execute-consistency b/Master/tlpkg/bin/check-execute-consistency deleted file mode 100755 index 6dc3b048033..00000000000 --- a/Master/tlpkg/bin/check-execute-consistency +++ /dev/null @@ -1,245 +0,0 @@ -#!/usr/bin/env perl -# $Id$ -# Copyright 2007, 2009 Norbert Preining -# This file is licensed under the GNU General Public License version 2 -# or any later version. -# -# Check that files needed for execute statements in tlpsrc files are present. - -BEGIN { - $^W = 1; - ($mydir = $0) =~ s,/[^/]*$,,; - unshift (@INC, "$mydir/.."); -} - -our $mydir; - -use strict; - -use TeXLive::TLConfig; -use TeXLive::TLUtils; -use TeXLive::TLPOBJ; -use TeXLive::TLPDB; -use Getopt::Long; -use Pod::Usage; -use File::Path; - -my $help = 0; - -process_logging_options(); - -GetOptions("help|?" => \$help) or pod2usage(1); -pod2usage(-exitstatus => 0, -verbose => 2) if $help; - -exit (&main ()); - -sub main -{ - # get the db. - chomp (my $Master = `cd $mydir/../.. && pwd`); - my $tlpdb = TeXLive::TLPDB->new ("root" => "$Master"); - die("Cannot find tlpdb in $Master!\n") unless defined($tlpdb); - my (%maps,%langcodes,%fmtlines); - for my $pkg ($tlpdb->list_packages) { - for my $e ($tlpdb->get_package($pkg)->executes) { - if ($e =~ m/add(Mixed)?Map\s+(.*)$/) { - my $foo = $2; - chomp($foo); - push @{$maps{$foo}}, $pkg; - } elsif ($e =~ m/AddFormat\s+(.*)$/) { - my $foo = $1; - chomp($foo); - push @{$fmtlines{$foo}}, $pkg; - } elsif ($e =~ m/AddHyphen\s+.*\s+file=(\S+)\s*$/) { - my $foo = $1; - chomp($foo); - push @{$langcodes{$foo}}, $pkg; - } else { - warn "$pkg: unmatched execute: $e\n"; - } - } - } - my %badmaps; - foreach my $mf (keys %maps) { - my @found = $tlpdb->find_file($mf); - if ($#found < 0) { - $badmaps{$mf} = $maps{$mf}; - } - if ($#found > 0) { - # we want to check for multiple inclusions - my %mapfn; - foreach my $foo (@found) { - $foo =~ m/^(.*):(.*)$/; - push @{$mapfn{$2}}, $1; - } - foreach my $k (keys %mapfn) { - my @bla = @{$mapfn{$k}}; - if ($#bla > 0) { - warn "map file $mf occurs multiple times (in pkg @bla)!\n"; - } - } - } - } - if (keys %badmaps) { - print "mentioned map file not occuring in any package:\n"; - foreach my $mf (keys %badmaps) { - print "\t$mf (execute in @{$badmaps{$mf}})\n"; - } - } - my %badhyphcodes; - my %problemhyphen; - foreach my $lc (keys %langcodes) { - next if ($lc eq "zerohyph.tex"); - my @found = $tlpdb->find_file("texmf-dist/tex/generic/hyph-utf8/loadhyph/$lc"); - if ($#found < 0) { - # try again this time search all packages - my @found = $tlpdb->find_file("$lc"); - if ($#found < 0) { - $badhyphcodes{$lc} = $langcodes{$lc}; - } else { - $problemhyphen{$lc} = [ @found ]; - } - } - } - if (keys %badhyphcodes) { - print "mentioned hyphen loaders without file:\n"; - foreach my $mf (keys %badhyphcodes) { - print "\t$mf (execute in @{$badhyphcodes{$mf}})\n"; - } - } - # disable the echoing of problematic hyphens - #if (keys %problemhyphen) { - # print "hyphen files with possible problematic location:\n"; - # foreach my $mf (keys %problemhyphen) { - # print "\t$mf (@{$problemhyphen{$mf}})\n"; - # } - #} - # - # what should be checked for the executes? we could check - # - the existence of the engine in bin/i386-linux or all $arch - # - the existence of the format name link/bat - # - parse the options parameter and check for the inifile - # - rework the format definition that we have inifile=pdflatex.ini - # isn't the * unnecessary? - my %missingbins; - my %missingengines; - my %missinginis; - for (keys %fmtlines) { - my %r = TeXLive::TLUtils::parse_AddFormat_line("$_"); - if (defined($r{"error"})) { - die "$r{'error'}, parsing $_, package(s) @{$fmtlines{$_}}"; - } - my $opt = $r{"options"}; - my $engine = $r{"engine"}; - my $name = $r{"name"}; - my $mode = $r{"mode"}; - # special case for cont-en ... - next if ($name eq "cont-en"); - # we check that the name exist in bin/$arch - for my $a ($tlpdb->available_architectures) { - my $f = "$Master/bin/$a/$name"; - if (!check_file($a, $f)) { - if ($a eq "i386-cygwin") { - # on cygwin the following can happen: xmltex -> pdftex, but - # there is only pdftex.exe, so -r does not succeed - if (-l $f) { - my $ld = readlink ($f); - if (!check_file($a, "$Master/bin/$a/$ld")) { - push @{$missingbins{$_}}, "bin/$a/$name" if $mode; - } - } else { - push @{$missingbins{$_}}, "bin/$a/$name" if $mode; - } - } else { - push @{$missingbins{$_}}, "bin/$a/$name" if $mode; - } - } - if (!check_file($a, "$Master/bin/$a/$engine")) { - push @{$missingengines{$_}}, "bin/$a/$engine" if $mode; - } - } - # check for the existence of the .ini file - # by using the last word in the options value - my $inifile = $opt; - # $inifile now contains "bla bla bla *file.ini" - # strip initial and trailing " - $inifile =~ s/^"(.*)"$/$1/; - # remove everything before the last space - $inifile =~ s/^.* ([^ ]*)$/$1/; - # remove the optional leading * - $inifile =~ s/^\*//; - my @found = $tlpdb->find_file("$inifile"); - if ($#found < 0) { - $missinginis{$_} = "$inifile"; - } - } - if (keys %missinginis) { - print "mentioned ini files that cannot be found:\n"; - for my $i (keys %missinginis) { - print "\t $missinginis{$i} (execute: $i)\n"; - } - } - if (keys %missingengines) { - print "mentioned engine files that cannot be found:\n"; - for my $i (keys %missingengines) { - print "\t @{$missingengines{$i}}\n"; - } - } - if (keys %missingbins) { - print "mentioned bin files that cannot be found:\n"; - for my $i (keys %missingbins) { - print "\t @{$missingbins{$i}}\n"; - } - } -} - -sub check_file { - my ($a, $f) = @_; - if (-r $f) { - return 1; - } else { - # not -r, so check for the extensions .bat and .exe on w32 and cygwin - if (($a eq "win32") || ($a eq "i386-cygwin")) { - if (-r "$f.exe" || -r "$f.bat") { - return 1; - } - } - return 0; - } -} - -__END__ - -=head1 NAME - -check-execute-consistency - check tlpdb execute directives - -=head1 SYNOPSIS - -check-execute-consistency - -=head1 OPTIONS - -Only the standard options B<-help> and B<-q>, B<-v>, and -B<-logfile>=I<file> are accepted; see the C<process_logging_options> -function in L<TeXLive::TLUtils> for details. - -=head1 DESCRIPTION - -Check that the files referred to by C<execute> directives in the TeX -Live Database are present. - -=head1 AUTHORS AND COPYRIGHT - -This script and its documentation were written for the TeX Live -distribution (L<http://tug.org/texlive>) and both are licensed under the -GNU General Public License Version 2 or later. - -=cut - -### Local Variables: -### perl-indent-level: 2 -### tab-width: 2 -### indent-tabs-mode: nil -### End: -# vim:set tabstop=2 expandtab: # |