diff options
Diffstat (limited to 'Master/tlpkg')
-rw-r--r-- | Master/tlpkg/TeXLive/TLMedia.pm | 38 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 21 |
2 files changed, 41 insertions, 18 deletions
diff --git a/Master/tlpkg/TeXLive/TLMedia.pm b/Master/tlpkg/TeXLive/TLMedia.pm index ff98271e0dc..89ef0737684 100644 --- a/Master/tlpkg/TeXLive/TLMedia.pm +++ b/Master/tlpkg/TeXLive/TLMedia.pm @@ -10,7 +10,7 @@ package TeXLive::TLMedia; use TeXLive::TLConfig; use TeXLive::TLPostInstall; -use TeXLive::TLUtils qw(tllog copy win32 dirname mkdirhier conv_to_win_path basename download_file); +use TeXLive::TLUtils qw(tllog copy win32 dirname mkdirhier conv_to_win_path basename download_file merge_into); use TeXLive::TLPDB; use Cwd qw/abs_path/; @@ -74,12 +74,6 @@ sub new return $self; } -# returns 0 for error -# otherwise a bitmap which specifies what commands have to be run -# always: 0x0001 mktexlsr -# addMap: 0x0010 updmap-sys -# BuildFormat: 0x0100 fmtutil-sys --missing -# BuildLanguageDat: 0x1000 fmtutil-sys --by-hyphen language.dat # sub install_package { my ($self, $pkg, $totlpdb, $nodepends, $nopostinstall, $fallbackmedia) = @_; @@ -190,18 +184,23 @@ sub install_package { $totlpdb->add_tlpobj($tlpobj); $totlpdb->save; # compute the return value - $ret |= 0x0001; # mktexlsr + my %ret; + my (@maps, @formats, @dats); + $ret{'mktexlsr'} = 1; foreach my $e ($tlpobj->executes) { - if ($e =~ m/^add/) { - $ret |= 0x0010; - } elsif ($e =~ m/^BuildFormat/) { - $ret |= 0x0100; - } elsif ($e =~ m/^BuildLanguageDat/) { - $ret |= 0x1000; + if ($e =~ m/^add((Mixed)?Map)\s+([^\s]+)\s*$/) { + push @maps, "enable $1 $3"; + } elsif ($e =~ m/^BuildFormat\s+([^\s]+)\s*$/) { + push @formats, $1; + } elsif ($e =~ m/^BuildLanguageDat\s+([^\s]+)\s*$/) { + push @dats, $1; } else { warn("Unknown execute $e in $pkg"); } } + $ret{'map'} = [ @maps ] if (@maps); + $ret{'format'} = [ @formats ] if (@formats); + $ret{'language'} = [ @dats ] if (@dats); # now install all the depends if they are not already present if (!$nodepends) { foreach my $d ($tlpobj->depends) { @@ -209,18 +208,21 @@ sub install_package { my $foo = $1; foreach my $a ($totlpdb->available_architectures) { if (!defined($totlpdb->get_package("$foo.$a"))) { - $ret |= $self->install_package("$foo.$a", $totlpdb, $nodepends, $fallbackmedia); + merge_into(\%ret, + $self->install_package("$foo.$a", $totlpdb, $nodepends, $fallbackmedia)); } } } elsif ($d =~ m/^(.*).win32$/) { # install only of win32 is under the available archs if (TeXLive::TLUtils::member("win32",$totlpdb->available_architectures)) { - $ret |= $self->install_package($d, $totlpdb, $nodepends, $fallbackmedia); + merge_into(\%ret, + $self->install_package($d, $totlpdb, $nodepends, $fallbackmedia)); } } else { if (!defined($totlpdb->get_package($d))) { # we have to install it! - $ret |= $self->install_package($d, $totlpdb, $nodepends, $fallbackmedia); + merge_into(\%ret, + $self->install_package($d, $totlpdb, $nodepends, $fallbackmedia)); } } } @@ -232,7 +234,7 @@ sub install_package { &{$PostInstall{$pkg}}($totlpdb->root); } } - return $ret; + return \%ret; } } diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index 767a4e87b72..1f55b21796c 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -60,6 +60,7 @@ C<TeXLive::TLUtils> -- utilities used in the TeX Live infrastructure TeXLive::TLUtils::push_uniq(\@list, @items); TeXLive::TLUtils::member($item, @list); TeXLive::TLUtils::tllog($level, $string); + TeXLive::TLUtils::merge_into(\%to, \%from); TeXLive::TLUtils::texdir_check($texdir); TeXLive::TLUtils::kpsewhich; TeXLive::TLUtils::conv_to_win_path($path); @@ -105,6 +106,7 @@ BEGIN { &conv_to_win_path &setup_programs &download_file + &merge_into ); @EXPORT = qw(tllog setup_programs download_file); } @@ -1118,6 +1120,25 @@ sub member { =pod +=item C<merge_into(\%to, \%from)> + +Merges the keys of %from into %to. + +=cut + +sub merge_into { + my ($to, $from) = @_; + foreach my $k (keys %$from) { + if (defined($to->{$k})) { + push @{$to->{$k}}, @{$from->{$k}}; + } else { + $to->{$k} = [ @{$from->{$k}} ]; + } + } +} + +=pod + =item C<texdir_check($texdir)> Test whether installation with TEXDIR set to $texdir would succeed due to |