summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-03-22 19:06:39 +0000
committerKarl Berry <karl@freefriends.org>2008-03-22 19:06:39 +0000
commit01e0cb592a1ac03de82686d2e32a5ff73a39042f (patch)
treec8a61e2268d9d403cdc8e8286ce4dff873cbbf6f
parent54d1d19de1d8af122fcdfa82f8debdbe5c42a1ae (diff)
regularize language-generation related formatting, errors, doc
git-svn-id: svn://tug.org/texlive/trunk@7081 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xMaster/texmf/scripts/texlive/generate-language.pl22
-rw-r--r--Master/tlpkg/TeXLive/TLPDB.pm31
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm11
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<output file>
-specifies the output file
+specifies the output file (default
+TEXMFSYSVAR/tex/generic/config/language.dat).
=item C<-local> I<local conf file>
-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<language_dat_lines> returns the list of a language.dat file
-containing only those hyphenation patterns present in the installation.
+The function C<language_dat_lines> returns the concatenation of all
+files specified in C<BuildLanguageDat execute> directives in the present
+TLPDB. Exception: the result always begins with the contents of
+C<language.us> file. This and all the other files are looked for in
+C<TLROOT/texmf/tex/generic/config>.
=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 = <LANHDR>;
- 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 = <INFILE>;
- 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<TeXLive::TLUtils> -- Utilities used in the TeX Live Infrastructure Modules
+C<TeXLive::TLUtils> -- utilities used in the TeX Live infrastructure
=head1 SYNOPSIS
@@ -947,13 +946,13 @@ sub make_local_skeleton {
=item C<create_language($tlpdb, $dest, $localconf)>
These three functions create C<fmtutil.cnf>, C<updmap.cfg>, and
-C<language.dat> in in C<$dest> (which by default is below
+C<language.dat>, 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