From 98d49384c15ea2dc0a58207eb2c93725a91e013e Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sat, 19 May 2012 01:36:01 +0000 Subject: fix the "first time add map does not work on first run" bug in updmap git-svn-id: svn://tug.org/texlive/trunk@26490 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf/scripts/tetex/updmap.pl | 76 ++++++++++++++---------------------- 1 file changed, 30 insertions(+), 46 deletions(-) (limited to 'Master/texmf') diff --git a/Master/texmf/scripts/tetex/updmap.pl b/Master/texmf/scripts/tetex/updmap.pl index 99e939a8236..6e6235e19d0 100755 --- a/Master/texmf/scripts/tetex/updmap.pl +++ b/Master/texmf/scripts/tetex/updmap.pl @@ -15,13 +15,6 @@ # limitation. # # TODO -# IMPORTANT: When a config files is created the FIRST TIME -# it is not included in the following update of maps -# because it does NOT appear in the list of used cnffiles!!! -# We have to re-run the list of files decision routine -# probably best is to factor out the whole main function -# and call it once more from within after an option has -# been set or map enabled/disabled # - check all other invocations # - after TL2012? remove -oldmode version # - after TL2012? Maybe remove support for reading updmap-local.cfg @@ -71,6 +64,7 @@ my $updLSR; my @cmdline_options = ( "oldmode", + "listfiles", "cnffile=s@", "copy", "disable=s@", @@ -104,7 +98,6 @@ my @cmdline_options = ( "help|h", # some debugging invocations "_readsave=s", - "_listupdmap", ); my %settings = ( @@ -320,12 +313,13 @@ sub main { print " $f\n"; } } - $alldata->{'changes_config'} = $changes_config_file; - - if ($opts{'_listupdmap'}) { + if ($opts{'listfiles'}) { + # we listed it above, so be done exit 0; } + $alldata->{'changes_config'} = $changes_config_file; + read_updmap_files(@{$opts{'cnffile'}}); if ($opts{'showoption'}) { @@ -367,7 +361,6 @@ sub main { exit 0; } - # what does this? $updLSR = &mktexupd(); $updLSR->{mustexist}(0); @@ -414,13 +407,6 @@ sub main { unshift @aaa, $changes_config_file; $alldata->{'order'} = [ @aaa ]; # - # since things have changed, reread the whole updmap files - if ($changed) { - delete $alldata->{'updmap'}; - delete $alldata->{'maps'}; - read_updmap_files(@{$opts{'cnffile'}}) if $changed; - } - # setupOutputDir("dvips"); setupOutputDir("pdftex"); setupOutputDir("dvipdfmx"); @@ -1204,6 +1190,7 @@ sub enable_disable_maps { die "$prg: top config file $tc has not been read." if (!defined($alldata->{'updmap'}{$tc})); my $changed = 0; + for my $w (@what) { if ($w =~ m/=/) { # this is --enable MapType=MapName @@ -1214,6 +1201,7 @@ sub enable_disable_maps { disable_map($tc, $w); } } + merge_settings(); return save_updmap($tc); } @@ -1583,10 +1571,31 @@ sub read_updmap_files { } # $alldata->{'order'} = \@l; + + # merge data and check for kanji embed + merge_settings(); +} + +sub merge_settings { # - # merge the settings so that we can check for kanjiEmbed + my @l = @{$alldata->{'order'}}; # - merge_settings(); + # for security clean out everything that was there + %{$alldata->{'merged'}} = (); + # + # first read in the settings + # we read it in *reverse* order and simple fill up the combined data + # thus if there are multiple definitions/settings, the one coming from + # the first in the original list will win! + for my $l (reverse @l) { + # merge settings + if (defined($alldata->{'updmap'}{$l}{'setting'})) { + for my $k (keys %{$alldata->{'updmap'}{$l}{'setting'}}) { + $alldata->{'merged'}{'setting'}{$k}{'val'} = $alldata->{'updmap'}{$l}{'setting'}{$k}{'val'}; + $alldata->{'merged'}{'setting'}{$k}{'origin'} = $l; + } + } + } # my ($kanjiEmbed, $kanjiEmbed_origin) = get_cfg('kanjiEmbed'); my ($kanjiVariant, $kanjiVariant_origin) = get_cfg('kanjiVariant'); @@ -1818,31 +1827,6 @@ sub read_map_file { return \%data; } -# -# merge and update the setting -# -sub merge_settings { - my @l = @{$alldata->{'order'}}; - # - # for security clean out everything that was there - %{$alldata->{'merged'}} = (); - # - # first read in the settings - # we read it in *reverse* order and simple fill up the combined data - # thus if there are multiple definitions/settings, the one coming from - # the first in the original list will win! - for my $l (reverse @l) { - # merge settings - if (defined($alldata->{'updmap'}{$l}{'setting'})) { - for my $k (keys %{$alldata->{'updmap'}{$l}{'setting'}}) { - $alldata->{'merged'}{'setting'}{$k}{'val'} = $alldata->{'updmap'}{$l}{'setting'}{$k}{'val'}; - $alldata->{'merged'}{'setting'}{$k}{'origin'} = $l; - } - } - } - # -} - # # merging the various font definitions # -- cgit v1.2.3