From 01e0cb592a1ac03de82686d2e32a5ff73a39042f Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 22 Mar 2008 19:06:39 +0000 Subject: regularize language-generation related formatting, errors, doc git-svn-id: svn://tug.org/texlive/trunk@7081 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf/scripts/texlive/generate-language.pl | 22 +++++++++++----- Master/tlpkg/TeXLive/TLPDB.pm | 31 +++++++++++++++-------- Master/tlpkg/TeXLive/TLUtils.pm | 11 ++++---- 3 files changed, 40 insertions(+), 24 deletions(-) diff --git a/Master/texmf/scripts/texlive/generate-language.pl b/Master/texmf/scripts/texlive/generate-language.pl index 3def1f1e757..0077dfa1a78 100755 --- a/Master/texmf/scripts/texlive/generate-language.pl +++ b/Master/texmf/scripts/texlive/generate-language.pl @@ -49,11 +49,17 @@ exit (&main ()); sub main { # get the db. - my $tlpdb = TeXLive::TLPDB->new ("root" => "$master"); - $dest || ($dest = kpsewhich("TEXMFSYSVAR") . "/tex/generic/config/language.dat"); - $localconf || ($localconf = kpsewhich("TEXMFLOCAL") . "/tex/generic/config/language-local.dat"); - tllog($::LOG_NORMAL, "writing language.dat data to $dest\n"); - TeXLive::TLUtils::create_language($tlpdb, $dest, $localconf); + my $tlpdb = TeXLive::TLPDB->new ("root" => $master); + + $dest = kpsewhich ("TEXMFSYSVAR") . "/tex/generic/config/language.dat" + if ! $dest; + + $localconf = kpsewhich ("TEXMFLOCAL") + . "/tex/generic/config/language-local.dat" + if ! $localconf; + + tllog ($::LOG_NORMAL, "$0: writing language data to $dest\n"); + TeXLive::TLUtils::create_language ($tlpdb, $dest, $localconf); } @@ -73,11 +79,13 @@ generate-language [OPTION]... =item C<-dest> I -specifies the output file +specifies the output file (default +TEXMFSYSVAR/tex/generic/config/language.dat). =item C<-local> I -specifies the local additions +specifies the (optional) local additions (default +TEXMFLOCAL/tex/generic/config/language-local.dat). =back diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm index e30c8d3d95b..696342ecf18 100644 --- a/Master/tlpkg/TeXLive/TLPDB.pm +++ b/Master/tlpkg/TeXLive/TLPDB.pm @@ -733,8 +733,11 @@ sub updmap_cfg_lines { =item C<< $tlpdb->language_dat_lines >> -The function C returns the list of a language.dat file -containing only those hyphenation patterns present in the installation. +The function C returns the concatenation of all +files specified in C directives in the present +TLPDB. Exception: the result always begins with the contents of +C file. This and all the other files are looked for in +C. =cut sub language_dat_lines { @@ -742,7 +745,7 @@ sub language_dat_lines { my %langfiles; foreach my $p ($self->list_packages) { my $obj = $self->get_package ($p); - die "No TeX Live package named $p, strange.\n" if ! $obj; + die "No TeX Live package named $p, too strange" if ! $obj; foreach my $e ($obj->executes) { if ($e =~ m/BuildLanguageDat (.*)$/) { $langfiles{$1} = 1; @@ -750,20 +753,26 @@ sub language_dat_lines { # others are ignored here } } - my @langlines; - open(LANHDR,"<$self->{'root'}/texmf/tex/generic/config/language.us") - or die("Cannot find $self{'root'}/texmf/tex/generic/config/language.us!\n"); + my @langlines = (); + + # must start with language.us. + local *LANHDR; + $LANHDR = "<$self->{'root'}/texmf/tex/generic/config/language.us"; + open (LANHDR) or die "open($LANHDR) failed: $!"; my @tmp = ; - close(LANHDR); + close (LANHDR); push @langlines, @tmp; + + local *INFILE; foreach my $f (keys %langfiles) { - open(INFILE,"<$self->{'root'}/texmf/tex/generic/config/language.$f.dat") - or die("Cannot open $self->{'root'}/texmf/tex/generic/config/language.$f.cnf"); + $INFILE = "<$self->{'root'}/texmf/tex/generic/config/language.$f.dat"; + open (INFILE) or die "open($INFILE) failed: $!"; @tmp = ; - close(INFILE); + close (INFILE); push @langlines, @tmp; } - return(@langlines); + + return @langlines; } diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index 2daeb788930..ed59212b8d0 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -1,7 +1,6 @@ # $Id$ -# TeXLive::TLUtils.pm -# Common Functions for TeX Live Infrastructure -# +# The inevitable utilities for TeX Live. +# # Copyright 2007 Norbert Preining # This file is licensed under the GNU General Public License version 2 # or any later version. @@ -13,7 +12,7 @@ package TeXLive::TLUtils; =head1 NAME -C -- Utilities used in the TeX Live Infrastructure Modules +C -- utilities used in the TeX Live infrastructure =head1 SYNOPSIS @@ -947,13 +946,13 @@ sub make_local_skeleton { =item C These three functions create C, C, and -C in in C<$dest> (which by default is below +C, respectively, in C<$dest> (which by default is below C<$TEXMFSYSVAR>). These functions merge the information present in the TLPDB C<$tlpdb> (formats, maps, hyphenations) with local configuration additions: C<$localconf>. Currently the "merging" is done trivially by appending the content of -the local configuration files at the end of the file. This could be +the local configuration files at the end of the file. This should be improved (checking for duplicates). =cut -- cgit v1.2.3