diff options
author | Norbert Preining <preining@logic.at> | 2008-06-22 14:30:01 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2008-06-22 14:30:01 +0000 |
commit | de74901898ff6b07ee9b7b77aaaa232f5f2082b8 (patch) | |
tree | 74e2e30cdb08474354071573af3c7d205f6a8dc2 /Master/tlpkg/TeXLive | |
parent | 09732e2a06a89da7cdf68ad773d8db5122687379 (diff) |
big switch to hyph-utf8 ... for sure not all problems found ...
git-svn-id: svn://tug.org/texlive/trunk@8935 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive')
-rw-r--r-- | Master/tlpkg/TeXLive/TLConfig.pm | 2 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLPDB.pm | 131 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLPOBJ.pm | 2 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 88 |
4 files changed, 132 insertions, 91 deletions
diff --git a/Master/tlpkg/TeXLive/TLConfig.pm b/Master/tlpkg/TeXLive/TLConfig.pm index f81a171951b..53adfb59be5 100644 --- a/Master/tlpkg/TeXLive/TLConfig.pm +++ b/Master/tlpkg/TeXLive/TLConfig.pm @@ -62,7 +62,7 @@ our $TeXLiveAlternativeURL; our $WinSpecialUpdatePackagesRegexp = - '^(texlive\.infra|luatex|bin-tlperl\.win32$|texlive\.infra|bin-texlive)'; + '^(texlive\.infra|luatex|bin-tlperl\.win32$|bin-texlive)'; 1; diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm index 160d783ba60..a5107eb3e5d 100644 --- a/Master/tlpkg/TeXLive/TLPDB.pm +++ b/Master/tlpkg/TeXLive/TLPDB.pm @@ -38,6 +38,7 @@ C<TeXLive::TLPDB> -- A database of TeX Live Packages $tlpdb->updmap_cfg_lines; $tlpdb->fmtutil_cnf_lines; $tlpdb->language_dat_lines; + $tlpdb->language_def_lines; $tlpdb->package_revision("packagename"); $tlpdb->location; $tlpdb->config_src_container; @@ -912,11 +913,6 @@ sub fmtutil_cnf_lines { } } my @formatlines; - open(INFILE,"<$self->{'root'}/texmf/fmtutil/fmtutil-hdr.cnf") - or die("Cannot open $self->{'root'}/texmf/fmtutil/fmtutil-hdr.cnf\n"); - my @tmp = <INFILE>; - close (INFILE); - push @formatlines, @tmp; foreach my $f (sort keys %fmtcnffiles) { open(INFILE,"<$self->{'root'}/texmf/fmtutil/format.$f.cnf") or tlwarn("Cannot open $self->{'root'}/texmf/fmtutil/format.$f.cnf\nThe generated fmtutil.cnf file might be incomplete!\nError: $!\n"); @@ -949,11 +945,6 @@ sub updmap_cfg_lines { } } my @updmaplines; - open(UPDHDR,"<$self->{'root'}/texmf/web2c/updmap-hdr.cfg") - or die("Cannot find $self->{'root'}/texmf/web2c/updmap-hdr.cfg!\n"); - my @tmp = <UPDHDR>; - close(UPDHDR); - push @updmaplines, @tmp; foreach (sort keys %maps) { if ($maps{$_} == 2) { push @updmaplines, "MixedMap $_\n"; @@ -966,50 +957,106 @@ sub updmap_cfg_lines { =item C<< $tlpdb->language_dat_lines >> -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>. +The function C<language_dat_lines> returns the list of all +lines for language.dat that can be generated from the tlpdb. =cut + sub language_dat_lines { + sub make_dat_lines { + my ($name, $lhm, $rhm, $file, @syn) = @_; + my @ret; + push @ret, "$name $file\n"; + foreach (@syn) { + push @ret, "=$_\n"; + } + return(@ret); + } my $self = shift; - my %langfiles; - foreach my $p ($self->list_packages) { - my $obj = $self->get_package ($p); - die "No TeX Live package named $p, too strange" if ! $obj; - foreach my $e ($obj->executes) { - if ($e =~ m/BuildLanguageDat (.*)$/) { - $langfiles{$1} = 1; - } - # others are ignored here + my @lines = $self->_parse_hyphen_execute(\&make_dat_lines); + return(@lines); +} + +=item C<< $tlpdb->language_def_lines >> + +The function C<language_def_lines> returns the list of all +lines for language.def that can be generated from the tlpdb. + +=cut + +sub language_def_lines { + sub make_def_lines { + my ($name, $lhm, $rhm, $file, @syn) = @_; + my $exc = ""; + my @ret; + push @ret, "\\addlanguage\{$name\}\{$file\}\{$exc\}\{$lhm\}\{$rhm\}\n"; + foreach (@syn) { + # synonyms in language.def ??? + push @ret, "\\addlanguage\{$_\}\{$file\}\{$exc\}\{$lhm\}\{$rhm\}\n"; + #debug("Ignoring synonym $_ for $name when creating language.def\n"); } + return(@ret); } + my $self = shift; + my @lines = $self->_parse_hyphen_execute(\&make_def_lines); + return(@lines); +} + + + +sub _parse_hyphen_execute { + my ($self, $coderef) = @_; 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); - push @langlines, @tmp; - - local *INFILE; - foreach my $f (sort keys %langfiles) { - $INFILE = "<$self->{'root'}/texmf/tex/generic/config/language.$f.dat"; - open (INFILE) - or tlwarn("Cannot open $self->{'root'}/texmf/tex/generic/config/language.$f.dat\nThe generated language.dat file might be incomplete!\nError: $!\n"); - @tmp = <INFILE>; - close (INFILE); - push @langlines, @tmp; + foreach my $pkg ($self->list_packages) { + my $obj = $self->get_package ($pkg); + die "No TeX Live package named $pkg, too strange" if ! $obj; + foreach my $e ($obj->executes) { + my $first = 1; + if ($e =~ m/AddHyphen\s+(.*)\s*/) { + my $name; + my $lefthyphenmin; + my $righthyphenmin; + my $file; + my @synonyms; + if ($first) { + push @langlines, "% lines generated from $pkg\n"; + $first = 0; + } + foreach my $p (split(' ', $1)) { + my ($a, $b) = split /=/, $p; + if ($a eq "name") { + die "AddHyphen line needs name=something: $pkg, $e" unless $b; + $name = $b; next; + } + if ($a eq "lefthyphenmin") { + # lefthyphenmin default to 3 + $lefthyphenmin = ( $b ? $b : 2 ); + next; + } + if ($a eq "righthyphenmin") { + $righthyphenmin = ( $b ? $b : 3); + next; + } + if ($a eq "file") { + die "AddHyphen line needs file=something: $pkg, $e" unless $b; + $file = $b; + next; + } + if ($a eq "synonyms") { + @synonyms = split /,/, $b; + next; + } + die "Unknown language directive in $pkg: $e"; + } + my @foo = &$coderef ($name, $lefthyphenmin, $righthyphenmin, $file, @synonyms); + push @langlines, @foo; + } + } } - return @langlines; } - =back =pod diff --git a/Master/tlpkg/TeXLive/TLPOBJ.pm b/Master/tlpkg/TeXLive/TLPOBJ.pm index 20ed1d82358..90ab62ba313 100644 --- a/Master/tlpkg/TeXLive/TLPOBJ.pm +++ b/Master/tlpkg/TeXLive/TLPOBJ.pm @@ -810,7 +810,7 @@ sub make_return_hash_from_executes { } } elsif ($e =~ m/^BuildFormat\s+([^\s]+)\s*$/) { push @formats, $1; - } elsif ($e =~ m/^BuildLanguageDat\s+([^\s]+)\s*$/) { + } elsif ($e =~ m/^AddHyphen\s+([^\s]+)\s*$/) { push @dats, $1; } else { tlwarn("Unknown execute $e in ", $self->name); diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index f766f812109..6f4ee1ef320 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -51,7 +51,8 @@ C<TeXLive::TLUtils> -- utilities used in the TeX Live infrastructure TeXLive::TLUtils::make_local_skeleton($path); TeXLive::TLUtils::create_fmtutil($tlpdb,$dest,$localconf); TeXLive::TLUtils::create_updmap($tlpdb,$dest,$localconf); - TeXLive::TLUtils::create_language($tlpdb,$dest,$localconf); + TeXLive::TLUtils::create_language_dat($tlpdb,$dest,$localconf); + TeXLive::TLUtils::create_language_def($tlpdb,$dest,$localconf); TeXLive::TLUtils::install_packages($from_tlpdb,$to_tlpdb,$what,$opt_src, $opt_doc)>); TeXLive::TLUtils::install_package($what, $filelistref, $target, $platform); @@ -94,10 +95,11 @@ BEGIN { &media &initialize_installer &make_var_skeleton - &sub make_local_skeleton + &make_local_skeleton &create_fmtutil &create_updmap - &create_language + &create_language_dat + &create_language_def &sort_uniq &push_uniq &texdir_check @@ -790,7 +792,7 @@ sub setup_programs { =pod -=item C<download_file( $path, $destination [, $progs ] )> +=item C<download_file( $relpath, $destination [, $progs ] )> Try to download the file given in C<$relpath> from either C<$TeXLiveURL> or C<TeXLiveAlternativeURL> into C<$destination>, which can be either @@ -1045,10 +1047,12 @@ sub make_local_skeleton { =item C<create_updmap($tlpdb, $dest, $localconf)> -=item C<create_language($tlpdb, $dest, $localconf)> +=item C<create_language_dat($tlpdb, $dest, $localconf)> -These three functions create C<fmtutil.cnf>, C<updmap.cfg>, and -C<language.dat>, respectively, in C<$dest> (which by default is below +=item C<create_language_def($tlpdb, $dest, $localconf)> + +These four functions create C<fmtutil.cnf>, C<updmap.cfg>, C<language.dat>, +and C<language.def> 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>. @@ -1061,54 +1065,39 @@ improved (checking for duplicates). sub create_fmtutil { my ($tlpdb,$dest,$localconf) = @_; - my $root = $tlpdb->root; my @lines = $tlpdb->fmtutil_cnf_lines; - if (-r "$localconf") { - # - # this should be done more intelligently, but for now only add those - # lines without any duplication check ... - open FOO, "<$localconf" - or die "strange, -r ok but cannot open $localconf: $!"; - my @tmp = <FOO>; - push @lines, @tmp; - } - if ($#lines >= 0) { - open(OUTFILE,">$dest") - or die("Cannot open $dest for writing: $!"); - - printf OUTFILE "# Generated by %s on %s\n", "$0", scalar localtime; - print OUTFILE @lines; - close(OUTFILE) || warn "close(>$dest) failed: $!"; - } + _create_config_files ($tlpdb, "texmf/fmtutil/fmtutil-hdr.cnf", $dest, $localconf, 0, '#', \@lines); } - + sub create_updmap { my ($tlpdb,$dest,$localconf) = @_; - my $root = $tlpdb->root; my @lines = $tlpdb->updmap_cfg_lines; - if (-r "$localconf") { - # - # this should be done more intelligently, but for now only add those - # lines without any duplication check ... - open FOO, "<$localconf" - or die "strange, -r ok but cannot open $localconf: $!"; - my @tmp = <FOO>; - push @lines, @tmp; - } - if ($#lines >= 0) { - open(OUTFILE,">$dest") - or die("Cannot open $dest for writing: $!"); + _create_config_files ($tlpdb, "texmf/web2c/updmap-hdr.cfg", $dest, $localconf, 0, '#', \@lines); +} - printf OUTFILE "# Generated by %s on %s\n", "$0", scalar localtime; - print OUTFILE @lines; - close(OUTFILE) || warn "close(>$dest) failed: $!"; - } +sub create_language_dat { + my ($tlpdb,$dest,$localconf) = @_; + my @lines = $tlpdb->language_dat_lines; + _create_config_files ($tlpdb, "texmf/tex/generic/config/language.us", $dest, $localconf, 0, '%', \@lines); } -sub create_language { +sub create_language_def { my ($tlpdb,$dest,$localconf) = @_; + my @lines = $tlpdb->language_def_lines; + my @postlines; + push @postlines, "%%% No changes may be made beyond this point.\n"; + push @postlines, "\n"; + push @postlines, "\\uselanguage {USenglish} %%% This MUST be the last line of the file.\n"; + _create_config_files ($tlpdb, "texmf/tex/plain/config/language.us.def", $dest, $localconf, 1, '%', \@lines, @postlines); +} + +sub _create_config_files { + my ($tlpdb, $headfile, $dest,$localconf, $keepfirstline, $cc, $tlpdblinesref, @postlines) = @_; my $root = $tlpdb->root; - my @lines = $tlpdb->language_dat_lines; + open(INFILE,"<$root/$headfile") or die("Cannot open $root/$headfile"); + my @lines = <INFILE>; + push @lines, @$tlpdblinesref; + close (INFILE); if (-r "$localconf") { # # this should be done more intelligently, but for now only add those @@ -1118,17 +1107,22 @@ sub create_language { my @tmp = <FOO>; push @lines, @tmp; } + if (@postlines) { + push @lines, @postlines; + } if ($#lines >= 0) { open(OUTFILE,">$dest") or die("Cannot open $dest for writing: $!"); - printf OUTFILE "%% Generated by %s on %s\n", "$0", scalar localtime; + if (!$keepfirstline) { + print OUTFILE $cc; + printf OUTFILE " Generated by %s on %s\n", "$0", scalar localtime; + } print OUTFILE @lines; close(OUTFILE) || warn "close(>$dest) failed: $!"; } } - =pod =back |